diff options
author | Aaro Koskinen <aaro.koskinen@iki.fi> | 2016-02-26 02:14:04 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-02-25 22:38:16 -0800 |
commit | d07374987fa3ba0d04e3a425450f87828916665c (patch) | |
tree | 0b3f40ee66413ce8667104ec9bf15da9293eb5a6 /drivers/staging/octeon-usb | |
parent | dd588994fa24d45e5d4e37cc679140d2d24fd831 (diff) | |
download | linux-d07374987fa3ba0d04e3a425450f87828916665c.tar.bz2 |
staging: octeon-usb: move next pipe selection into a separate function
Move next pipe selection into a separate function to avoid deep
nesting.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/octeon-usb')
-rw-r--r-- | drivers/staging/octeon-usb/octeon-hcd.c | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 12ea995478b8..298fcaab76ad 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c @@ -1858,6 +1858,33 @@ static struct cvmx_usb_pipe *cvmx_usb_find_ready_pipe( return NULL; } +static struct cvmx_usb_pipe *cvmx_usb_next_pipe(struct octeon_hcd *usb, + int is_sof) +{ + struct cvmx_usb_pipe *pipe; + + /* Find a pipe needing service. */ + if (is_sof) { + /* + * Only process periodic pipes on SOF interrupts. This way we + * are sure that the periodic data is sent in the beginning of + * the frame. + */ + pipe = cvmx_usb_find_ready_pipe(usb, + CVMX_USB_TRANSFER_ISOCHRONOUS); + if (pipe) + return pipe; + pipe = cvmx_usb_find_ready_pipe(usb, + CVMX_USB_TRANSFER_INTERRUPT); + if (pipe) + return pipe; + } + pipe = cvmx_usb_find_ready_pipe(usb, CVMX_USB_TRANSFER_CONTROL); + if (pipe) + return pipe; + return cvmx_usb_find_ready_pipe(usb, CVMX_USB_TRANSFER_BULK); +} + /** * Called whenever a pipe might need to be scheduled to the * hardware. @@ -1897,27 +1924,7 @@ static void cvmx_usb_schedule(struct octeon_hcd *usb, int is_sof) if (unlikely(channel > 7)) break; - /* Find a pipe needing service */ - pipe = NULL; - if (is_sof) { - /* - * Only process periodic pipes on SOF interrupts. This - * way we are sure that the periodic data is sent in the - * beginning of the frame - */ - pipe = cvmx_usb_find_ready_pipe(usb, - CVMX_USB_TRANSFER_ISOCHRONOUS); - if (likely(!pipe)) - pipe = cvmx_usb_find_ready_pipe(usb, - CVMX_USB_TRANSFER_INTERRUPT); - } - if (likely(!pipe)) { - pipe = cvmx_usb_find_ready_pipe(usb, - CVMX_USB_TRANSFER_CONTROL); - if (likely(!pipe)) - pipe = cvmx_usb_find_ready_pipe(usb, - CVMX_USB_TRANSFER_BULK); - } + pipe = cvmx_usb_next_pipe(usb, is_sof); if (!pipe) break; |