Commit 638a75b6 authored by Tobin C. Harding's avatar Tobin C. Harding Committed by Greg Kroah-Hartman

staging: ks7010: invert conditional, reduce indentation

A number of functions have blocks of code guarded by an if statement.

if (foo) {
       	/* block of code */
}

This can, on occasion, more succinctly be expressed as

if (!foo)
	return

/* block of code */

This change will mean a number of whitespace issues need to be
addressed/fixed. The diff can be a little hard to read when there are
multiple lines that are very similar (for example error return
code). Splitting the indentation reduction and the whitespace fixes
into two separate patches was not found to aid reading the
diff. Therefor we fix the whitespace issues at the same time. We need
to be very sure to not make any changes to the program logic, this is
ensured by only doing what is stated - invert the conditional, fix
whitespace.

Invert if statement conditionals. Return if new conditional evaluates
to true. Reduce level of indentation in subsequent code. Fix white
space issues.
Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f7172487
...@@ -312,8 +312,10 @@ static void tx_device_task(struct ks_wlan_private *priv) ...@@ -312,8 +312,10 @@ static void tx_device_task(struct ks_wlan_private *priv)
int ret; int ret;
DPRINTK(4, "\n"); DPRINTK(4, "\n");
if (cnt_txqbody(priv) > 0 && if (cnt_txqbody(priv) <= 0 ||
atomic_read(&priv->psstatus.status) != PS_SNOOZE) { atomic_read(&priv->psstatus.status) == PS_SNOOZE)
return;
sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead]; sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead];
if (priv->dev_state >= DEVICE_STATE_BOOT) { if (priv->dev_state >= DEVICE_STATE_BOOT) {
ret = write_to_device(priv, sp->sendp, sp->size); ret = write_to_device(priv, sp->sendp, sp->size);
...@@ -324,7 +326,7 @@ static void tx_device_task(struct ks_wlan_private *priv) ...@@ -324,7 +326,7 @@ static void tx_device_task(struct ks_wlan_private *priv)
return; return;
} }
} }
kfree(sp->sendp); /* allocated memory free */ kfree(sp->sendp);
if (sp->complete_handler) /* TX Complete */ if (sp->complete_handler) /* TX Complete */
(*sp->complete_handler) (sp->arg1, sp->arg2); (*sp->complete_handler) (sp->arg1, sp->arg2);
inc_txqhead(priv); inc_txqhead(priv);
...@@ -333,7 +335,6 @@ static void tx_device_task(struct ks_wlan_private *priv) ...@@ -333,7 +335,6 @@ static void tx_device_task(struct ks_wlan_private *priv)
queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,
&priv->ks_wlan_hw.rw_wq, 0); &priv->ks_wlan_hw.rw_wq, 0);
} }
}
} }
int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size, int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size,
...@@ -535,9 +536,10 @@ static void ks_sdio_interrupt(struct sdio_func *func) ...@@ -535,9 +536,10 @@ static void ks_sdio_interrupt(struct sdio_func *func)
priv = card->priv; priv = card->priv;
DPRINTK(4, "\n"); DPRINTK(4, "\n");
if (priv->dev_state >= DEVICE_STATE_BOOT) { if (priv->dev_state < DEVICE_STATE_BOOT)
ret = ks7010_sdio_read(priv, INT_PENDING, &status, goto queue_delayed_work;
sizeof(status));
ret = ks7010_sdio_read(priv, INT_PENDING, &status, sizeof(status));
if (ret) { if (ret) {
DPRINTK(1, "read INT_PENDING Failed!!(%d)\n", ret); DPRINTK(1, "read INT_PENDING Failed!!(%d)\n", ret);
goto queue_delayed_work; goto queue_delayed_work;
...@@ -557,12 +559,9 @@ static void ks_sdio_interrupt(struct sdio_func *func) ...@@ -557,12 +559,9 @@ static void ks_sdio_interrupt(struct sdio_func *func)
DPRINTK(1, " error : GCR_B=%02X\n", rw_data); DPRINTK(1, " error : GCR_B=%02X\n", rw_data);
goto queue_delayed_work; goto queue_delayed_work;
} }
/* DPRINTK(1, "GCR_B=%02X\n", rw_data); */
if (rw_data == GCR_B_ACTIVE) { if (rw_data == GCR_B_ACTIVE) {
if (atomic_read(&priv->psstatus.status) == if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) {
PS_SNOOZE) { atomic_set(&priv->psstatus.status, PS_WAKEUP);
atomic_set(&priv->psstatus.status,
PS_WAKEUP);
priv->wakeup_count = 0; priv->wakeup_count = 0;
} }
complete(&priv->psstatus.wakeup_wait); complete(&priv->psstatus.wakeup_wait);
...@@ -574,8 +573,7 @@ static void ks_sdio_interrupt(struct sdio_func *func) ...@@ -574,8 +573,7 @@ static void ks_sdio_interrupt(struct sdio_func *func)
ret = ks7010_sdio_read(priv, WSTATUS_RSIZE, &rw_data, ret = ks7010_sdio_read(priv, WSTATUS_RSIZE, &rw_data,
sizeof(rw_data)); sizeof(rw_data));
if (ret) { if (ret) {
DPRINTK(1, " error : WSTATUS_RSIZE=%02X\n", DPRINTK(1, " error : WSTATUS_RSIZE=%02X\n", rw_data);
rw_data);
goto queue_delayed_work; goto queue_delayed_work;
} }
DPRINTK(4, "WSTATUS_RSIZE=%02X\n", rw_data); DPRINTK(4, "WSTATUS_RSIZE=%02X\n", rw_data);
...@@ -587,11 +585,8 @@ static void ks_sdio_interrupt(struct sdio_func *func) ...@@ -587,11 +585,8 @@ static void ks_sdio_interrupt(struct sdio_func *func)
if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) { if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) {
if (cnt_txqbody(priv)) { if (cnt_txqbody(priv)) {
ks_wlan_hw_wakeup_request(priv); ks_wlan_hw_wakeup_request(priv);
queue_delayed_work queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,
(priv->ks_wlan_hw. &priv->ks_wlan_hw.rw_wq, 1);
ks7010sdio_wq,
&priv->ks_wlan_hw.
rw_wq, 1);
return; return;
} }
} else { } else {
...@@ -599,7 +594,6 @@ static void ks_sdio_interrupt(struct sdio_func *func) ...@@ -599,7 +594,6 @@ static void ks_sdio_interrupt(struct sdio_func *func)
} }
} }
} while (rsize); } while (rsize);
}
queue_delayed_work: queue_delayed_work:
queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment