[PATCH 04/15] Staging: bcm: led_control.c: Simplified nested if conditions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Matthias Beyer <mail@xxxxxxxxxxxxxxxx>
---
 drivers/staging/bcm/led_control.c | 40 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/bcm/led_control.c b/drivers/staging/bcm/led_control.c
index 612e61e..f528a45 100644
--- a/drivers/staging/bcm/led_control.c
+++ b/drivers/staging/bcm/led_control.c
@@ -632,31 +632,29 @@ static INT BcmGetGPIOPinInfo(struct bcm_mini_adapter *Adapter,
 
 	for (uiIndex = 0; uiIndex < NUM_OF_LEDS; uiIndex++) {
 
-		if ((currdriverstate == NORMAL_OPERATION) ||
-				(currdriverstate == IDLEMODE_EXIT) ||
-				(currdriverstate == FW_DOWNLOAD)) {
-			if (Adapter->LEDInfo.LEDState[uiIndex].LED_Blink_State &
-					currdriverstate) {
-				if (Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num
-						!= DISABLE_GPIO_NUM) {
-					if (*GPIO_num_tx == DISABLE_GPIO_NUM) {
-						*GPIO_num_tx = Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num;
-						*uiLedTxIndex = uiIndex;
-					} else {
-						*GPIO_num_rx = Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num;
-						*uiLedRxIndex = uiIndex;
-					}
-				}
-			}
-		} else {
-			if (Adapter->LEDInfo.LEDState[uiIndex].LED_On_State
-					& currdriverstate) {
-				if (Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num
-						!= DISABLE_GPIO_NUM) {
+		if (((currdriverstate == NORMAL_OPERATION) ||
+			(currdriverstate == IDLEMODE_EXIT) ||
+			(currdriverstate == FW_DOWNLOAD)) &&
+		    (Adapter->LEDInfo.LEDState[uiIndex].LED_Blink_State &
+					currdriverstate)) {
+			if (Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num
+					!= DISABLE_GPIO_NUM) {
+				if (*GPIO_num_tx == DISABLE_GPIO_NUM) {
 					*GPIO_num_tx = Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num;
 					*uiLedTxIndex = uiIndex;
+				} else {
+					*GPIO_num_rx = Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num;
+					*uiLedRxIndex = uiIndex;
 				}
 			}
+		} else {
+			if ((Adapter->LEDInfo.LEDState[uiIndex].LED_On_State &
+						currdriverstate) &&
+			    (Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num !=
+			     DISABLE_GPIO_NUM)) {
+				*GPIO_num_tx = Adapter->LEDInfo.LEDState[uiIndex].GPIO_Num;
+				*uiLedTxIndex = uiIndex;
+			}
 		}
 	}
 	return STATUS_SUCCESS;
-- 
2.0.0

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux