2021-07-16 18:23:43

by Dwaipayan Ray

[permalink] [raw]
Subject: [PATCH] checkpatch: remove obsolete check for __dev* section markers

Commit 54b956b90360 ("Remove __dev* markings from init.h")
completely removed the definitions of __dev* section
markers from init.h. They can no longer pop up in the kernel
and hence the check for those markers is unneeded now.

So remove __dev* section markers check from checkpatch.

Signed-off-by: Dwaipayan Ray <[email protected]>
---
scripts/checkpatch.pl | 6 ------
1 file changed, 6 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 461d4221e4a4..e29c0961b25e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4023,12 +4023,6 @@ sub process {
"CVS style keyword markers, these will _not_ be updated\n". $herecurr);
}

-# check for old HOTPLUG __dev<foo> section markings
- if ($line =~ /\b(__dev(init|exit)(data|const|))\b/) {
- WARN("HOTPLUG_SECTION",
- "Using $1 is unnecessary\n" . $herecurr);
- }
-
# Check for potential 'bare' types
my ($stat, $cond, $line_nr_next, $remain_next, $off_next,
$realline_next);
--
2.28.0


2021-07-17 16:34:05

by Lukas Bulwahn

[permalink] [raw]
Subject: Re: [PATCH] checkpatch: remove obsolete check for __dev* section markers

On Fri, Jul 16, 2021 at 8:21 PM Dwaipayan Ray <[email protected]> wrote:
>
> Commit 54b956b90360 ("Remove __dev* markings from init.h")
> completely removed the definitions of __dev* section
> markers from init.h. They can no longer pop up in the kernel
> and hence the check for those markers is unneeded now.
>

Generally, a good idea! I like this commit of removing obsolete checks
in checkpatch. Can you identify more checks in checkpatch that are
potentially obsolete and share them with us?

I assume:
If you run checkpatch on the whole latest kernel tree and you run
checkpatch on the last 50,000 commits or so, all checks that were
never triggered on those evaluations are potentially obsolete. I
assume that only a handful of checks would qualify for that criteria,
and then we could dig deeper into the history of those checks and see
if they still serve a potential purpose or can be removed.

If you need a powerful server to run such checkpatch evaluations, just
let me know.

Just on the wording of your commit message:

The first sentence reads very strange, because you are just repeating
the commit message. So, you can probably just combine the first two
sentences and make it much shorter:

Since commit ..., the check in checkpatch for __dev* markings is obsolete.

Remove this obsolete check.

Lukas


> So remove __dev* section markers check from checkpatch.
>
> Signed-off-by: Dwaipayan Ray <[email protected]>
> ---
> scripts/checkpatch.pl | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 461d4221e4a4..e29c0961b25e 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -4023,12 +4023,6 @@ sub process {
> "CVS style keyword markers, these will _not_ be updated\n". $herecurr);
> }
>
> -# check for old HOTPLUG __dev<foo> section markings
> - if ($line =~ /\b(__dev(init|exit)(data|const|))\b/) {
> - WARN("HOTPLUG_SECTION",
> - "Using $1 is unnecessary\n" . $herecurr);
> - }
> -
> # Check for potential 'bare' types
> my ($stat, $cond, $line_nr_next, $remain_next, $off_next,
> $realline_next);
> --
> 2.28.0
>

2021-07-17 16:59:27

by Dwaipayan Ray

[permalink] [raw]
Subject: Re: [PATCH] checkpatch: remove obsolete check for __dev* section markers

On Sat, Jul 17, 2021 at 10:02 PM Lukas Bulwahn <[email protected]> wrote:
>
> On Fri, Jul 16, 2021 at 8:21 PM Dwaipayan Ray <[email protected]> wrote:
> >
> > Commit 54b956b90360 ("Remove __dev* markings from init.h")
> > completely removed the definitions of __dev* section
> > markers from init.h. They can no longer pop up in the kernel
> > and hence the check for those markers is unneeded now.
> >
>
> Generally, a good idea! I like this commit of removing obsolete checks
> in checkpatch. Can you identify more checks in checkpatch that are
> potentially obsolete and share them with us?
>

I identified this one while writing the verbose documentations for that
rule. I will probably get some more in this process. I will share if I get
something else, given nobody has any objections.

> I assume:
> If you run checkpatch on the whole latest kernel tree and you run
> checkpatch on the last 50,000 commits or so, all checks that were
> never triggered on those evaluations are potentially obsolete. I
> assume that only a handful of checks would qualify for that criteria,
> and then we could dig deeper into the history of those checks and see
> if they still serve a potential purpose or can be removed.
>
> If you need a powerful server to run such checkpatch evaluations, just
> let me know.
>

I do have the checkpatch evaluation on the whole kernel that I did about
last month on a cloud server. I can use that. And I have the 50k commit
checkpatch report from v5.4. That should suffice for now. But thanks, I
will share if I require any computing power.

> Just on the wording of your commit message:
>
> The first sentence reads very strange, because you are just repeating
> the commit message. So, you can probably just combine the first two
> sentences and make it much shorter:
>
> Since commit ..., the check in checkpatch for __dev* markings is obsolete.
>
> Remove this obsolete check.
>

That sounds logical.
This particular check was added by Joe in 2013 when the process for
__dev* marker removal was in progress. If he has no objections to it,
I can send in an updated patch.

Thanks,
Dwaipayan.

2021-07-18 02:47:35

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH] checkpatch: remove obsolete check for __dev* section markers

On Sat, 2021-07-17 at 22:27 +0530, Dwaipayan Ray wrote:
> This particular check was added by Joe in 2013 when the process for
> __dev* marker removal was in progress. If he has no objections to it,
> I can send in an updated patch.

I have no objections.
Removal of the unnecessary or obsolete is good.