linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: add NL_SET_ERR_MSG to 80 column exceptions
@ 2020-05-01 23:11 Jacob Keller
  2020-05-01 23:42 ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Jacob Keller @ 2020-05-01 23:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jacob Keller, Jakub Kicinski, Andy Whitcroft, Joe Perches

NL_SET_ERR_MSG and NL_SET_ERR_MSG_MOD are used to report extended error
responses about failure of a netlink command. These strings often end up
going over the 80-column limit. Just like logging messages, it is
preferred to leave the message all on a single line.

Add these to the exception list so that checkpatch.pl will no longer
complain about the long lines due to use of these macros.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index eac40f0abd56..5da3b06fbeaa 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -471,7 +471,8 @@ our $logFunctions = qr{(?x:
 	WARN(?:_RATELIMIT|_ONCE|)|
 	panic|
 	MODULE_[A-Z_]+|
-	seq_vprintf|seq_printf|seq_puts
+	seq_vprintf|seq_printf|seq_puts|
+	NL_SET_ERR_MSG(?:_MOD)?
 )};
 
 our $allocFunctions = qr{(?x:
-- 
2.25.2


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

* Re: [PATCH] checkpatch: add NL_SET_ERR_MSG to 80 column exceptions
  2020-05-01 23:11 [PATCH] checkpatch: add NL_SET_ERR_MSG to 80 column exceptions Jacob Keller
@ 2020-05-01 23:42 ` Joe Perches
  2020-05-02  0:19   ` Jacob Keller
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2020-05-01 23:42 UTC (permalink / raw)
  To: Jacob Keller, linux-kernel; +Cc: Jakub Kicinski, Andy Whitcroft

On Fri, 2020-05-01 at 16:11 -0700, Jacob Keller wrote:
> NL_SET_ERR_MSG and NL_SET_ERR_MSG_MOD are used to report extended error
> responses about failure of a netlink command. These strings often end up
> going over the 80-column limit. Just like logging messages, it is
> preferred to leave the message all on a single line.
> 
> Add these to the exception list so that checkpatch.pl will no longer
> complain about the long lines due to use of these macros.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Andy Whitcroft <apw@canonical.com>
> Cc: Joe Perches <joe@perches.com>
> ---
>  scripts/checkpatch.pl | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index eac40f0abd56..5da3b06fbeaa 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -471,7 +471,8 @@ our $logFunctions = qr{(?x:
>  	WARN(?:_RATELIMIT|_ONCE|)|
>  	panic|
>  	MODULE_[A-Z_]+|
> -	seq_vprintf|seq_printf|seq_puts
> +	seq_vprintf|seq_printf|seq_puts|
> +	NL_SET_ERR_MSG(?:_MOD)?
>  )};
>  
>  our $allocFunctions = qr{(?x:

<shrug>  OK I guess.

What about GENL_SET_ERR_MSG ?

btw:

There are some uses with what appear to be unnecessary newlines.
Maybe these newlines should be removed.

drivers/net/ethernet/mscc/ocelot_tc.c:50:			NL_SET_ERR_MSG_MOD(extack,
					   "Only one policer per port is supported\n");
drivers/net/ethernet/mscc/ocelot_tc.c:61:			NL_SET_ERR_MSG_MOD(extack, "Could not add policer\n");
drivers/net/ethernet/mscc/ocelot_tc.c:74:			NL_SET_ERR_MSG_MOD(extack,
					   "Could not delete policer\n");
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:1099:			NL_SET_ERR_MSG_MOD(extack,
					   "Failed to create tc offload table\n");
net/dsa/slave.c:915:		NL_SET_ERR_MSG_MOD(extack,
				   "Policing offload not implemented\n");
net/dsa/slave.c:920:		NL_SET_ERR_MSG_MOD(extack,
				   "Only supported on ingress qdisc\n");
net/dsa/slave.c:930:			NL_SET_ERR_MSG_MOD(extack,
					   "Only one port policer allowed\n");
net/bridge/br_stp_if.c:205:		NL_SET_ERR_MSG_MOD(extack,
				   "STP can't be enabled if MRP is already enabled\n");
net/bridge/br_mrp_netlink.c:31:		NL_SET_ERR_MSG_MOD(extack, "MRP can't be enabled if STP is already enabled\n");



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

* Re: [PATCH] checkpatch: add NL_SET_ERR_MSG to 80 column exceptions
  2020-05-01 23:42 ` Joe Perches
@ 2020-05-02  0:19   ` Jacob Keller
  2020-05-02  0:30     ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Jacob Keller @ 2020-05-02  0:19 UTC (permalink / raw)
  To: Joe Perches, linux-kernel; +Cc: Jakub Kicinski, Andy Whitcroft



On 5/1/2020 4:42 PM, Joe Perches wrote:
> On Fri, 2020-05-01 at 16:11 -0700, Jacob Keller wrote:
>> NL_SET_ERR_MSG and NL_SET_ERR_MSG_MOD are used to report extended error
>> responses about failure of a netlink command. These strings often end up
>> going over the 80-column limit. Just like logging messages, it is
>> preferred to leave the message all on a single line.
>>
>> Add these to the exception list so that checkpatch.pl will no longer
>> complain about the long lines due to use of these macros.
>>
>> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
>> Cc: Jakub Kicinski <kuba@kernel.org>
>> Cc: Andy Whitcroft <apw@canonical.com>
>> Cc: Joe Perches <joe@perches.com>
>> ---
>>  scripts/checkpatch.pl | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index eac40f0abd56..5da3b06fbeaa 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -471,7 +471,8 @@ our $logFunctions = qr{(?x:
>>  	WARN(?:_RATELIMIT|_ONCE|)|
>>  	panic|
>>  	MODULE_[A-Z_]+|
>> -	seq_vprintf|seq_printf|seq_puts
>> +	seq_vprintf|seq_printf|seq_puts|
>> +	NL_SET_ERR_MSG(?:_MOD)?
>>  )};
>>  
>>  our $allocFunctions = qr{(?x:
> 
> <shrug>  OK I guess.
> 
> What about GENL_SET_ERR_MSG ?
>

This appears in far fewer locations, but it does seem reasonable to add
it to this list as well.

> btw:
> 
> There are some uses with what appear to be unnecessary newlines.
> Maybe these newlines should be removed.

Yea, there's a number of places which seem to have put a newline break
after the extack pointer.

A quick search shows that there are about 970 or so uses where we don't
put a newline, and around 220 where we do.

I suppose I can make a series that cleans all of those up along with
this patch.

Thanks,
Jake

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

* Re: [PATCH] checkpatch: add NL_SET_ERR_MSG to 80 column exceptions
  2020-05-02  0:19   ` Jacob Keller
@ 2020-05-02  0:30     ` Joe Perches
  2020-05-02  0:36       ` Keller, Jacob E
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2020-05-02  0:30 UTC (permalink / raw)
  To: Jacob Keller, linux-kernel; +Cc: Jakub Kicinski, Andy Whitcroft

On Fri, 2020-05-01 at 17:19 -0700, Jacob Keller wrote:
> 
> On 5/1/2020 4:42 PM, Joe Perches wrote:
> > On Fri, 2020-05-01 at 16:11 -0700, Jacob Keller wrote:
> > > NL_SET_ERR_MSG and NL_SET_ERR_MSG_MOD are used to report extended error
> > > responses about failure of a netlink command. These strings often end up
> > > going over the 80-column limit. Just like logging messages, it is
> > > preferred to leave the message all on a single line.
> > > 
> > > Add these to the exception list so that checkpatch.pl will no longer
> > > complain about the long lines due to use of these macros.
> > > 
> > > Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> > > Cc: Jakub Kicinski <kuba@kernel.org>
> > > Cc: Andy Whitcroft <apw@canonical.com>
> > > Cc: Joe Perches <joe@perches.com>
> > > ---
> > >  scripts/checkpatch.pl | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > index eac40f0abd56..5da3b06fbeaa 100755
> > > --- a/scripts/checkpatch.pl
> > > +++ b/scripts/checkpatch.pl
> > > @@ -471,7 +471,8 @@ our $logFunctions = qr{(?x:
> > >  	WARN(?:_RATELIMIT|_ONCE|)|
> > >  	panic|
> > >  	MODULE_[A-Z_]+|
> > > -	seq_vprintf|seq_printf|seq_puts
> > > +	seq_vprintf|seq_printf|seq_puts|
> > > +	NL_SET_ERR_MSG(?:_MOD)?
> > >  )};
> > >  
> > >  our $allocFunctions = qr{(?x:
> > 
> > <shrug>  OK I guess.
> > 
> > What about GENL_SET_ERR_MSG ?
> > 
> 
> This appears in far fewer locations, but it does seem reasonable to add
> it to this list as well.
> 
> > btw:
> > 
> > There are some uses with what appear to be unnecessary newlines.
> > Maybe these newlines should be removed.
> 
> Yea, there's a number of places which seem to have put a newline break
> after the extack pointer.
> 
> A quick search shows that there are about 970 or so uses where we don't
> put a newline, and around 220 where we do.
> 
> I suppose I can make a series that cleans all of those up along with
> this patch.

That's not what I meant.
I don't care if there are multiple source lines used.
In fact, I think it's mostly nicer with multiple lines.

The ones I specified previously use:

	NL_SET_ERR_MSG_MOD(extack, "message\n");

where all the others uses are:

	NL_SET_ERR_MSG_MOD(extack, "message");

without the \n termination of the message.



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

* RE: [PATCH] checkpatch: add NL_SET_ERR_MSG to 80 column exceptions
  2020-05-02  0:30     ` Joe Perches
@ 2020-05-02  0:36       ` Keller, Jacob E
  2020-05-02  1:04         ` Jakub Kicinski
  0 siblings, 1 reply; 6+ messages in thread
From: Keller, Jacob E @ 2020-05-02  0:36 UTC (permalink / raw)
  To: Joe Perches, linux-kernel; +Cc: Jakub Kicinski, Andy Whitcroft

> -----Original Message-----
> From: Joe Perches <joe@perches.com>
> Sent: Friday, May 01, 2020 5:30 PM
> To: Keller, Jacob E <jacob.e.keller@intel.com>; linux-kernel@vger.kernel.org
> Cc: Jakub Kicinski <kuba@kernel.org>; Andy Whitcroft <apw@canonical.com>
> Subject: Re: [PATCH] checkpatch: add NL_SET_ERR_MSG to 80 column
> exceptions
> 
> On Fri, 2020-05-01 at 17:19 -0700, Jacob Keller wrote:
> >
> > On 5/1/2020 4:42 PM, Joe Perches wrote:
> > > On Fri, 2020-05-01 at 16:11 -0700, Jacob Keller wrote:
> > > > NL_SET_ERR_MSG and NL_SET_ERR_MSG_MOD are used to report
> extended error
> > > > responses about failure of a netlink command. These strings often end up
> > > > going over the 80-column limit. Just like logging messages, it is
> > > > preferred to leave the message all on a single line.
> > > >
> > > > Add these to the exception list so that checkpatch.pl will no longer
> > > > complain about the long lines due to use of these macros.
> > > >
> > > > Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> > > > Cc: Jakub Kicinski <kuba@kernel.org>
> > > > Cc: Andy Whitcroft <apw@canonical.com>
> > > > Cc: Joe Perches <joe@perches.com>
> > > > ---
> > > >  scripts/checkpatch.pl | 3 ++-
> > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > > index eac40f0abd56..5da3b06fbeaa 100755
> > > > --- a/scripts/checkpatch.pl
> > > > +++ b/scripts/checkpatch.pl
> > > > @@ -471,7 +471,8 @@ our $logFunctions = qr{(?x:
> > > >  	WARN(?:_RATELIMIT|_ONCE|)|
> > > >  	panic|
> > > >  	MODULE_[A-Z_]+|
> > > > -	seq_vprintf|seq_printf|seq_puts
> > > > +	seq_vprintf|seq_printf|seq_puts|
> > > > +	NL_SET_ERR_MSG(?:_MOD)?
> > > >  )};
> > > >
> > > >  our $allocFunctions = qr{(?x:
> > >
> > > <shrug>  OK I guess.
> > >
> > > What about GENL_SET_ERR_MSG ?
> > >
> >
> > This appears in far fewer locations, but it does seem reasonable to add
> > it to this list as well.
> >
> > > btw:
> > >
> > > There are some uses with what appear to be unnecessary newlines.
> > > Maybe these newlines should be removed.
> >
> > Yea, there's a number of places which seem to have put a newline break
> > after the extack pointer.
> >
> > A quick search shows that there are about 970 or so uses where we don't
> > put a newline, and around 220 where we do.
> >
> > I suppose I can make a series that cleans all of those up along with
> > this patch.
> 
> That's not what I meant.
> I don't care if there are multiple source lines used.
> In fact, I think it's mostly nicer with multiple lines.

Ah. Sure. I just noticed that one was more common than the other.

> 
> The ones I specified previously use:
> 
> 	NL_SET_ERR_MSG_MOD(extack, "message\n");
> 
> where all the others uses are:
> 
> 	NL_SET_ERR_MSG_MOD(extack, "message");
> 
> without the \n termination of the message.
> 

I see. Yea, I think the trailing newline isn't needed, but I'm not sure.

Thanks,
Jake


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

* Re: [PATCH] checkpatch: add NL_SET_ERR_MSG to 80 column exceptions
  2020-05-02  0:36       ` Keller, Jacob E
@ 2020-05-02  1:04         ` Jakub Kicinski
  0 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2020-05-02  1:04 UTC (permalink / raw)
  To: Keller, Jacob E; +Cc: Joe Perches, linux-kernel, Andy Whitcroft

On Sat, 2 May 2020 00:36:48 +0000 Keller, Jacob E wrote:
> > The ones I specified previously use:
> > 
> > 	NL_SET_ERR_MSG_MOD(extack, "message\n");
> > 
> > where all the others uses are:
> > 
> > 	NL_SET_ERR_MSG_MOD(extack, "message");
> > 
> > without the \n termination of the message.
> >   
> 
> I see. Yea, I think the trailing newline isn't needed, but I'm not sure.

Yup, there should be no new line at the end of an extack message.

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

end of thread, other threads:[~2020-05-02  1:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-01 23:11 [PATCH] checkpatch: add NL_SET_ERR_MSG to 80 column exceptions Jacob Keller
2020-05-01 23:42 ` Joe Perches
2020-05-02  0:19   ` Jacob Keller
2020-05-02  0:30     ` Joe Perches
2020-05-02  0:36       ` Keller, Jacob E
2020-05-02  1:04         ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).