[Linux-kernel-mentees] [PATCH v2] checkpatch: add fix option for NETWORKING_BLOCK_COMMENT_STYLE

Lukas Bulwahn lukas.bulwahn at gmail.com
Wed Nov 18 19:00:54 UTC 2020


On Mi., 18. Nov. 2020 at 18:40, Aditya Srivastava <yashsri421 at gmail.com>
wrote:

> Currently, checkpatch warns us for files in 'net/' and 'drivers/net',
> if we use an empty '/*' line for comment and contents of comments are
> in next line
>
> E.g., running checkpatch on commit 0d52497ac8ee ("iwlwifi: pcie: remove
> the refs / unrefs from the transport") reports this warning:
>
> WARNING: networking block comments don't use an empty /* line, use /*
> Comment...
> +               /*
> +                * If the TXQ is active, then set the timer, if not,
>
> Provide a fix by appending the current line contents to previous line
> and removing the current line
>

Patch generally looks good.

Can you check how many comments in net actually follow that style and how
many follow another style?


Lukas


> Signed-off-by: Aditya Srivastava <yashsri421 at gmail.com>
> ---
> Changes in v2: modify commit message: add information about networking
> files in commit message
>
>  scripts/checkpatch.pl | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index f61ac7456151..90e863d63097 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3629,8 +3629,14 @@ sub process {
>                     $prevrawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
>                     $rawline =~ /^\+[ \t]*\*/ &&
>                     $realline > 3) { # Do not warn about the initial
> copyright comment block after SPDX-License-Identifier
> -                       WARN("NETWORKING_BLOCK_COMMENT_STYLE",
> -                            "networking block comments don't use an empty
> /* line, use /* Comment...\n" . $hereprev);
> +                       if (WARN("NETWORKING_BLOCK_COMMENT_STYLE",
> +                                "networking block comments don't use an
> empty /* line, use /* Comment...\n" . $hereprev) &&\
> +                           $fix) {
> +                               if ($rawline =~ /^\+[ \t]*\*\s*(.*)/) {
> +                                       fix_delete_line($fixlinenr,
> $rawline);
> +                                       $fixed[$fixlinenr - 1] .= " $1";
> +                               }
> +                       }
>                 }
>
>  # Block comments use * on subsequent lines
> --
> 2.17.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/linux-kernel-mentees/attachments/20201118/33d6d696/attachment.html>


More information about the Linux-kernel-mentees mailing list