summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobin C. Harding <me@tobin.cc>2017-02-27 14:14:47 +1100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-06 09:17:05 +0100
commit3188bc092655a0ef032eda9d5a251323b3008d40 (patch)
treec8cca2e022fc4667f8c148684f4fcb6025eb59aa
parentcf57e659d5be6459e642dd451268bdb3437af7ff (diff)
downloadop-kernel-dev-3188bc092655a0ef032eda9d5a251323b3008d40.zip
op-kernel-dev-3188bc092655a0ef032eda9d5a251323b3008d40.tar.gz
staging: ks7010: remove switch statement
Switch statement uses one [trivial] case and a default case holding bulk of code. We can swap the switch statement with an if/return statement as replacement for the original switch. This can be done without changing the program logic. Remove switch statement. Use original switch parameter as conditional and return if conditional evaluates to true. Reduce level of indentation. Do not change the program logic. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/ks7010/ks7010_sdio.c89
1 files changed, 43 insertions, 46 deletions
diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index 0e07b83..04130fb 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -183,63 +183,60 @@ static int _ks_wlan_hw_power_save(struct ks_wlan_private *priv)
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)) {
+ if (atomic_read(&priv->psstatus.status) == PS_SNOOZE)
+ return 0;
+
+ 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);
+ return 0;
+ }
+ if (!rw_data) {
+ rw_data = GCR_B_DOZE;
retval =
- ks7010_sdio_read(priv, INT_PENDING,
+ ks7010_sdio_write(priv,
+ GCR_B,
&rw_data,
sizeof(rw_data));
if (retval) {
DPRINTK(1,
- " error : INT_PENDING=%02X\n",
+ " error : GCR_B=%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,
+ queue_delayed_work
+ (priv->ks_wlan_hw.ks7010sdio_wq,
&priv->ks_wlan_hw.rw_wq, 1);
+ return 0;
}
+ 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,
- 0);
+ &priv->ks_wlan_hw.rw_wq, 1);
}
- break;
+ } else {
+ queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,
+ &priv->ks_wlan_hw.rw_wq,
+ 0);
}
return 0;
OpenPOWER on IntegriCloud