scripts: checkpatch: allow "case" macros
authorStanislaw Gruszka <stf_xl@wp.pl>
Thu, 27 Oct 2022 13:43:34 +0000 (15:43 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 18 Nov 2022 21:55:08 +0000 (13:55 -0800)
Do not report errors like below:

./scripts/checkpatch.pl -f drivers/net/wireless/ath/ath10k/wmi.h

ERROR: Macros with complex values should be enclosed in parentheses
+#define C2S(x) case x: return #x

since many "case ..." macros are already used by some in-kernel drivers.

Link: https://lkml.kernel.org/r/20221027134334.164301-1-stf_xl@wp.pl
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Acked-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
scripts/checkpatch.pl

index bd1b9d7a1647e99753219a6937896769d9e52ce8..29517897baa13ffa3bb6a31fb093466a0ddf9f51 100755 (executable)
@@ -5918,6 +5918,7 @@ sub process {
                            $dstat !~ /$exceptions/ &&
                            $dstat !~ /^\.$Ident\s*=/ &&                                # .foo =
                            $dstat !~ /^(?:\#\s*$Ident|\#\s*$Constant)\s*$/ &&          # stringification #foo
+                           $dstat !~ /^case\b/ &&                                      # case ...
                            $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ &&       # do {...} while (...); // do {...} while (...)
                            $dstat !~ /^while\s*$Constant\s*$Constant\s*$/ &&           # while (...) {...}
                            $dstat !~ /^for\s*$Constant$/ &&                            # for (...)