[PATCH 4/9] staging: ks7010: Fix checkpatch warning

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

 



Checkpatch emits WARNING: Too many leading tabs - consider code
refactoring. Code in question is nested under two if statements.
Outside of if statements there is the return statement. If statement
conditionals can be inverted and function made to return immediately
without changing program logic.

Invert conditionals. Also change && to ||. Return immediately if new
conditionals are true. Do not touch remaining code except to remove
indentation.

Signed-off-by: Tobin C. Harding <me@xxxxxxxx>
---
 drivers/staging/ks7010/ks7010_sdio.c | 122 +++++++++++++++++------------------
 1 file changed, 61 insertions(+), 61 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index 2992eca..06d1037 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -176,71 +176,71 @@ static int _ks_wlan_hw_power_save(struct ks_wlan_private *priv)
 	if (priv->reg.powermgt == POWMGT_ACTIVE_MODE)
 		return 0;
 
-	if (priv->reg.operation_mode == MODE_INFRASTRUCTURE &&
-	    (priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) {
-		if (priv->dev_state == DEVICE_STATE_SLEEP) {
-			switch (atomic_read(&priv->psstatus.status)) {
-			case PS_SNOOZE:	/* 4 */
+	if (priv->reg.operation_mode != MODE_INFRASTRUCTURE ||
+	    (priv->connect_status & CONNECT_STATUS_MASK) != CONNECT_STATUS)
+		return 0;
+
+	if (priv->dev_state != DEVICE_STATE_SLEEP)
+		return 0;
+
+	switch (atomic_read(&priv->psstatus.status)) {
+	case PS_SNOOZE:	/* 4 */
+		break;
+	default:
+		DPRINTK(5, "\npsstatus.status=%d\npsstatus.confirm_wait=%d\npsstatus.snooze_guard=%d\ncnt_txqbody=%d\n",
+			atomic_read(&priv->psstatus.status),
+			atomic_read(&priv->psstatus.confirm_wait),
+			atomic_read(&priv->psstatus.snooze_guard),
+			cnt_txqbody(priv));
+
+		if (!atomic_read(&priv->psstatus.confirm_wait)
+			&& !atomic_read(&priv->psstatus.snooze_guard)
+			&& !cnt_txqbody(priv)) {
+			retval =
+				ks7010_sdio_read(priv, INT_PENDING,
+						&rw_data,
+						sizeof(rw_data));
+			if (retval) {
+				DPRINTK(1,
+					" error : INT_PENDING=%02X\n",
+					rw_data);
+				queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,
+						&priv->ks_wlan_hw.rw_wq, 1);
 				break;
-			default:
-				DPRINTK(5, "\npsstatus.status=%d\npsstatus.confirm_wait=%d\npsstatus.snooze_guard=%d\ncnt_txqbody=%d\n",
-					atomic_read(&priv->psstatus.status),
-					atomic_read(&priv->psstatus.confirm_wait),
-					atomic_read(&priv->psstatus.snooze_guard),
-					cnt_txqbody(priv));
-
-				if (!atomic_read(&priv->psstatus.confirm_wait)
-				    && !atomic_read(&priv->psstatus.snooze_guard)
-				    && !cnt_txqbody(priv)) {
-					retval =
-					    ks7010_sdio_read(priv, INT_PENDING,
-							     &rw_data,
-							     sizeof(rw_data));
-					if (retval) {
-						DPRINTK(1,
-							" error : INT_PENDING=%02X\n",
-							rw_data);
-						queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,
-								   &priv->ks_wlan_hw.rw_wq, 1);
-						break;
-					}
-					if (!rw_data) {
-						rw_data = GCR_B_DOZE;
-						retval =
-						    ks7010_sdio_write(priv,
-								      GCR_B,
-								      &rw_data,
-								      sizeof(rw_data));
-						if (retval) {
-							DPRINTK(1,
-								" error : GCR_B=%02X\n",
-								rw_data);
-							queue_delayed_work
-							    (priv->ks_wlan_hw.ks7010sdio_wq,
-							     &priv->ks_wlan_hw.rw_wq, 1);
-							break;
-						}
-						DPRINTK(4,
-							"PMG SET!! : GCR_B=%02X\n",
-							rw_data);
-						atomic_set(&priv->psstatus.status,
-							PS_SNOOZE);
-						DPRINTK(3,
-							"psstatus.status=PS_SNOOZE\n");
-					} else {
-						queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,
-								   &priv->ks_wlan_hw.rw_wq, 1);
-					}
-				} else {
-					queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,
-							   &priv->ks_wlan_hw.rw_wq,
-							   0);
+			}
+			if (!rw_data) {
+				rw_data = GCR_B_DOZE;
+				retval =
+					ks7010_sdio_write(priv,
+							GCR_B,
+							&rw_data,
+							sizeof(rw_data));
+				if (retval) {
+					DPRINTK(1,
+						" error : GCR_B=%02X\n",
+						rw_data);
+					queue_delayed_work
+						(priv->ks_wlan_hw.ks7010sdio_wq,
+							&priv->ks_wlan_hw.rw_wq, 1);
+					break;
 				}
-				break;
+				DPRINTK(4,
+					"PMG SET!! : GCR_B=%02X\n",
+					rw_data);
+				atomic_set(&priv->psstatus.status, PS_SNOOZE);
+				DPRINTK(3,
+					"psstatus.status=PS_SNOOZE\n");
+			} else {
+				queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,
+						&priv->ks_wlan_hw.rw_wq, 1);
 			}
+		} else {
+			queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,
+					&priv->ks_wlan_hw.rw_wq,
+					0);
 		}
+		break;
 	}
-
 	return 0;
 }
 
@@ -632,7 +632,7 @@ static void ks_sdio_interrupt(struct sdio_func *func)
 							ks_wlan_hw_wakeup_request(priv);
 							queue_delayed_work
 							    (priv->ks_wlan_hw.ks7010sdio_wq,
-								    &priv->ks_wlan_hw.rw_wq, 1);
+							     &priv->ks_wlan_hw.rw_wq, 1);
 							return;
 						}
 					} else {
-- 
2.7.4

_______________________________________________
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