linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Pilcher <arequipeno@gmail.com>
To: Joe Perches <joe@perches.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: Thu, 9 Sep 2021 10:00:29 -0500	[thread overview]
Message-ID: <95eaf91f-0a15-e3e3-0e14-ed0d03713874@gmail.com> (raw)
In-Reply-To: <bef77537a67749df31fc7cb5549744ff7b76f6de.camel@perches.com>

On 9/5/21 12:51 AM, Joe Perches wrote:
> 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";
> 

Seems to work

-- 
========================================================================
                  In Soviet Russia, Google searches you!
========================================================================

  reply	other threads:[~2021-09-09 15:00 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
2021-09-09 15:00   ` Ian Pilcher [this message]
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=95eaf91f-0a15-e3e3-0e14-ed0d03713874@gmail.com \
    --to=arequipeno@gmail.com \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.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).