On Mon, 29 Jul 2024 16:34:22 +0200
Uwe Kleine-König <[email protected]> wrote:

> diff --git a/include/trace/events/pwm.h b/include/trace/events/pwm.h
> index 8022701c446d..8ba898fd335c 100644
> --- a/include/trace/events/pwm.h
> +++ b/include/trace/events/pwm.h
> @@ -8,15 +8,135 @@
>  #include <linux/pwm.h>
>  #include <linux/tracepoint.h>
>  
> +#define TP_PROTO_pwm(args...)                                                
>         \
> +     TP_PROTO(struct pwm_device *pwm, args)
> +
> +#define TP_ARGS_pwm(args...)                                                 
> \
> +     TP_ARGS(pwm, args)
> +
> +#define TP_STRUCT__entry_pwm(args...)                                        
>         \
> +     TP_STRUCT__entry(                                                       
> \
> +             __field(unsigned int, chipid)                                   
> \
> +             __field(unsigned int, hwpwm)                                    
> \
> +             args)
> +
> +#define TP_fast_assign_pwm(args...)                                          
> \
> +     TP_fast_assign(                                                         
> \
> +             __entry->chipid = pwm->chip->id;                                
> \
> +             __entry->hwpwm = pwm->hwpwm;                                    
> \
> +             args)
> +
> +#define TP_printk_pwm(fmt, args...)                                          
> \
> +     TP_printk("pwmchip%u.%u: " fmt, __entry->chipid, __entry->hwpwm, args)
> +
> +#define __field_pwmwf(wf)                                                    
> \
> +     __field(u64, wf ## _period_length_ns)                                   
> \
> +     __field(u64, wf ## _duty_length_ns)                                     
> \
> +     __field(u64, wf ## _duty_offset_ns)                                     
> \
> +
> +#define fast_assign_pwmwf(wf)                                                
>         \
> +     __entry->wf ## _period_length_ns = wf->period_length_ns;                
> \
> +     __entry->wf ## _duty_length_ns = wf->duty_length_ns;                    
> \
> +     __entry->wf ## _duty_offset_ns = wf->duty_offset_ns
> +
> +#define printk_pwmwf_format(wf)                                              
>         \
> +     "%lld/%lld [+%lld]"
> +
> +#define printk_pwmwf_formatargs(wf)                                          
> \
> +     __entry->wf ## _duty_length_ns, __entry->wf ## _period_length_ns, 
> __entry->wf ## _duty_offset_ns
> +

The above is interesting. But if it works for you, then you do you ;-)

-- Steve


> +TRACE_EVENT(pwm_round_waveform_tohw,
> +
> +     TP_PROTO_pwm(const struct pwm_waveform *wf, void *wfhw, int err),
> +
> +     TP_ARGS_pwm(wf, wfhw, err),
> +
> +     TP_STRUCT__entry_pwm(
> +             __field_pwmwf(wf)
> +             __field(void *, wfhw)
> +             __field(int, err)
> +     ),
> +
> +     TP_fast_assign_pwm(
> +             fast_assign_pwmwf(wf);
> +             __entry->wfhw = wfhw;
> +             __entry->err = err;
> +     ),
> +
> +     TP_printk_pwm(printk_pwmwf_format(wf) " > %p err=%d",
> +             printk_pwmwf_formatargs(wf), __entry->wfhw, __entry->err)
> +);
> +

Reply via email to