diff mbox series

checkpatch: add *_NOTIFIER_HEAD as var definition

Message ID 20190702123037.28174-1-gilad@benyossef.com
State Superseded
Headers show
Series checkpatch: add *_NOTIFIER_HEAD as var definition | expand

Commit Message

Gilad Ben-Yossef July 2, 2019, 12:30 p.m. UTC
Add *_NOTIFIER_HEAD as variable definition to avoid code like this:

ATOMIC_NOTIFIER_HEAD(foo);
EXPORT_SYMBOL_GPL(foo);

From triggering the the following warning:
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>

---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)

-- 
2.21.0

Comments

Joe Perches July 2, 2019, 1:11 p.m. UTC | #1
On Tue, 2019-07-02 at 15:30 +0300, Gilad Ben-Yossef wrote:
> Add *_NOTIFIER_HEAD as variable definition to avoid code like this:

> 

> ATOMIC_NOTIFIER_HEAD(foo);

> EXPORT_SYMBOL_GPL(foo);

> 

> From triggering the the following warning:

> WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable

[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl

[]
> @@ -3864,6 +3864,7 @@ sub process {

>  				^.DEFINE_$Ident\(\Q$name\E\)|

>  				^.DECLARE_$Ident\(\Q$name\E\)|

>  				^.LIST_HEAD\(\Q$name\E\)|

> +				^.$Ident._NOTIFIER_HEAD\(\Q$name\E\)|


I think you want "${Ident}_NOTIFIER_HEAD\(\Q$name\E\)

>  				^.(?:$Storage\s+)?$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(|

>  				\b\Q$name\E(?:\s+$Attribute)*\s*(?:;|=|\[|\()

>  			    )/x) {
diff mbox series

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 342c7c781ba5..2377707f4441 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3864,6 +3864,7 @@  sub process {
 				^.DEFINE_$Ident\(\Q$name\E\)|
 				^.DECLARE_$Ident\(\Q$name\E\)|
 				^.LIST_HEAD\(\Q$name\E\)|
+				^.$Ident._NOTIFIER_HEAD\(\Q$name\E\)|
 				^.(?:$Storage\s+)?$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(|
 				\b\Q$name\E(?:\s+$Attribute)*\s*(?:;|=|\[|\()
 			    )/x) {