linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhang Jianhua <chris.zjh@huawei.com>
To: <corbet@lwn.net>, <paul.walmsley@sifive.com>,
	<palmer@dabbelt.com>, <aou@eecs.berkeley.edu>,
	<chris.zjh@huawei.com>, <rostedt@goodmis.org>
Cc: <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-riscv@lists.infradead.org>
Subject: [PATCH -next] trace doc: Fix the wrong example of tracepoint
Date: Tue, 20 Jul 2021 10:06:07 +0800	[thread overview]
Message-ID: <20210720020607.4128715-1-chris.zjh@huawei.com> (raw)

The example in tracepoints.rst is out of date, the build error below
will occur if coding according to example in the document.

drivers/irqchip/irq-riscv-intc.c:24:24:
error: macro "DEFINE_TRACE" requires 3 arguments, but only 1 given
   24 | DEFINE_TRACE(test_event);
      |                        ^
In file included from include/trace/events/test.h:8,
from drivers/irqchip/irq-riscv-intc.c:22:
include/linux/tracepoint.h:368:
note: macro "DEFINE_TRACE" defined here
  368 | #define DEFINE_TRACE(name, proto, args)
      |
drivers/irqchip/irq-riscv-intc.c:24:1:
warning: data definition has no type or storage class
   24 | DEFINE_TRACE(test_event);
      | ^~~~~~~~~~~~
drivers/irqchip/irq-riscv-intc.c:24:1:
error: type defaults to ‘int’ in declaration of ‘DEFINE_TRACE’
[-Werror=implicit-int]

There are two reasons for this error. On the one hand, the macro DEFINE_TRACE
has been refactored in commit d25e37d89dd2 ("tracepoint: Optimize using
static_call()") from DEFINE_TRACE(name) to DEFINE_TRACE(name, proto, args),
and the doc is not updated in time. On the other hand, the tracepoint has been
defined in header file, and it does not need to define repeatedly in C file.

--------

Signed-off-by: Zhang Jianhua <chris.zjh@huawei.com>
---
 Documentation/trace/tracepoints.rst | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Documentation/trace/tracepoints.rst b/Documentation/trace/tracepoints.rst
index 0cb8d9ca3d60..fbb2cb4abd3d 100644
--- a/Documentation/trace/tracepoints.rst
+++ b/Documentation/trace/tracepoints.rst
@@ -66,7 +66,6 @@ In subsys/file.c (where the tracing statement must be added)::
 	#include <trace/events/subsys.h>
 
 	#define CREATE_TRACE_POINTS
-	DEFINE_TRACE(subsys_eventname);
 
 	void somefct(void)
 	{
-- 
2.31.0


             reply	other threads:[~2021-07-20  2:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20  2:06 Zhang Jianhua [this message]
2021-07-22 15:02 ` [PATCH -next] trace doc: Fix the wrong example of tracepoint Steven Rostedt

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=20210720020607.4128715-1-chris.zjh@huawei.com \
    --to=chris.zjh@huawei.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=rostedt@goodmis.org \
    /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).