[PATCH 05/16] staging: octeon-usb: simplify if statement

Aaro Koskinen aaro.koskinen at iki.fi
Fri Feb 26 00:13:55 UTC 2016


Simplify if statement to avoid deep nesting.

Signed-off-by: Aaro Koskinen <aaro.koskinen at iki.fi>
---
 drivers/staging/octeon-usb/octeon-hcd.c | 33 +++++++++++++++------------------
 1 file changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
index 726ec5d..39854ab 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -2768,26 +2768,23 @@ static int cvmx_usb_poll_channel(struct cvmx_usb_state *usb, int channel)
 			 */
 			if (cvmx_usb_pipe_needs_split(usb, pipe)) {
 				if (transaction->stage ==
-				    CVMX_USB_STAGE_NON_CONTROL)
+				    CVMX_USB_STAGE_NON_CONTROL) {
 					transaction->stage =
 						CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
-				else {
-					if (buffer_space_left &&
-					    (bytes_in_last_packet ==
-					     pipe->max_packet))
-						transaction->stage =
-							CVMX_USB_STAGE_NON_CONTROL;
-					else {
-						if (transaction->type ==
-						    CVMX_USB_TRANSFER_INTERRUPT)
-							pipe->next_tx_frame +=
-								pipe->interval;
-							cvmx_usb_perform_complete(
-								usb,
-								pipe,
-								transaction,
-								CVMX_USB_COMPLETE_SUCCESS);
-					}
+				} else if (buffer_space_left &&
+					   (bytes_in_last_packet ==
+					   pipe->max_packet)) {
+					transaction->stage =
+						CVMX_USB_STAGE_NON_CONTROL;
+				} else {
+					if (transaction->type ==
+					    CVMX_USB_TRANSFER_INTERRUPT)
+						pipe->next_tx_frame +=
+							pipe->interval;
+					cvmx_usb_perform_complete(usb,
+								  pipe,
+								  transaction,
+								  CVMX_USB_COMPLETE_SUCCESS);
 				}
 			} else {
 				if ((pipe->device_speed ==
-- 
2.4.0



More information about the devel mailing list