Re: [PATCH] staging: octeon-usb: Fix 'should not end with '(''
From: Joel Chang
Date: Sun Feb 06 2022 - 20:57:51 EST
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?
On Mon, Feb 7, 2022 at 1:17 AM Joe Perches <joe@xxxxxxxxxxx> wrote:
>
> On Sun, 2022-02-06 at 14:16 +0000, David Laight wrote:
> > From: joelcchangg@xxxxxxxxx
> > > Sent: 06 February 2022 07:46
> > >
> > > This patch fixes the checkpatch.pl check:
> > >
> > > CHECK: Line should not end with '('
> []
> > > diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
> []
> > > @@ -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;
> > > }
> >
> > 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.
>
> > > @@ -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)
> >
> > 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)
>
>