All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] checkpatch: add *_NOTIFIER_HEAD as var definition
@ 2019-08-19 12:29 Gilad Ben-Yossef
  2019-08-19 18:28 ` John Hubbard
  0 siblings, 1 reply; 4+ messages in thread
From: Gilad Ben-Yossef @ 2019-08-19 12:29 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches; +Cc: Ofir Drang, John Hubbard, linux-kernel

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(+)

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) {
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] checkpatch: add *_NOTIFIER_HEAD as var definition
  2019-08-19 12:29 [PATCH v2] checkpatch: add *_NOTIFIER_HEAD as var definition Gilad Ben-Yossef
@ 2019-08-19 18:28 ` John Hubbard
  0 siblings, 0 replies; 4+ messages in thread
From: John Hubbard @ 2019-08-19 18:28 UTC (permalink / raw)
  To: Gilad Ben-Yossef, Andy Whitcroft, Joe Perches; +Cc: Ofir Drang, linux-kernel

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) {
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] checkpatch: add *_NOTIFIER_HEAD as var definition
  2019-07-04 10:44 Gilad Ben-Yossef
@ 2019-07-04 18:55 ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2019-07-04 18:55 UTC (permalink / raw)
  To: Gilad Ben-Yossef, Andy Whitcroft, Andrew Morton; +Cc: Ofir Drang, linux-kernel

On Thu, 2019-07-04 at 13:44 +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
> 
> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
> ---
> 
> Changes from v1:
> - Better RegExp as suggested by Joe Perches.

Seems fine thanks.

>  scripts/checkpatch.pl | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 342c7c781ba5..9cadda7024ae 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) {


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] checkpatch: add *_NOTIFIER_HEAD as var definition
@ 2019-07-04 10:44 Gilad Ben-Yossef
  2019-07-04 18:55 ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Gilad Ben-Yossef @ 2019-07-04 10:44 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches; +Cc: Ofir Drang, linux-kernel

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>
---

Changes from v1:
- Better RegExp as suggested by Joe Perches.

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

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 342c7c781ba5..9cadda7024ae 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) {
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-19 18:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19 12:29 [PATCH v2] checkpatch: add *_NOTIFIER_HEAD as var definition Gilad Ben-Yossef
2019-08-19 18:28 ` John Hubbard
  -- strict thread matches above, loose matches on Subject: below --
2019-07-04 10:44 Gilad Ben-Yossef
2019-07-04 18:55 ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.