diff mbox series

[v2] checkpatch: add *_NOTIFIER_HEAD as var definition

Message ID 20190819122917.11896-1-gilad@benyossef.com
State New
Headers show
Series [v2] checkpatch: add *_NOTIFIER_HEAD as var definition | expand

Commit Message

Gilad Ben-Yossef Aug. 19, 2019, 12:29 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>

Cc: John Hubbard <jhubbard@nvidia.com>
---

Changes from v1:
- Fixed misposition of braces.
- Tested on 1k last commits from Linux tree.

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

-- 
2.23.0

Comments

John Hubbard Aug. 19, 2019, 6:28 p.m. UTC | #1
On 8/19/19 5:29 AM, 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

> 

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

> Cc: John Hubbard <jhubbard@nvidia.com>

> ---

> 

> Changes from v1:

> - Fixed misposition of braces.

> - Tested on 1k last commits from Linux tree.


Hi Gilad,

I re-ran this updated patch, on my local patches that were showing the problem,
and it is All Better Now. :)  So you can add:

     Tested-by: John Hubbard <jhubbard@nvidia.com>


thanks,
-- 
John Hubbard
NVIDIA

> 

>   scripts/checkpatch.pl | 1 +

>   1 file changed, 1 insertion(+)

> 

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

> index 93a7edfe0f05..8bc0e753a329 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) {

>
diff mbox series

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 93a7edfe0f05..8bc0e753a329 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) {