Code is unnecessarily nested. Function body is guarded by an if statement, we can invert the if statement conditional and return, subsequent code can have the indentation reduced. Invert conditional, change '&&' to '||' , '>' to '<=' and '!=' to '=='. Return if new conditional evaluates to true. Reduce indentation in subsequent code. Signed-off-by: Tobin C. Harding <me@xxxxxxxx> --- drivers/staging/ks7010/ks7010_sdio.c | 43 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index b16618b..b540be3 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -313,30 +313,31 @@ static void tx_device_task(void *dev) int rc = 0; DPRINTK(4, "\n"); - if (cnt_txqbody(priv) > 0 && - atomic_read(&priv->psstatus.status) != PS_SNOOZE) { - sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead]; - if (priv->dev_state >= DEVICE_STATE_BOOT) { - rc = write_to_device(priv, sp->sendp, sp->size); - if (rc) { - DPRINTK(1, "write_to_device error !!(%d)\n", - rc); - queue_delayed_work(priv->ks_wlan_hw. - ks7010sdio_wq, - &priv->ks_wlan_hw.rw_wq, 1); - return; - } - } - kfree(sp->sendp); /* allocated memory free */ - if (sp->complete_handler) /* TX Complete */ - (*sp->complete_handler) (sp->arg1, sp->arg2); - inc_txqhead(priv); + if (cnt_txqbody(priv) <= 0 || + atomic_read(&priv->psstatus.status) == PS_SNOOZE) + return; - if (cnt_txqbody(priv) > 0) { - queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, - &priv->ks_wlan_hw.rw_wq, 0); + sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead]; + if (priv->dev_state >= DEVICE_STATE_BOOT) { + rc = write_to_device(priv, sp->sendp, sp->size); + if (rc) { + DPRINTK(1, "write_to_device error !!(%d)\n", + rc); + queue_delayed_work(priv->ks_wlan_hw. + ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq, 1); + return; } } + kfree(sp->sendp); /* allocated memory free */ + if (sp->complete_handler) /* TX Complete */ + (*sp->complete_handler) (sp->arg1, sp->arg2); + inc_txqhead(priv); + + if (cnt_txqbody(priv) > 0) { + 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, -- 2.7.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel