Re: [PATCH v3 1/1] Staging: octeon-usb: Breaks down cvmx_usb_poll_channel().
From: Greg Kroah-Hartman
Date: Sun Jul 29 2018 - 08:43:37 EST
On Sun, Jul 29, 2018 at 02:41:53PM +0300, Georgios Tsotsos wrote:
> In order to make this function more clear a new function created that controls
> channels halt on no DMA mode.
>
> Signed-off-by: Georgios Tsotsos <tsotsos@xxxxxxxxx>
> ---
> drivers/staging/octeon-usb/octeon-hcd.c | 81 +++++++++++++++++++++------------
> 1 file changed, 53 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
> index 8a7bdf1a9fe6..3f44ac260eff 100644
> --- a/drivers/staging/octeon-usb/octeon-hcd.c
> +++ b/drivers/staging/octeon-usb/octeon-hcd.c
> @@ -2593,7 +2593,51 @@ static void cvmx_usb_transfer_isoc(struct octeon_hcd *usb,
> cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
> }
> }
> +/**
Blank line between functions please.
Also, as this is not a global function, no need for kerneldoc
formatting, but you did it already, so no big deal.
> + * Handles channels halt in non DMA mode
> + * @hcchar_chena:
> + * @hcint_xfercompl:
> + * @usb: USB device
> + * @channel: Channel to poll
> + *
> + * In non DMA mode the channels don't halt themselves. We need
> + * to manually disable channels that are left running
> + *
> + * Returns: -1 on halt
> + */
> +static int cvmx_usb_dma_halt(u32 hcchar_chena, u32 hcint_xfercompl,
> + struct octeon_hcd *usb, int channel)
> +{
> + struct usb_hcd *hcd = octeon_to_hcd(usb);
> + struct device *dev = hcd->self.controller;
>
> + if (hcchar_chena) {
> + union cvmx_usbcx_hcintmskx hcintmsk;
> + union cvmx_usbcx_hccharx usbc_hcchar;
> + /* Disable all interrupts except CHHLTD */
> + hcintmsk.u32 = 0;
> + hcintmsk.s.chhltdmsk = 1;
> + cvmx_usb_write_csr32(usb,
> + CVMX_USBCX_HCINTMSKX(channel, usb->index),
> + hcintmsk.u32);
> + usbc_hcchar.s.chdis = 1;
> + cvmx_usb_write_csr32(usb,
> + CVMX_USBCX_HCCHARX(channel, usb->index),
> + usbc_hcchar.u32);
> + return -1;
Do not make up error values, return -EINVAL or something like that (what
ever the real error here is.)
> + } else if (hcint_xfercompl) {
> + /*
> + * Successful IN/OUT with transfer complete.
> + * Channel halt isn't needed.
> + */
> + } else {
> + dev_err(dev, "USB%d: Channel %d interrupt without halt\n",
> + usb->index, channel);
> + return -1;
Same here.
thanks,
greg k-h