[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250213121028.48711-1-kuniyu@amazon.com>
Date: Thu, 13 Feb 2025 21:10:28 +0900
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <pabeni@...hat.com>
CC: <apw@...onical.com>, <davem@...emloft.net>, <dwaipayanray1@...il.com>,
<edumazet@...gle.com>, <horms@...nel.org>, <joe@...ches.com>,
<kuba@...nel.org>, <kuni1840@...il.com>, <kuniyu@...zon.com>,
<lukas.bulwahn@...il.com>, <netdev@...r.kernel.org>
Subject: Re: [PATCH v1 net-next] checkpatch: Discourage a new use of rtnl_lock() variants.
From: Paolo Abeni <pabeni@...hat.com>
Date: Thu, 13 Feb 2025 12:03:51 +0100
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 7b28ad331742..09d5420436cc 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -6995,6 +6995,12 @@ sub process {
> > # }
> > # }
> >
> > +# A new use of rtnl_lock() is discouraged as it's being converted to rtnl_net_lock(net).
> > + if ($line =~ /^\+.*\brtnl_(try)?lock(_interruptible|_killable)?\(\)/) {
>
> I think you need to add '\s*' just before '\(' to avoid the test being
> fooled by some bad formatting.
Will add that. BTW, it's also caught by another warning.
WARNING: space prohibited between function name and open parenthesis '('
#18: FILE: net/core/rtnetlink.c:79:
+ rtnl_lock ();
> Also I'm unsure if the '^\+.*' header is strictly required - it should
> but some/most existing tests don't use it, do you know why?
I didn't notice but exactly, the following matches only + line.
if ($line =~ /\brtnl_(try)?lock(_interruptible|_killable)?\s*\(\)/) {
Looks like the '-' diff is filtered, matching '-' doesn't make sense.
This function looks suspicious ? (maybe wrong, I'm not familiar with perl)
---8<---
sub raw_line {
my ($linenr, $cnt) = @_;
my $offset = $linenr - 1;
$cnt++;
my $line;
while ($cnt) {
$line = $rawlines[$offset++];
next if (defined($line) && $line =~ /^-/);
$cnt--;
}
return $line;
}
---8<---
Thanks!
Powered by blists - more mailing lists