linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Ian Pilcher <arequipeno@gmail.com>, Andy Whitcroft <apw@canonical.com>
Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: False positive EXPORT_SYMBOL warning with NS variants
Date: Sat, 04 Sep 2021 22:51:01 -0700	[thread overview]
Message-ID: <bef77537a67749df31fc7cb5549744ff7b76f6de.camel@perches.com> (raw)
In-Reply-To: <d63da2a8-1624-21a8-f8ca-f7477c20e56b@gmail.com>

On Fri, 2021-09-03 at 11:01 -0500, Ian Pilcher wrote:
> $ cat foo.c
> // SPDX-License-Identifier: GPL-2.0-only
> void (*foo)(void);
> EXPORT_SYMBOL_NS(foo, FOO);
> 
> $ scripts/checkpatch.pl -f foo.c
> WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
> #3: FILE: foo.c:3:
> +EXPORT_SYMBOL_NS(foo, FOO);
> 
> The non-NS EXPORT_SYMBOL variants don't trigger this warning.
> 

Try this:
---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 88cb294dc4472..91798b07c6cb5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4449,6 +4449,7 @@ sub process {
 			#   XXX(foo);
 			#   EXPORT_SYMBOL(something_foo);
 			my $name = $1;
+			$name =~ s/^\s*($Ident).*/$1/;
 			if ($stat =~ /^(?:.\s*}\s*\n)?.([A-Z_]+)\s*\(\s*($Ident)/ &&
 			    $name =~ /^${Ident}_$2/) {
 #print "FOO C name<$name>\n";


  reply	other threads:[~2021-09-05  6:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 16:01 False positive EXPORT_SYMBOL warning with NS variants Ian Pilcher
2021-09-05  5:51 ` Joe Perches [this message]
2021-09-09 15:00   ` Ian Pilcher
2021-10-07 16:04 ` [PATCH] checkpatch: Improve EXPORT_SYMBOL test for EXPORT_SYMBOL_NS uses Joe Perches

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=bef77537a67749df31fc7cb5549744ff7b76f6de.camel@perches.com \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=arequipeno@gmail.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.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).