Bulk of function is guarded by an if statement. If we invert the conditional and return, the subsequent code can be indented one level less. Invert if statement conditional. '>=' to '<'. Jump to goto label if new conditional evaluates to true. Do not change program logic. Signed-off-by: Tobin C. Harding <me@xxxxxxxx> --- drivers/staging/ks7010/ks7010_sdio.c | 117 ++++++++++++++++++----------------- 1 file changed, 59 insertions(+), 58 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index 08e89b3..bbee02c 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -543,72 +543,73 @@ 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; + } + DPRINTK(4, "INT_PENDING=%02X\n", rw_data); + + /* schedule task for interrupt status */ + /* bit7 -> Write General Communication B register */ + /* read (General Communication B register) */ + /* bit5 -> Write Status Idle */ + /* bit2 -> Read Status Busy */ + if (status & INT_GCR_B || + atomic_read(&priv->psstatus.status) == PS_SNOOZE) { + ret = ks7010_sdio_read(priv, GCR_B, &rw_data, + sizeof(rw_data)); if (ret) { - DPRINTK(1, "read INT_PENDING Failed!!(%d)\n", ret); + DPRINTK(1, " error : GCR_B=%02X\n", rw_data); goto queue_delayed_work; } - DPRINTK(4, "INT_PENDING=%02X\n", rw_data); - - /* schedule task for interrupt status */ - /* bit7 -> Write General Communication B register */ - /* read (General Communication B register) */ - /* bit5 -> Write Status Idle */ - /* bit2 -> Read Status Busy */ - if (status & INT_GCR_B || - atomic_read(&priv->psstatus.status) == PS_SNOOZE) { - ret = ks7010_sdio_read(priv, GCR_B, &rw_data, - sizeof(rw_data)); - if (ret) { - 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); - priv->wakeup_count = 0; - } - complete(&priv->psstatus.wakeup_wait); + /* 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); + priv->wakeup_count = 0; } + complete(&priv->psstatus.wakeup_wait); } + } - do { - /* read (WriteStatus/ReadDataSize FN1:00_0014) */ - ret = ks7010_sdio_read(priv, WSTATUS_RSIZE, &rw_data, - sizeof(rw_data)); - if (ret) { - DPRINTK(1, " error : WSTATUS_RSIZE=%02X\n", - rw_data); - goto queue_delayed_work; - } - DPRINTK(4, "WSTATUS_RSIZE=%02X\n", rw_data); - rsize = rw_data & RSIZE_MASK; - if (rsize != 0) { /* Read schedule */ - ks_wlan_hw_rx((void *)priv, - (uint16_t)(rsize << 4)); - } - if (rw_data & WSTATUS_MASK) { - 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); - return; - } - } else { - tx_device_task((void *)priv); + do { + /* read (WriteStatus/ReadDataSize FN1:00_0014) */ + ret = ks7010_sdio_read(priv, WSTATUS_RSIZE, &rw_data, + sizeof(rw_data)); + if (ret) { + DPRINTK(1, " error : WSTATUS_RSIZE=%02X\n", + rw_data); + goto queue_delayed_work; + } + DPRINTK(4, "WSTATUS_RSIZE=%02X\n", rw_data); + rsize = rw_data & RSIZE_MASK; + if (rsize != 0) { /* Read schedule */ + ks_wlan_hw_rx((void *)priv, + (uint16_t)(rsize << 4)); + } + if (rw_data & WSTATUS_MASK) { + 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); + return; } + } else { + tx_device_task((void *)priv); } - } while (rsize); - } + } + } while (rsize); queue_delayed_work: queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, -- 2.7.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel