From: "Raphaël Beamonte" <raphael.beamonte@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Raphaël Beamonte" <raphael.beamonte@gmail.com>,
"Cristina Opriceana" <cristina.opriceana@gmail.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCHv3 04/15] staging: rtl8192u: r8192U_core: rtl8192_adapter_start: reorganize function
Date: Sun, 20 Sep 2015 13:14:16 -0400 [thread overview]
Message-ID: <a154377af9a75fe38eb6b1edf2fa14201553acb2.1442769012.git.raphael.beamonte@gmail.com> (raw)
In-Reply-To: <cover.1442769012.git.raphael.beamonte@gmail.com>
In-Reply-To: <cover.1442769012.git.raphael.beamonte@gmail.com>
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@gmail.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
next prev parent reply other threads:[~2015-09-20 17:16 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-11 7:29 [PATCHv2 00/16] staging: rtl8192u: code clean up Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 01/16] staging: rtl8192u: r8192U_core: fix comments lines over 80 characters Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 02/16] staging: rtl8192u: r8192U_core: add line breaks to keep lines under " Raphaël Beamonte
2015-09-17 4:55 ` Greg Kroah-Hartman
2015-09-11 7:29 ` [PATCHv2 03/16] staging: rtl8192u: r8192U_core: add temporary variables " Raphaël Beamonte
2015-09-17 4:57 ` Greg Kroah-Hartman
2015-09-17 5:06 ` Raphaël Beamonte
2015-09-17 5:18 ` Greg Kroah-Hartman
2015-09-17 18:26 ` Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 04/16] staging: rtl8192u: r8192U_core: reverse conditions to get " Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 05/16] staging: rtl8192u: r8192U_core: rtl8192_adapter_start: reorganize function Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 06/16] staging: rtl8192u: r8192U_core: rtl8192_read_eeprom_info: " Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 07/16] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable pprevious_stats to prev_stats Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 08/16] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable slide_beacon_adc_pwdb_index to sb_index Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 09/16] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable slide_beacon_adc_pwdb_statistics to sb_stats Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 10/16] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: remove unneeded variable Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 11/16] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable rfpath to rfp Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 12/16] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: reorganize function Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 13/16] staging: rtl8192u: r8192U_core: rtl8192_tx: replace some inline conditions Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 14/16] staging: rtl8192u: r8192U_core: rtl8192_ioctl: reorganize function Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 15/16] staging: rtl8192u: r8192U_core: replace else { if() {} } by else if () {} Raphaël Beamonte
2015-09-11 7:29 ` [PATCHv2 16/16] staging: rtl8192u: remove all code framed by symbol TO_DO_LIST Raphaël Beamonte
2015-09-20 17:14 ` [PATCHv3 00/15] staging: rtl8192u: code clean up Raphaël Beamonte
2015-09-20 17:14 ` [PATCHv3 01/15] staging: rtl8192u: r8192U_core: add line breaks to keep lines under 80 characters Raphaël Beamonte
2015-09-20 17:14 ` [PATCHv3 02/15] staging: rtl8192u: r8192U_core: add temporary variables " Raphaël Beamonte
2015-09-21 2:16 ` Greg Kroah-Hartman
2015-09-21 16:31 ` Raphaël Beamonte
2015-09-20 17:14 ` [PATCHv3 03/15] staging: rtl8192u: r8192U_core: reverse conditions to get " Raphaël Beamonte
2015-09-20 17:14 ` Raphaël Beamonte [this message]
2015-09-20 17:14 ` [PATCHv3 05/15] staging: rtl8192u: r8192U_core: rtl8192_read_eeprom_info: reorganize function Raphaël Beamonte
2015-09-20 17:14 ` [PATCHv3 06/15] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable pprevious_stats to prev_stats Raphaël Beamonte
2015-09-20 17:14 ` [PATCHv3 07/15] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable slide_beacon_adc_pwdb_index to sb_index Raphaël Beamonte
2015-09-20 17:14 ` [PATCHv3 08/15] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable slide_beacon_adc_pwdb_statistics to sb_stats Raphaël Beamonte
2015-09-20 17:14 ` [PATCHv3 09/15] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: remove unneeded variable Raphaël Beamonte
2015-09-20 17:14 ` [PATCHv3 10/15] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: rename variable rfpath to rfp Raphaël Beamonte
2015-09-20 17:14 ` [PATCHv3 11/15] staging: rtl8192u: r8192U_core: rtl8192_process_phyinfo: reorganize function Raphaël Beamonte
2015-09-20 17:14 ` [PATCHv3 12/15] staging: rtl8192u: r8192U_core: rtl8192_tx: replace some inline conditions Raphaël Beamonte
2015-09-20 17:14 ` [PATCHv3 13/15] staging: rtl8192u: r8192U_core: rtl8192_ioctl: reorganize function Raphaël Beamonte
2015-09-20 17:14 ` [PATCHv3 14/15] staging: rtl8192u: r8192U_core: replace else { if() {} } by else if () {} Raphaël Beamonte
2015-09-20 17:14 ` [PATCHv3 15/15] staging: rtl8192u: remove all code framed by symbol TO_DO_LIST Raphaël Beamonte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a154377af9a75fe38eb6b1edf2fa14201553acb2.1442769012.git.raphael.beamonte@gmail.com \
--to=raphael.beamonte@gmail.com \
--cc=cristina.opriceana@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®