linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	linux-pwm@vger.kernel.org,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-trace-kernel@vger.kernel.org,
	Trevor Gamblin <tgamblin@baylibre.com>
Subject: Re: [PATCH v3 6/8] pwm: Add tracing for waveform callbacks
Date: Tue, 30 Jul 2024 10:12:46 -0400	[thread overview]
Message-ID: <20240730101246.5fef41fb@gandalf.local.home> (raw)
In-Reply-To: <7b9c9ee490df1df1de3bbfafd501f45c6cb2ec4c.1722261050.git.u.kleine-koenig@baylibre.com>

On Mon, 29 Jul 2024 16:34:22 +0200
Uwe Kleine-König <u.kleine-koenig@baylibre.com> 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	other threads:[~2024-07-30 14:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-29 14:34 [PATCH v3 0/8] pwm: New abstraction and userspace API Uwe Kleine-König
2024-07-29 14:34 ` [PATCH v3 6/8] pwm: Add tracing for waveform callbacks Uwe Kleine-König
2024-07-30 14:12   ` Steven Rostedt [this message]
2024-07-30 15:16     ` Uwe Kleine-König
2024-08-06 17:51 ` [PATCH v3 0/8] pwm: New abstraction and userspace API Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240730101246.5fef41fb@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=tgamblin@baylibre.com \
    --cc=u.kleine-koenig@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).