* False positive EXPORT_SYMBOL warning with NS variants
@ 2021-09-03 16:01 Ian Pilcher
2021-09-05 5:51 ` Joe Perches
2021-10-07 16:04 ` [PATCH] checkpatch: Improve EXPORT_SYMBOL test for EXPORT_SYMBOL_NS uses Joe Perches
0 siblings, 2 replies; 4+ messages in thread
From: Ian Pilcher @ 2021-09-03 16:01 UTC (permalink / raw)
To: Andy Whitcroft, Joe Perches; +Cc: Dwaipayan Ray, Lukas Bulwahn, linux-kernel
$ 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.
--
========================================================================
In Soviet Russia, Google searches you!
========================================================================
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: False positive EXPORT_SYMBOL warning with NS variants
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
2021-10-07 16:04 ` [PATCH] checkpatch: Improve EXPORT_SYMBOL test for EXPORT_SYMBOL_NS uses Joe Perches
1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2021-09-05 5:51 UTC (permalink / raw)
To: Ian Pilcher, Andy Whitcroft; +Cc: Dwaipayan Ray, Lukas Bulwahn, linux-kernel
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";
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: False positive EXPORT_SYMBOL warning with NS variants
2021-09-05 5:51 ` Joe Perches
@ 2021-09-09 15:00 ` Ian Pilcher
0 siblings, 0 replies; 4+ messages in thread
From: Ian Pilcher @ 2021-09-09 15:00 UTC (permalink / raw)
To: Joe Perches, Andy Whitcroft; +Cc: Dwaipayan Ray, Lukas Bulwahn, linux-kernel
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!
========================================================================
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] checkpatch: Improve EXPORT_SYMBOL test for EXPORT_SYMBOL_NS uses
2021-09-03 16:01 False positive EXPORT_SYMBOL warning with NS variants Ian Pilcher
2021-09-05 5:51 ` Joe Perches
@ 2021-10-07 16:04 ` Joe Perches
1 sibling, 0 replies; 4+ messages in thread
From: Joe Perches @ 2021-10-07 16:04 UTC (permalink / raw)
To: Andrew Morton
Cc: Ian Pilcher, Andy Whitcroft, Dwaipayan Ray, Lukas Bulwahn, linux-kernel
The EXPORT_SYMBOL test expects a single argument but definitions of
EXPORT_SYMBOL_NS have multiple arguments.
Update the test to extract only the first argument from any
EXPORT_SYMBOL related definition.
Reported-by: Ian Pilcher <arequipeno@gmail.com>
Signed-off-by: Joe Perches <joe@perches.com>
---
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";
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-10-07 16:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-10-07 16:04 ` [PATCH] checkpatch: Improve EXPORT_SYMBOL test for EXPORT_SYMBOL_NS uses Joe Perches
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).