[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <a154377af9a75fe38eb6b1edf2fa14201553acb2.1442769012.git.raphael.beamonte@gmail.com>
Date: Sun, 20 Sep 2015 13:14:16 -0400
From: Raphaël Beamonte <raphael.beamonte@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Raphaël Beamonte <raphael.beamonte@...il.com>,
Cristina Opriceana <cristina.opriceana@...il.com>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCHv3 04/15] staging: rtl8192u: r8192U_core: rtl8192_adapter_start: reorganize function
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@...il.com>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists