Re: [PATCH] Staging: gasket: apex_driver: fixed a line over 80 characters coding style issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dOn Sun, 2019-10-20 at 20:50 +0300, Samuil Ivanov wrote:
> Fixed four lines of code that were over 80 characters long.

Some of the 80 column messages that checkpatch emits should
be ignored.  These are some of them because each of these
lines is a single very long name (48 chars!) identifier.

Perhaps checkpatch should not warn on these

> diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c
[]
> @@ -263,8 +263,8 @@ static int apex_enter_reset(struct gasket_dev *gasket_dev)
>  	 *    - Enable GCB idle
>  	 */
>  	gasket_read_modify_write_64(gasket_dev, APEX_BAR_INDEX,
> -				    APEX_BAR2_REG_IDLEGENERATOR_IDLEGEN_IDLEREGISTER,
> -				    0x0, 1, 32);
> +			APEX_BAR2_REG_IDLEGENERATOR_IDLEGEN_IDLEREGISTER,
> +			0x0, 1, 32);

Maybe add a checkpatch test for this and allow ignoring
single identifier lines using LONG_LINE_IDENT

---

o Add a couple missing semicolons too.

 scripts/checkpatch.pl | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a85d719df1f4..cdce58be4f66 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3140,13 +3140,14 @@ sub process {
 #
 # There are a few types of lines that may extend beyond $max_line_length:
 #	logging functions like pr_info that end in a string
-#	lines with a single string
+#	lines with a single string or identifier
 #	#defines that are a single string
 #	lines with an RFC3986 like URL
 #
-# There are 3 different line length message types:
+# There are 4 different line length message types:
 # LONG_LINE_COMMENT	a comment starts before but extends beyond $max_line_length
 # LONG_LINE_STRING	a string starts before but extends beyond $max_line_length
+# LONG_LINE_IDENT	a single identifier starts before but extends beyond $max_line_length
 # LONG_LINE		all other lines longer than $max_line_length
 #
 # if LONG_LINE is ignored, the other 2 types are also ignored
@@ -3183,12 +3184,16 @@ sub process {
 			# a comment starts before $max_line_length
 			} elsif ($line =~ /($;[\s$;]*)$/ &&
 				 length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) {
-				$msg_type = "LONG_LINE_COMMENT"
+				$msg_type = "LONG_LINE_COMMENT";
 
 			# a quoted string starts before $max_line_length
 			} elsif ($sline =~ /\s*($String(?:\s*(?:\\|,\s*|\)\s*;\s*))?)$/ &&
 				 length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) {
-				$msg_type = "LONG_LINE_STRING"
+				$msg_type = "LONG_LINE_STRING";
+			# a single identifier starts before $max_line_length
+			} elsif ($sline =~ /^.\s*($Ident(?:\\|,\s*|\)\s*;\s*))?$/ &&
+				 length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) {
+				$msg_type = "LONG_LINE_IDENT";
 			}
 
 			if ($msg_type ne "" &&


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux