Skip to contentSkip to conversation

checkpatch: add NL_SET_ERR_MSG to 80 column exceptions

PATCH Superseded Jacob Keller 3 participants 6 messages May 1, 2020 – May 2, 2020 Checkpatch

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: add NL_SET_ERR_MSG to 80 column exceptions

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.

Cc Jakub Kicinski <[email protected]>
Cc Andy Whitcroft <[email protected]>
Cc Joe Perches <[email protected]>
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/checkpatch.pl +2 -1
index eac40f0abd56..5da3b06fbeaa 100755
@@ -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:
Signature · 1 line
2.25.2
maintainer
#1 lore raw
Quoted 21 lines · Jacob Keller

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.

Cc Jakub Kicinski <[email protected]>
Cc Andy Whitcroft <[email protected]>
Cc Joe Perches <[email protected]>
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/checkpatch.pl +0 -0
index eac40f0abd56..5da3b06fbeaa 100755

scripts/checkpatch.pl our $logFunctions = qr{(?x: · line 478

Quoted 9 lines
scripts/checkpatch.pl +2 -1
@@ -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");

#2 lore raw
Quoted 30 lines · Joe Perches
Quoted 29 lines · Jacob Keller

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.

Cc Jakub Kicinski <[email protected]>
Cc Andy Whitcroft <[email protected]>
Cc Joe Perches <[email protected]>
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/checkpatch.pl +2 -1
index eac40f0abd56..5da3b06fbeaa 100755
@@ -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)?
 )};
 
Quoted 6 lines

scripts/checkpatch.pl our $logFunctions = qr{(?x: · line 478

Quoted 1 line
scripts/checkpatch.pl +0 -0
 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.

Quoted 4 lines

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

maintainer
#3 lore raw
Quoted 47 lines · Jacob Keller
Quoted 30 lines · Joe Perches
Quoted 29 lines · Jacob Keller

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.

Cc Jakub Kicinski <[email protected]>
Cc Andy Whitcroft <[email protected]>
Cc Joe Perches <[email protected]>
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/checkpatch.pl +2 -1
index eac40f0abd56..5da3b06fbeaa 100755
@@ -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)?
 )};
 
Quoted 6 lines

scripts/checkpatch.pl our $logFunctions = qr{(?x: · line 478

Quoted 1 line
scripts/checkpatch.pl +0 -0
 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.

Quoted 4 lines

btw:

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

Quoted 8 lines

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.

#4 lore raw
Quoted 63 lines

-----Original Message-----
From: Joe Perches <[email protected]>
Sent: Friday, May 01, 2020 5:30 PM
To: Keller, Jacob E <[email protected]>; [email protected]
Cc: Jakub Kicinski <[email protected]>; Andy Whitcroft <[email protected]>
Subject: Re: [PATCH] checkpatch: add NL_SET_ERR_MSG to 80 column exceptions

Quoted 4 lines · Jacob Keller
Quoted 2 lines · Joe Perches
Quoted 1 line · Jacob Keller

NL_SET_ERR_MSG and NL_SET_ERR_MSG_MOD are used to report

extended error

Quoted 49 lines
Quoted 28 lines
Quoted 28 lines

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.

Cc Jakub Kicinski <[email protected]>
Cc Andy Whitcroft <[email protected]>
Cc Joe Perches <[email protected]>
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/checkpatch.pl +2 -1
index eac40f0abd56..5da3b06fbeaa 100755
@@ -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)?
 )};
 
Quoted 6 lines

scripts/checkpatch.pl our $logFunctions = qr{(?x: · line 478

Quoted 1 line
scripts/checkpatch.pl +0 -0
 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.

Quoted 4 lines

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.

Quoted 6 lines
Quoted 2 lines

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.

Quoted 11 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.

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

Thanks,
Jake

#5 lore raw
Quoted 4 lines · Jacob E
Quoted 4 lines

The ones I specified previously use:

	NL_SET_ERR_MSG_MOD(extack, "message\n");
Quoted 8 lines
Quoted 6 lines

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.