Skip to contentSkip to conversation

usb: serial: Fix Coding Style Errors

PATCH Superseded Husni Faiz 3 participants 6 messages Feb 12, 2022 – Feb 21, 2022

Subsystems (2)
lore
Share & tools
lore

Husni Faiz

author
#0 lore raw

PATCH 1/1 usb: serial: Fix Coding Style Errors

Added a space before the ternary operator.
Removed the space after the function argument.

---
 drivers/usb/serial/cp210x.c      | 2 +-
 drivers/usb/serial/iuu_phoenix.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/serial/cp210x.c +1 -1
index 8a60c0d56863..1fcdfb7d118c 100644
@@ -1403,7 +1403,7 @@ static int cp210x_tiocmget(struct tty_struct *tty)
 		|((control & CONTROL_RTS) ? TIOCM_RTS : 0)
 		|((control & CONTROL_CTS) ? TIOCM_CTS : 0)
 		|((control & CONTROL_DSR) ? TIOCM_DSR : 0)
-		|((control & CONTROL_RING)? TIOCM_RI  : 0)
+		|((control & CONTROL_RING) ? TIOCM_RI  : 0)
 		|((control & CONTROL_DCD) ? TIOCM_CD  : 0);
 
 	dev_dbg(&port->dev, "%s - control = 0x%02x\n", __func__, control);
drivers/usb/serial/iuu_phoenix.c +2 -2
index 0be3b5e1eaf3..2f7784572c4d 100644
@@ -360,7 +360,7 @@ static void iuu_led_activity_on(struct urb *urb)
 	usb_fill_bulk_urb(port->write_urb, port->serial->dev,
 			  usb_sndbulkpipe(port->serial->dev,
 					  port->bulk_out_endpointAddress),
-			  port->write_urb->transfer_buffer, 8 ,
+			  port->write_urb->transfer_buffer, 8,
 			  iuu_rxcmd, port);
 	usb_submit_urb(port->write_urb, GFP_ATOMIC);
 }
@@ -380,7 +380,7 @@ static void iuu_led_activity_off(struct urb *urb)
 	usb_fill_bulk_urb(port->write_urb, port->serial->dev,
 			  usb_sndbulkpipe(port->serial->dev,
 					  port->bulk_out_endpointAddress),
-			  port->write_urb->transfer_buffer, 8 ,
+			  port->write_urb->transfer_buffer, 8,
 			  iuu_rxcmd, port);
 	usb_submit_urb(port->write_urb, GFP_ATOMIC);
 }
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 2 lines · Husni Faiz

Added a space before the ternary operator.
Removed the space after the function argument.

That should be 2 different patches, right?

Please learn stuff like this on the drivers/staging/ part of the kernel first, as patches for this are welcome there and that is a great place to start.

good luck!

greg k-h

author
#2 lore raw

PATCH v2 1/2 usb: serial: Fix Space Prohibited Coding Style Errors

In reply to Husni Faiz

This patch fixes "space prohibited before that ','" checkpatch error. Removed the space after the function argument value "8".

---
V1->V2 : Separated the style changes into multiple patches.

 drivers/usb/serial/iuu_phoenix.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/serial/iuu_phoenix.c +2 -2
index 0be3b5e1eaf3..2f7784572c4d 100644
@@ -360,7 +360,7 @@ static void iuu_led_activity_on(struct urb *urb)
 	usb_fill_bulk_urb(port->write_urb, port->serial->dev,
 			  usb_sndbulkpipe(port->serial->dev,
 					  port->bulk_out_endpointAddress),
-			  port->write_urb->transfer_buffer, 8 ,
+			  port->write_urb->transfer_buffer, 8,
 			  iuu_rxcmd, port);
 	usb_submit_urb(port->write_urb, GFP_ATOMIC);
 }
@@ -380,7 +380,7 @@ static void iuu_led_activity_off(struct urb *urb)
 	usb_fill_bulk_urb(port->write_urb, port->serial->dev,
 			  usb_sndbulkpipe(port->serial->dev,
 					  port->bulk_out_endpointAddress),
-			  port->write_urb->transfer_buffer, 8 ,
+			  port->write_urb->transfer_buffer, 8,
 			  iuu_rxcmd, port);
 	usb_submit_urb(port->write_urb, GFP_ATOMIC);
 }
Signature · 1 line
2.25.1
maintainer
#3 lore raw

Re: [PATCH v2 1/2] usb: serial: Fix Space Prohibited Coding Style Errors

Quoted 6 lines · Husni Faiz

This patch fixes "space prohibited before that ','" checkpatch error. Removed the space after the function argument value "8".

---
V1->V2 : Separated the style changes into multiple patches.

As Greg mentioned, please work in drivers/staging if you want to submit these kind of patches.

checkpatch.pl is great for checking your own patches before submission, but it shouldn't be run on code that's already in the tree, and where fixing a white space issue like this one has essentially no value.

And as your staging/greybus submission showed, using the output of tools like checkpatch.pl even risks breaking things if you take it too literally and don't use your own judgement.

Quoted 17 lines
 drivers/usb/serial/iuu_phoenix.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/serial/iuu_phoenix.c +1 -1
index 0be3b5e1eaf3..2f7784572c4d 100644
@@ -360,7 +360,7 @@ static void iuu_led_activity_on(struct urb *urb)
 	usb_fill_bulk_urb(port->write_urb, port->serial->dev,
 			  usb_sndbulkpipe(port->serial->dev,
 					  port->bulk_out_endpointAddress),
-			  port->write_urb->transfer_buffer, 8 ,
+			  port->write_urb->transfer_buffer, 8,
 			  iuu_rxcmd, port);
 	usb_submit_urb(port->write_urb, GFP_ATOMIC);
 }

drivers/usb/serial/iuu_phoenix.c static void iuu_led_activity_off(struct urb *urb) · line 386

Quoted 8 lines
drivers/usb/serial/iuu_phoenix.c +1 -1
@@ -380,7 +380,7 @@ static void iuu_led_activity_off(struct urb *urb)
 	usb_fill_bulk_urb(port->write_urb, port->serial->dev,
 			  usb_sndbulkpipe(port->serial->dev,
 					  port->bulk_out_endpointAddress),
-			  port->write_urb->transfer_buffer, 8 ,
+			  port->write_urb->transfer_buffer, 8,
 			  iuu_rxcmd, port);
 	usb_submit_urb(port->write_urb, GFP_ATOMIC);
 }

Johan

author
#4 lore raw

PATCH v2 2/2 usb: serial: Fix Coding Style Error Around Ternary Operator

In reply to Husni Faiz

This patch fixes "spaces required around that '?'" checkpatch error Added a space before the "?" ternary operator.

---
V1->V2 : Separated the style changes into multiple patches.

 drivers/usb/serial/cp210x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/cp210x.c +1 -1
index 8a60c0d56863..1fcdfb7d118c 100644
@@ -1403,7 +1403,7 @@ static int cp210x_tiocmget(struct tty_struct *tty)
 		|((control & CONTROL_RTS) ? TIOCM_RTS : 0)
 		|((control & CONTROL_CTS) ? TIOCM_CTS : 0)
 		|((control & CONTROL_DSR) ? TIOCM_DSR : 0)
-		|((control & CONTROL_RING)? TIOCM_RI  : 0)
+		|((control & CONTROL_RING) ? TIOCM_RI  : 0)
 		|((control & CONTROL_DCD) ? TIOCM_CD  : 0);
 
 	dev_dbg(&port->dev, "%s - control = 0x%02x\n", __func__, control);
Signature · 1 line
2.25.1
maintainer
#5 lore raw

Re: [PATCH v2 2/2] usb: serial: Fix Coding Style Error Around Ternary Operator

Quoted 15 lines · Husni Faiz

This patch fixes "spaces required around that '?'" checkpatch error Added a space before the "?" ternary operator.

---
V1->V2 : Separated the style changes into multiple patches.

 drivers/usb/serial/cp210x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/cp210x.c +0 -0
index 8a60c0d56863..1fcdfb7d118c 100644

drivers/usb/serial/cp210x.c static int cp210x_tiocmget(struct tty_struct *tty) · line 1407

Quoted 6 lines
drivers/usb/serial/cp210x.c +1 -1
@@ -1403,7 +1403,7 @@ static int cp210x_tiocmget(struct tty_struct *tty)
 		|((control & CONTROL_RTS) ? TIOCM_RTS : 0)
 		|((control & CONTROL_CTS) ? TIOCM_CTS : 0)
 		|((control & CONTROL_DSR) ? TIOCM_DSR : 0)
-		|((control & CONTROL_RING)? TIOCM_RI  : 0)
+		|((control & CONTROL_RING) ? TIOCM_RI  : 0)
 		|((control & CONTROL_DCD) ? TIOCM_CD  : 0);

I'm pretty sure the author intended the TIOCM arguments to be aligned here.

But in any case, I'm not taking checkpatch.pl clean ups unless you're also doing real changes to the code in question.

drivers/usb/serial/cp210x.c static int cp210x_tiocmget(struct tty_struct *tty) · line 1409

Quoted 1 line
drivers/usb/serial/cp210x.c +0 -0
 	dev_dbg(&port->dev, "%s - control = 0x%02x\n", __func__, control);

Johan