[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dleftjpn5ayvog.fsf%l.stelmach@samsung.com>
Date: Thu, 22 Oct 2020 20:14:55 +0200
From: Lukasz Stelmach <l.stelmach@...sung.com>
To: Joe Perches <joe@...ches.com>
Cc: Andy Whitcroft <apw@...onical.com>, linux-kernel@...r.kernel.org,
Bartłomiej Żolnierkiewicz
<b.zolnierkie@...sung.com>,
Marek Szyprowski <m.szyprowski@...sung.com>
Subject: Re: [PATCH] checkpatch: ignore ethtool CamelCase constants
It was <2020-10-22 czw 04:57>, when Joe Perches wrote:
> On Thu, 2020-10-22 at 13:01 +0200, Łukasz Stelmach wrote:
>> Ignore CamelCase constants describing Ethernet link parameters defined
>> in include/uapi/linux/ethtool.h.
> []
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
>> @@ -5295,6 +5295,10 @@ sub process {
>> #CamelCase
>> if ($var !~ /^$Constant$/ &&
>> $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
>> +#Ignore constants from include/uapi/linux/ethtool.h
>> + $var !~ /^ETHTOOL_LINK_MODE_[0-9A-Za-z_]+_BIT$/ &&
>> + $var !~ /^ADVERTISED_[0-9A-Za-z_]+$/ &&
>> + $var !~ /^SUPPORTED_[0-9A-Za-z_]+$/ &&
>> #Ignore Page<foo> variants
>> $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
>> #Ignore SI style variants like nS, mV and dB
>
> How about changing this to be a bit broader?
>
> $var !~ /^(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]/
>
> There are 2 grep searches below:
>
> First is in include/uapi/
> Second is just drivers/
>
> Finding the matches in include/uapi shows a
> reasonable list, but run against all the .[ch] files
> in the kernel shows over 7000 entries.
>
> Maybe that's too large a list.
>
> $ git grep -Poh '#\s*define\s+\b(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]\w*' include/uapi
> #define DRM_MODE_CONNECTOR_Unknown
[...]
> #define VIRTIO_NET_HASH_REPORT_UDPv6_EX
>
And we've got enums too.
> But run against drivers it's a huge list.
> Maybe too big?
> Here are the top used entries.
> Take off the awk bits to see the entire list.
>
> It seems about half of all the entries are for autogenerated,
> never used names from drivers/gpu and drivers/staging
>
> $ git grep -Poh '\b(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]\w+' -- drivers | \
> sort | uniq -c | awk '{if ($1 > 10) { print $0;}}'
> 46 ADVERTISED_Asym_Pause
[...]
> 15 Y_UBWC_Plane
Oh, I had no idea there is so many of them. Your regex loooks
reasonable. However, I am afraid it may allow for some false negatives
(stuff that should be fixed, but won't be reported). I don't know.
--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics
Download attachment "signature.asc" of type "application/pgp-signature" (488 bytes)
Powered by blists - more mailing lists