Skip to contentSkip to conversation

staging: octeon-usb: Fix 'should not end with '(''

PATCH In review [email protected] 4 participants 6 messages Feb 6, 2022 – Feb 7, 2022 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: octeon-usb: Fix 'should not end with '(''

From: Joel Camilo Chang Gonzalez <[email protected]>

This patch fixes the checkpatch.pl check:

CHECK: Line should not end with '('

at lines 1802, 1807 and at some function headers.

---
 drivers/staging/octeon-usb/octeon-hcd.c | 67 +++++++++++--------------
 1 file changed, 29 insertions(+), 38 deletions(-)
drivers/staging/octeon-usb/octeon-hcd.c +29 -38
index a1cd81d4a114..60e8354104e6 100644
@@ -1792,23 +1792,18 @@ static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel,
 	case CVMX_USB_TRANSFER_INTERRUPT:
 		break;
 	case CVMX_USB_TRANSFER_ISOCHRONOUS:
-		if (!cvmx_usb_pipe_needs_split(usb, pipe)) {
+		if (!cvmx_usb_pipe_needs_split(usb, pipe) &&
+		    pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
 			/*
 			 * ISO transactions require different PIDs depending on
 			 * direction and how many packets are needed
 			 */
-			if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
-				if (pipe->multi_count < 2) /* Need DATA0 */
-					USB_SET_FIELD32(
-						CVMX_USBCX_HCTSIZX(channel,
-								   usb->index),
+			if (pipe->multi_count < 2) /* Need DATA0 */
+				USB_SET_FIELD32(CVMX_USBCX_HCTSIZX(channel, usb->index),
 						cvmx_usbcx_hctsizx, pid, 0);
-				else /* Need MDATA */
-					USB_SET_FIELD32(
-						CVMX_USBCX_HCTSIZX(channel,
-								   usb->index),
+			else /* Need MDATA */
+				USB_SET_FIELD32(CVMX_USBCX_HCTSIZX(channel, usb->index),
 						cvmx_usbcx_hctsizx, pid, 3);
-			}
 		}
 		break;
 	}
@@ -2121,17 +2116,17 @@ static void cvmx_usb_complete(struct octeon_hcd *usb,
  *
  * Returns: Transaction or NULL on failure.
  */
-static struct cvmx_usb_transaction *cvmx_usb_submit_transaction(
-				struct octeon_hcd *usb,
-				struct cvmx_usb_pipe *pipe,
-				enum cvmx_usb_transfer type,
-				u64 buffer,
-				int buffer_length,
-				u64 control_header,
-				int iso_start_frame,
-				int iso_number_packets,
-				struct cvmx_usb_iso_packet *iso_packets,
-				struct urb *urb)
+static struct cvmx_usb_transaction *cvmx_usb_submit_transaction(struct octeon_hcd *usb,
+								struct cvmx_usb_pipe *pipe,
+								enum cvmx_usb_transfer type,
+								u64 buffer,
+								int buffer_length,
+								u64 control_header,
+								int iso_start_frame,
+								int iso_number_packets,
+								struct cvmx_usb_iso_packet
+									*iso_packets,
+								struct urb *urb)
 {
 	struct cvmx_usb_transaction *transaction;
 
@@ -2182,10 +2177,9 @@ static struct cvmx_usb_transaction *cvmx_usb_submit_transaction(
  *
  * Returns: A submitted transaction or NULL on failure.
  */
-static struct cvmx_usb_transaction *cvmx_usb_submit_bulk(
-						struct octeon_hcd *usb,
-						struct cvmx_usb_pipe *pipe,
-						struct urb *urb)
+static struct cvmx_usb_transaction *cvmx_usb_submit_bulk(struct octeon_hcd *usb,
+							 struct cvmx_usb_pipe *pipe,
+							 struct urb *urb)
 {
 	return cvmx_usb_submit_transaction(usb, pipe, CVMX_USB_TRANSFER_BULK,
 					   urb->transfer_dma,
@@ -2206,10 +2200,9 @@ static struct cvmx_usb_transaction *cvmx_usb_submit_bulk(
  *
  * Returns: A submitted transaction or NULL on failure.
  */
-static struct cvmx_usb_transaction *cvmx_usb_submit_interrupt(
-						struct octeon_hcd *usb,
-						struct cvmx_usb_pipe *pipe,
-						struct urb *urb)
+static struct cvmx_usb_transaction *cvmx_usb_submit_interrupt(struct octeon_hcd *usb,
+							      struct cvmx_usb_pipe *pipe,
+							      struct urb *urb)
 {
 	return cvmx_usb_submit_transaction(usb, pipe,
 					   CVMX_USB_TRANSFER_INTERRUPT,
@@ -2231,10 +2224,9 @@ static struct cvmx_usb_transaction *cvmx_usb_submit_interrupt(
  *
  * Returns: A submitted transaction or NULL on failure.
  */
-static struct cvmx_usb_transaction *cvmx_usb_submit_control(
-						struct octeon_hcd *usb,
-						struct cvmx_usb_pipe *pipe,
-						struct urb *urb)
+static struct cvmx_usb_transaction *cvmx_usb_submit_control(struct octeon_hcd *usb,
+							    struct cvmx_usb_pipe *pipe,
+							    struct urb *urb)
 {
 	int buffer_length = urb->transfer_buffer_length;
 	u64 control_header = urb->setup_dma;
@@ -2262,10 +2254,9 @@ static struct cvmx_usb_transaction *cvmx_usb_submit_control(
  *
  * Returns: A submitted transaction or NULL on failure.
  */
-static struct cvmx_usb_transaction *cvmx_usb_submit_isochronous(
-						struct octeon_hcd *usb,
-						struct cvmx_usb_pipe *pipe,
-						struct urb *urb)
+static struct cvmx_usb_transaction *cvmx_usb_submit_isochronous(struct octeon_hcd *usb,
+								struct cvmx_usb_pipe *pipe,
+								struct urb *urb)
 {
 	struct cvmx_usb_iso_packet *packets;
 
Signature · 1 line
2.25.1
#1 lore raw

From: [email protected]

Quoted 37 lines

Sent: 06 February 2022 07:46

This patch fixes the checkpatch.pl check:

CHECK: Line should not end with '('

at lines 1802, 1807 and at some function headers.

---
 drivers/staging/octeon-usb/octeon-hcd.c | 67 +++++++++++--------------
 1 file changed, 29 insertions(+), 38 deletions(-)
drivers/staging/octeon-usb/octeon-hcd.c +4 -7
index a1cd81d4a114..60e8354104e6 100644
@@ -1792,23 +1792,18 @@ static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel,
 	case CVMX_USB_TRANSFER_INTERRUPT:
 		break;
 	case CVMX_USB_TRANSFER_ISOCHRONOUS:
-		if (!cvmx_usb_pipe_needs_split(usb, pipe)) {
+		if (!cvmx_usb_pipe_needs_split(usb, pipe) &&
+		    pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
 			/*
 			 * ISO transactions require different PIDs depending on
 			 * direction and how many packets are needed
 			 */
-			if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
-				if (pipe->multi_count < 2) /* Need DATA0 */
-					USB_SET_FIELD32(
-						CVMX_USBCX_HCTSIZX(channel,
-								   usb->index),
+			if (pipe->multi_count < 2) /* Need DATA0 */
+				USB_SET_FIELD32(CVMX_USBCX_HCTSIZX(channel, usb->index),
 						cvmx_usbcx_hctsizx, pid, 0);
-				else /* Need MDATA */

drivers/staging/octeon-usb/octeon-hcd.c static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel, · line 1809

Quoted 10 lines
drivers/staging/octeon-usb/octeon-hcd.c +2 -4
-					USB_SET_FIELD32(
-						CVMX_USBCX_HCTSIZX(channel,
-								   usb->index),
+			else /* Need MDATA */
+				USB_SET_FIELD32(CVMX_USBCX_HCTSIZX(channel, usb->index),
 						cvmx_usbcx_hctsizx, pid, 3);
-			}
 		}
 		break;
 	}

What has that hunk got to do with the patch description?

Quoted 16 lines
drivers/staging/octeon-usb/octeon-hcd.c +1 -11
@@ -2121,17 +2116,17 @@ static void cvmx_usb_complete(struct octeon_hcd *usb,
  *
  * Returns: Transaction or NULL on failure.
  */
-static struct cvmx_usb_transaction *cvmx_usb_submit_transaction(
-				struct octeon_hcd *usb,
-				struct cvmx_usb_pipe *pipe,
-				enum cvmx_usb_transfer type,
-				u64 buffer,
-				int buffer_length,
-				u64 control_header,
-				int iso_start_frame,
-				int iso_number_packets,
-				struct cvmx_usb_iso_packet *iso_packets,
-				struct urb *urb)
+static struct cvmx_usb_transaction *cvmx_usb_submit_transaction(struct octeon_hcd *usb,

drivers/staging/octeon-usb/octeon-hcd.c static void cvmx_usb_complete(struct octeon_hcd *usb, · line 2129

Quoted 10 lines
drivers/staging/octeon-usb/octeon-hcd.c +10 -0
+								struct cvmx_usb_pipe *pipe,
+								enum cvmx_usb_transfer type,
+								u64 buffer,
+								int buffer_length,
+								u64 control_header,
+								int iso_start_frame,
+								int iso_number_packets,
+								struct cvmx_usb_iso_packet
+									*iso_packets,
+								struct urb *urb)

Those lines are now far longer than is 'nice'.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)

#2 lore raw
Quoted 6 lines · David Laight

From: [email protected]

Quoted 5 lines

Sent: 06 February 2022 07:46

This patch fixes the checkpatch.pl check:

CHECK: Line should not end with '('

[]

Quoted 1 line

drivers/staging/octeon-usb/octeon-hcd.c

Quoted 1 line
drivers/staging/octeon-usb/octeon-hcd.c +0 -0

[]

Quoted 24 lines
Quoted 24 lines
drivers/staging/octeon-usb/octeon-hcd.c +5 -10
@@ -1792,23 +1792,18 @@ static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel,
 	case CVMX_USB_TRANSFER_INTERRUPT:
 		break;
 	case CVMX_USB_TRANSFER_ISOCHRONOUS:
-		if (!cvmx_usb_pipe_needs_split(usb, pipe)) {
+		if (!cvmx_usb_pipe_needs_split(usb, pipe) &&
+		    pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
 			/*
 			 * ISO transactions require different PIDs depending on
 			 * direction and how many packets are needed
 			 */
-			if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
-				if (pipe->multi_count < 2) /* Need DATA0 */
-					USB_SET_FIELD32(
-						CVMX_USBCX_HCTSIZX(channel,
-								   usb->index),
+			if (pipe->multi_count < 2) /* Need DATA0 */
+				USB_SET_FIELD32(CVMX_USBCX_HCTSIZX(channel, usb->index),
 						cvmx_usbcx_hctsizx, pid, 0);
-				else /* Need MDATA */
-					USB_SET_FIELD32(
-						CVMX_USBCX_HCTSIZX(channel,
-								   usb->index),
+			else /* Need MDATA */
Quoted 8 lines

drivers/staging/octeon-usb/octeon-hcd.c static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel, · line 1809

Quoted 6 lines
drivers/staging/octeon-usb/octeon-hcd.c +1 -1
+				USB_SET_FIELD32(CVMX_USBCX_HCTSIZX(channel, usb->index),
 						cvmx_usbcx_hctsizx, pid, 3);
-			}
 		}
 		break;
 	}

What has that hunk got to do with the patch description?

Nothing and this should be revisited or explained much more as it seems to change the logic.

Quoted 20 lines
Quoted 20 lines
drivers/staging/octeon-usb/octeon-hcd.c +5 -11
@@ -2121,17 +2116,17 @@ static void cvmx_usb_complete(struct octeon_hcd *usb,
  *
  * Returns: Transaction or NULL on failure.
  */
-static struct cvmx_usb_transaction *cvmx_usb_submit_transaction(
-				struct octeon_hcd *usb,
-				struct cvmx_usb_pipe *pipe,
-				enum cvmx_usb_transfer type,
-				u64 buffer,
-				int buffer_length,
-				u64 control_header,
-				int iso_start_frame,
-				int iso_number_packets,
-				struct cvmx_usb_iso_packet *iso_packets,
-				struct urb *urb)
+static struct cvmx_usb_transaction *cvmx_usb_submit_transaction(struct octeon_hcd *usb,
+								struct cvmx_usb_pipe *pipe,
+								enum cvmx_usb_transfer type,
+								u64 buffer,
+								int buffer_length,
Quoted 8 lines

drivers/staging/octeon-usb/octeon-hcd.c static void cvmx_usb_complete(struct octeon_hcd *usb, · line 2129

Quoted 6 lines
drivers/staging/octeon-usb/octeon-hcd.c +6 -0
+								u64 control_header,
+								int iso_start_frame,
+								int iso_number_packets,
+								struct cvmx_usb_iso_packet
+									*iso_packets,
+								struct urb *urb)

Those lines are now far longer than is 'nice'.

True.

This _might_ be better with the return type on a separate line

Something like:

static struct cvmx_usb_transaction * cvmx_usb_submit_transaction(struct octeon_hcd *usb, struct cvmx_usb_pipe *pipe,
enum cvmx_usb_transfer type,
u64 buffer, int buffer_length,
u64 control_header, int iso_start_frame, int iso_number_packets,
struct cvmx_usb_iso_packet *iso_packets, struct urb *urb)

#3 lore raw
Quoted 3 lines · Joe Perches
Quoted 2 lines · David Laight

From: [email protected]

Quoted 1 line

Sent: 06 February 2022 07:46

[]

Quoted 4 lines

This _might_ be better with the return type on a separate line

Something like:

Quoted 8 lines

static struct cvmx_usb_transaction * cvmx_usb_submit_transaction(struct octeon_hcd *usb, struct cvmx_usb_pipe *pipe,
enum cvmx_usb_transfer type,
u64 buffer, int buffer_length,
u64 control_header, int iso_start_frame, int iso_number_packets,
struct cvmx_usb_iso_packet *iso_packets, struct urb *urb)

As this is a static function only used by this compilation unit, it's maybe even better removing the unnecessary cvmx_usb_ prefix too.

Maybe a bunch of unnecessary prefix removals...

author
#4 lore raw
In reply to Joe Perches

The hunk has two lines that end with '('. The hunk was rewritten but I believe the logic remains the same.

I agree they are longer than is 'nice', but they are still under 100 chars.

Maybe I should submit 2 patches instead of one?

Quoted 92 lines · Joe Perches
Quoted 6 lines · David Laight

From: [email protected]

Quoted 5 lines

Sent: 06 February 2022 07:46

This patch fixes the checkpatch.pl check:

CHECK: Line should not end with '('

[]

Quoted 1 line

drivers/staging/octeon-usb/octeon-hcd.c

Quoted 1 line
drivers/staging/octeon-usb/octeon-hcd.c +0 -0

[]

Quoted 24 lines
Quoted 24 lines
drivers/staging/octeon-usb/octeon-hcd.c +5 -10
@@ -1792,23 +1792,18 @@ static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel,
    case CVMX_USB_TRANSFER_INTERRUPT:
            break;
    case CVMX_USB_TRANSFER_ISOCHRONOUS:
-           if (!cvmx_usb_pipe_needs_split(usb, pipe)) {
+           if (!cvmx_usb_pipe_needs_split(usb, pipe) &&
+               pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
                    /*
                     * ISO transactions require different PIDs depending on
                     * direction and how many packets are needed
                     */
-                   if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
-                           if (pipe->multi_count < 2) /* Need DATA0 */
-                                   USB_SET_FIELD32(
-                                           CVMX_USBCX_HCTSIZX(channel,
-                                                              usb->index),
+                   if (pipe->multi_count < 2) /* Need DATA0 */
+                           USB_SET_FIELD32(CVMX_USBCX_HCTSIZX(channel, usb->index),
                                            cvmx_usbcx_hctsizx, pid, 0);
-                           else /* Need MDATA */
-                                   USB_SET_FIELD32(
-                                           CVMX_USBCX_HCTSIZX(channel,
-                                                              usb->index),
+                   else /* Need MDATA */
Quoted 8 lines

drivers/staging/octeon-usb/octeon-hcd.c static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel, · line 1809

Quoted 6 lines
drivers/staging/octeon-usb/octeon-hcd.c +1 -1
+                           USB_SET_FIELD32(CVMX_USBCX_HCTSIZX(channel, usb->index),
                                            cvmx_usbcx_hctsizx, pid, 3);
-                   }
            }
            break;
    }

What has that hunk got to do with the patch description?

Nothing and this should be revisited or explained much more as it seems to change the logic.

Quoted 20 lines
Quoted 20 lines
drivers/staging/octeon-usb/octeon-hcd.c +5 -11
@@ -2121,17 +2116,17 @@ static void cvmx_usb_complete(struct octeon_hcd *usb,
  *
  * Returns: Transaction or NULL on failure.
  */
-static struct cvmx_usb_transaction *cvmx_usb_submit_transaction(
-                           struct octeon_hcd *usb,
-                           struct cvmx_usb_pipe *pipe,
-                           enum cvmx_usb_transfer type,
-                           u64 buffer,
-                           int buffer_length,
-                           u64 control_header,
-                           int iso_start_frame,
-                           int iso_number_packets,
-                           struct cvmx_usb_iso_packet *iso_packets,
-                           struct urb *urb)
+static struct cvmx_usb_transaction *cvmx_usb_submit_transaction(struct octeon_hcd *usb,
+                                                           struct cvmx_usb_pipe *pipe,
+                                                           enum cvmx_usb_transfer type,
+                                                           u64 buffer,
+                                                           int buffer_length,
Quoted 8 lines

drivers/staging/octeon-usb/octeon-hcd.c static void cvmx_usb_complete(struct octeon_hcd *usb, · line 2129

Quoted 6 lines
drivers/staging/octeon-usb/octeon-hcd.c +6 -0
+                                                           u64 control_header,
+                                                           int iso_start_frame,
+                                                           int iso_number_packets,
+                                                           struct cvmx_usb_iso_packet
+                                                                   *iso_packets,
+                                                           struct urb *urb)

Those lines are now far longer than is 'nice'.

True.

This _might_ be better with the return type on a separate line

Something like:

static struct cvmx_usb_transaction * cvmx_usb_submit_transaction(struct octeon_hcd *usb, struct cvmx_usb_pipe *pipe,
enum cvmx_usb_transfer type,
u64 buffer, int buffer_length,
u64 control_header, int iso_start_frame, int iso_number_packets,
struct cvmx_usb_iso_packet *iso_packets, struct urb *urb)

#5 lore raw
Quoted 4 lines · Joel Chang

The hunk has two lines that end with '('. The hunk was rewritten but I believe the logic remains the same.

I agree they are longer than is 'nice', but they are still under 100 chars.

Just ignore checkpatch when it tempts you to make the code worse.

regards,
dan carpenter