Reverse conditions and use goto in the function rtl8192_adapter_start to have most of it under 80 characters per line. Signed-off-by: Raphaël Beamonte <raphael.beamonte@xxxxxxxxx> --- drivers/staging/rtl8192u/r8192U_core.c | 91 ++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 7fe86ff..eb9c07e 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2766,6 +2766,7 @@ static bool rtl8192_adapter_start(struct net_device *dev) bool init_status = true; u8 SECR_value = 0x0; u8 tmp; + u32 i, TempCCk, tmpRegA; RT_TRACE(COMP_INIT, "====>%s()\n", __func__); priv->Rf_Mode = RF_OP_By_SW_3wire; @@ -2947,59 +2948,61 @@ static bool rtl8192_adapter_start(struct net_device *dev) rtl8192_setBBreg(dev, rFPGA0_RFMOD, bCCKEn, 0x1); rtl8192_setBBreg(dev, rFPGA0_RFMOD, bOFDMEn, 0x1); - if (priv->ResetProgress == RESET_TYPE_NORESET) { - /* if D or C cut */ - u8 tmpvalue; + if (priv->ResetProgress != RESET_TYPE_NORESET) + goto end; - read_nic_byte(dev, 0x301, &tmpvalue); - if (tmpvalue == 0x03) { - priv->bDcut = true; - RT_TRACE(COMP_POWER_TRACKING, "D-cut\n"); - } else { - priv->bDcut = false; - RT_TRACE(COMP_POWER_TRACKING, "C-cut\n"); + /* if D or C cut */ + read_nic_byte(dev, 0x301, &tmp); + if (tmp == 0x03) { + priv->bDcut = true; + RT_TRACE(COMP_POWER_TRACKING, "D-cut\n"); + } else { + priv->bDcut = false; + RT_TRACE(COMP_POWER_TRACKING, "C-cut\n"); + } + dm_initialize_txpower_tracking(dev); + + if (!priv->bDcut) + goto end; + + tmpRegA = rtl8192_QueryBBReg(dev, + rOFDM0_XATxIQImbalance, + bMaskDWord); + + for (i = 0; i < TxBBGainTableLength; i++) { + txbbgain_struct tx = priv->txbbgain_table[i]; + + if (tmpRegA == tx.txbbgain_value) { + priv->rfa_txpowertrackingindex = (u8)i; + priv->rfa_txpowertrackingindex_real = + (u8)i; + priv->rfa_txpowertracking_default = + priv->rfa_txpowertrackingindex; + break; } - dm_initialize_txpower_tracking(dev); - - if (priv->bDcut) { - u32 i, TempCCk; - u32 tmpRegA = rtl8192_QueryBBReg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord); - txbbgain_struct *tx = priv->txbbgain_table; - ccktxbbgain_struct *cck = priv->cck_txbbgain_table; - - for (i = 0; i < TxBBGainTableLength; i++) { - if (tmpRegA == tx[i].txbbgain_value) { - priv->rfa_txpowertrackingindex = (u8)i; - priv->rfa_txpowertrackingindex_real = - (u8)i; - priv->rfa_txpowertracking_default = - priv->rfa_txpowertrackingindex; - break; - } - } + } - TempCCk = rtl8192_QueryBBReg(dev, - rCCK0_TxFilter1, - bMaskByte2); + TempCCk = rtl8192_QueryBBReg(dev, + rCCK0_TxFilter1, + bMaskByte2); - for (i = 0; i < CCKTxBBGainTableLength; i++) { - if (TempCCk == cck[i].ccktxbb_valuearray[0]) { - priv->cck_present_attentuation_20Mdefault = (u8)i; - break; - } - } - priv->cck_present_attentuation_40Mdefault = 0; - priv->cck_present_attentuation_difference = 0; - priv->cck_present_attentuation = - priv->cck_present_attentuation_20Mdefault; + for (i = 0; i < CCKTxBBGainTableLength; i++) { + ccktxbbgain_struct cck = priv->cck_txbbgain_table[i]; + if (TempCCk == cck.ccktxbb_valuearray[0]) { + priv->cck_present_attentuation_20Mdefault = (u8)i; + break; } } - write_nic_byte(dev, 0x87, 0x0); + priv->cck_present_attentuation_40Mdefault = 0; + priv->cck_present_attentuation_difference = 0; + priv->cck_present_attentuation = + priv->cck_present_attentuation_20Mdefault; +end: + write_nic_byte(dev, 0x87, 0x0); + return init_status; } -- 2.5.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel