From c4766f9572180e1a07d3ef3bb499a2bc48d1cee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C3=85berg?= Date: Wed, 17 Apr 2024 13:01:25 +0200 Subject: [PATCH] scripts/checkpatch: Improve blank line check after declarations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds volatile type qualifier to the struct declaration matching when looking for blank line after declarations. Before this commit, this structure was not accepted by chheckpatch: struct cfg { struct gpio_driver_config common; volatile struct grgpio_regs *regs; int interrupt; }; checkpatch.pl generated the following warning: -:158: WARNING:LINE_SPACING: Missing a blank line after declarations #158: FILE: drivers/gpio/gpio_grgpio2.c:27: + struct gpio_driver_config common; + volatile struct grgpio_regs *regs; With this commit, the warning is no longer generated. Signed-off-by: Martin Ã…berg --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 833b11886fa..27fbd880ef6 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3544,7 +3544,7 @@ sub process { # known declaration macros $sline =~ /^\+\s+$declaration_macros/ || # start of struct or union or enum - $sline =~ /^\+\s+(?:static\s+)?(?:const\s+)?(?:union|struct|enum|typedef)\b/ || + $sline =~ /^\+\s+(?:volatile\s+)?(?:static\s+)?(?:const\s+)?(?:union|struct|enum|typedef)\b/ || # start or end of block or continuation of declaration $sline =~ /^\+\s+(?:$|[\{\}\.\#\"\?\:\(\[])/ || # bitfield continuation