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)
int ret;
DPRINTK(4, "\n");
if (cnt_txqbody(priv) > 0 &&
atomic_read(&priv->psstatus.status) != PS_SNOOZE) {
if (cnt_txqbody(priv) <= 0 ||
atomic_read(&priv->psstatus.status) == PS_SNOOZE)
return;
sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead];
if (priv->dev_state >= DEVICE_STATE_BOOT) {
ret = write_to_device(priv, sp->sendp, sp->size);
......@@ -324,7 +326,7 @@ static void tx_device_task(struct ks_wlan_private *priv)
return;
}
}
kfree(sp->sendp); /* allocated memory free */
kfree(sp->sendp);
if (sp->complete_handler) /* TX Complete */
(*sp->complete_handler) (sp->arg1, sp->arg2);
inc_txqhead(priv);
......@@ -333,7 +335,6 @@ static void tx_device_task(struct ks_wlan_private *priv)
queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,
&priv->ks_wlan_hw.rw_wq, 0);
}
}
}
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)
priv = card->priv;
DPRINTK(4, "\n");
if (priv->dev_state >= DEVICE_STATE_BOOT) {
ret = ks7010_sdio_read(priv, INT_PENDING, &status,
sizeof(status));
if (priv->dev_state < DEVICE_STATE_BOOT)
goto queue_delayed_work;
ret = ks7010_sdio_read(priv, INT_PENDING, &status, sizeof(status));
if (ret) {
DPRINTK(1, "read INT_PENDING Failed!!(%d)\n", ret);
goto queue_delayed_work;
......@@ -557,12 +559,9 @@ static void ks_sdio_interrupt(struct sdio_func *func)
DPRINTK(1, " error : GCR_B=%02X\n", rw_data);
goto queue_delayed_work;
}
/* DPRINTK(1, "GCR_B=%02X\n", rw_data); */
if (rw_data == GCR_B_ACTIVE) {
if (atomic_read(&priv->psstatus.status) ==
PS_SNOOZE) {
atomic_set(&priv->psstatus.status,
PS_WAKEUP);
if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) {
atomic_set(&priv->psstatus.status, PS_WAKEUP);
priv->wakeup_count = 0;
}
complete(&priv->psstatus.wakeup_wait);
......@@ -574,8 +573,7 @@ static void ks_sdio_interrupt(struct sdio_func *func)
ret = ks7010_sdio_read(priv, WSTATUS_RSIZE, &rw_data,
sizeof(rw_data));
if (ret) {
DPRINTK(1, " error : WSTATUS_RSIZE=%02X\n",
rw_data);
DPRINTK(1, " error : WSTATUS_RSIZE=%02X\n", rw_data);
goto queue_delayed_work;
}
DPRINTK(4, "WSTATUS_RSIZE=%02X\n", rw_data);
......@@ -587,11 +585,8 @@ static void ks_sdio_interrupt(struct sdio_func *func)
if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) {
if (cnt_txqbody(priv)) {
ks_wlan_hw_wakeup_request(priv);
queue_delayed_work
(priv->ks_wlan_hw.
ks7010sdio_wq,
&priv->ks_wlan_hw.
rw_wq, 1);
queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,
&priv->ks_wlan_hw.rw_wq, 1);
return;
}
} else {
......@@ -599,7 +594,6 @@ static void ks_sdio_interrupt(struct sdio_func *func)
}
}
} while (rsize);
}
queue_delayed_work:
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