lkml.org 
[lkml]   [2017]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH] scripts: checkpatch.pl: remove obsolete in_atomic rule
From
Date


On 11/6/17 5:52 AM, Michal Hocko wrote:
> On Sat 04-11-17 03:08:06, Yang Shi wrote:
>> checkpatch.pl still reports the below in_atomic warning:
>>
>> WARNING: use of in_atomic() is incorrect outside core kernel code
>> + if (in_atomic())
>>
>> But, in_atomic() has been used outside kernel dir for a long time, and
>> even drivers. So, remove the obsolete rule even though they can be
>> ignored.
>
> NAK. in_atomic is tricky and shouldn't be used. I would bet most of the
> usage is simply broken. See more http://lkml.kernel.org/r/20171106100558.GD3165@worktop.lehotels.local

Thanks for following up. Yes, it sounds so. However, there is not a
reliable and effective approach to check atomic context for both PREEMPT
and !PREEMPT.

Yang

>
>> Signed-off-by: Yang Shi <yang.s@alibaba-inc.com>
>> CC: Andrew Morton <akpm@linux-foundation.org>
>> ---
>> Not sure if removing the obsolete rule is preferred by checkpatch.pl, anyway
>> it sounds not make sense to keep invalid rule.
>>
>> scripts/checkpatch.pl | 11 -----------
>> 1 file changed, 11 deletions(-)
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index 8b80bac..e8cf94f 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -6231,17 +6231,6 @@ sub process {
>> "Using $1 should generally have parentheses around the comparison\n" . $herecurr);
>> }
>>
>> -# whine mightly about in_atomic
>> - if ($line =~ /\bin_atomic\s*\(/) {
>> - if ($realfile =~ m@^drivers/@) {
>> - ERROR("IN_ATOMIC",
>> - "do not use in_atomic in drivers\n" . $herecurr);
>> - } elsif ($realfile !~ m@^kernel/@) {
>> - WARN("IN_ATOMIC",
>> - "use of in_atomic() is incorrect outside core kernel code\n" . $herecurr);
>> - }
>> - }
>> -
>> # whine about ACCESS_ONCE
>> if ($^V && $^V ge 5.10.0 &&
>> $line =~ /\bACCESS_ONCE\s*$balanced_parens\s*(=(?!=))?\s*($FuncArg)?/) {
>> --
>> 1.8.3.1
>

\
 
 \ /
  Last update: 2017-11-06 17:09    [W:0.098 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site