Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp610373pxv; Thu, 22 Jul 2021 08:06:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydJez8R/JmKLbsZhcozWsj8g+qzjki/OLZ2pa/sws34qsKbbfb3gV6XkitB7E7DmmSkmHv X-Received: by 2002:a17:906:4f05:: with SMTP id t5mr320086eju.351.1626966416024; Thu, 22 Jul 2021 08:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626966416; cv=none; d=google.com; s=arc-20160816; b=sb7yyFP+XDU2fNfdxz+8G1SI0cp36MQcHlNXEFR83CF4rM0VPqF0EUiGCHwJ/fHwBN 9lfvmIhAd9muBihzQcwTAUcOR0GiRhUC5x8fkvk3IYhtfIjWkBwWmdHzfsTaixl3pYw8 fkVCmNw97nHFerkbXR8oQdegrxlMrAk1goZ4YspZRa+U1R60SAoy5T6csliENzgU3SV2 i/jbeOo8y8SWE3P+uoKgZGsyUKqwfY3uxfmU84CJ2dlFv5iUev8Dx5C21+L9QkIW3dne Bjg3OP9JPd1wv5o9VSA6fYXaO6WiJoncTEuMSl+6gTgh4UZHv/N1JqkFHN/RnofbeYRR 2u9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=AwaMCiyUiE0LDSy9w/zVWpQJPo5AIi4EyS6vpO3p/hQ=; b=srRG1ChkYdG72A+Ot5KAq0pQ/vWF2w2wiWjPNNsK+2KQNTD6eWGxdD4qklsNac/Ist JuZfPSJ3V8Kn5NoejG2D1XdxuJ7OHljaOPCN1gb1SQRUVMMNn6SBvIAX1pnFTEvDM/s0 HcWY2o5sfzCrtyw5YZ9VKX2JxjxV3O/UiUDoDBMm9qM5yFuCFXz0Awz7bE1X2WwCPKaL fsTPmm2+PII5kpx61FNpK6PTt4NnfCWtcAJynpYlrVt6mcYzH2opfgS1HzS7M//v4Flj ot4xCBxfMtgk9ZFOf+QqG4OgmFt0TuMS+eWbOhnFrOyo1bTYPYkmLDwYR7AMdYhMtxLX b+5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si38940899edi.368.2021.07.22.08.06.23; Thu, 22 Jul 2021 08:06:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232524AbhGVOVq convert rfc822-to-8bit (ORCPT + 99 others); Thu, 22 Jul 2021 10:21:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:53578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232517AbhGVOVp (ORCPT ); Thu, 22 Jul 2021 10:21:45 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7DA5A6128C; Thu, 22 Jul 2021 15:02:19 +0000 (UTC) Date: Thu, 22 Jul 2021 11:02:12 -0400 From: Steven Rostedt To: Zhang Jianhua Cc: , , , , , , Subject: Re: [PATCH -next] trace doc: Fix the wrong example of tracepoint Message-ID: <20210722110212.05ec6ee3@oasis.local.home> In-Reply-To: <20210720020607.4128715-1-chris.zjh@huawei.com> References: <20210720020607.4128715-1-chris.zjh@huawei.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Jul 2021 10:06:07 +0800 Zhang Jianhua wrote: > 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. Actually, the above is not quite correct. By removing DEFINE_TRACE() you just removed the tracepoint entirely, making it non-existent. This is a very old document and probably has a lot more wrong with it than just this. But for this case, you probably want it to read: #define CREATE_TRACE_POINTS #include Otherwise the tracepoint is never created. -- Steve > > -------- > > Signed-off-by: Zhang Jianhua > --- > 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 > > #define CREATE_TRACE_POINTS > - DEFINE_TRACE(subsys_eventname); > > void somefct(void) > {