From: Vatika Harlalka <vatikaharlalka@gmail.com>
To: outreachy-kernel@googlegroups.com
Subject: [PATCH] Staging: rtl8188eu: Add new variable to make code compact
Date: Wed, 25 Mar 2015 01:19:01 +0530 [thread overview]
Message-ID: <20150324194901.GA6284@akanksha> (raw)
Introducing this variable leads to overall more code
compactness and increases readability.
Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
---
drivers/staging/rtl8188eu/hal/bb_cfg.c | 162 +++++++++++++++++----------------
1 file changed, 84 insertions(+), 78 deletions(-)
diff --git a/drivers/staging/rtl8188eu/hal/bb_cfg.c b/drivers/staging/rtl8188eu/hal/bb_cfg.c
index 2d3d012..d10fcb2c 100644
--- a/drivers/staging/rtl8188eu/hal/bb_cfg.c
+++ b/drivers/staging/rtl8188eu/hal/bb_cfg.c
@@ -600,84 +600,90 @@ static bool config_bb_with_pgheader(struct adapter *adapt)
static void rtl88e_phy_init_bb_rf_register_definition(struct adapter *Adapter)
{
struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter);
-
- hal_data->PHYRegDef[RF_PATH_A].rfintfs = rFPGA0_XAB_RFInterfaceSW;
- hal_data->PHYRegDef[RF_PATH_B].rfintfs = rFPGA0_XAB_RFInterfaceSW;
- hal_data->PHYRegDef[RF_PATH_C].rfintfs = rFPGA0_XCD_RFInterfaceSW;
- hal_data->PHYRegDef[RF_PATH_D].rfintfs = rFPGA0_XCD_RFInterfaceSW;
-
- hal_data->PHYRegDef[RF_PATH_A].rfintfi = rFPGA0_XAB_RFInterfaceRB;
- hal_data->PHYRegDef[RF_PATH_B].rfintfi = rFPGA0_XAB_RFInterfaceRB;
- hal_data->PHYRegDef[RF_PATH_C].rfintfi = rFPGA0_XCD_RFInterfaceRB;
- hal_data->PHYRegDef[RF_PATH_D].rfintfi = rFPGA0_XCD_RFInterfaceRB;
-
- hal_data->PHYRegDef[RF_PATH_A].rfintfo = rFPGA0_XA_RFInterfaceOE;
- hal_data->PHYRegDef[RF_PATH_B].rfintfo = rFPGA0_XB_RFInterfaceOE;
-
- hal_data->PHYRegDef[RF_PATH_A].rfintfe = rFPGA0_XA_RFInterfaceOE;
- hal_data->PHYRegDef[RF_PATH_B].rfintfe = rFPGA0_XB_RFInterfaceOE;
-
- hal_data->PHYRegDef[RF_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter;
- hal_data->PHYRegDef[RF_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter;
-
- hal_data->PHYRegDef[RF_PATH_A].rfLSSI_Select = rFPGA0_XAB_RFParameter;
- hal_data->PHYRegDef[RF_PATH_B].rfLSSI_Select = rFPGA0_XAB_RFParameter;
- hal_data->PHYRegDef[RF_PATH_C].rfLSSI_Select = rFPGA0_XCD_RFParameter;
- hal_data->PHYRegDef[RF_PATH_D].rfLSSI_Select = rFPGA0_XCD_RFParameter;
-
- hal_data->PHYRegDef[RF_PATH_A].rfTxGainStage = rFPGA0_TxGainStage;
- hal_data->PHYRegDef[RF_PATH_B].rfTxGainStage = rFPGA0_TxGainStage;
- hal_data->PHYRegDef[RF_PATH_C].rfTxGainStage = rFPGA0_TxGainStage;
- hal_data->PHYRegDef[RF_PATH_D].rfTxGainStage = rFPGA0_TxGainStage;
-
- hal_data->PHYRegDef[RF_PATH_A].rfHSSIPara1 = rFPGA0_XA_HSSIParameter1;
- hal_data->PHYRegDef[RF_PATH_B].rfHSSIPara1 = rFPGA0_XB_HSSIParameter1;
-
- hal_data->PHYRegDef[RF_PATH_A].rfHSSIPara2 = rFPGA0_XA_HSSIParameter2;
- hal_data->PHYRegDef[RF_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2;
-
- hal_data->PHYRegDef[RF_PATH_A].rfSwitchControl = rFPGA0_XAB_SwitchControl;
- hal_data->PHYRegDef[RF_PATH_B].rfSwitchControl = rFPGA0_XAB_SwitchControl;
- hal_data->PHYRegDef[RF_PATH_C].rfSwitchControl = rFPGA0_XCD_SwitchControl;
- hal_data->PHYRegDef[RF_PATH_D].rfSwitchControl = rFPGA0_XCD_SwitchControl;
-
- hal_data->PHYRegDef[RF_PATH_A].rfAGCControl1 = rOFDM0_XAAGCCore1;
- hal_data->PHYRegDef[RF_PATH_B].rfAGCControl1 = rOFDM0_XBAGCCore1;
- hal_data->PHYRegDef[RF_PATH_C].rfAGCControl1 = rOFDM0_XCAGCCore1;
- hal_data->PHYRegDef[RF_PATH_D].rfAGCControl1 = rOFDM0_XDAGCCore1;
-
- hal_data->PHYRegDef[RF_PATH_A].rfAGCControl2 = rOFDM0_XAAGCCore2;
- hal_data->PHYRegDef[RF_PATH_B].rfAGCControl2 = rOFDM0_XBAGCCore2;
- hal_data->PHYRegDef[RF_PATH_C].rfAGCControl2 = rOFDM0_XCAGCCore2;
- hal_data->PHYRegDef[RF_PATH_D].rfAGCControl2 = rOFDM0_XDAGCCore2;
-
- hal_data->PHYRegDef[RF_PATH_A].rfRxIQImbalance = rOFDM0_XARxIQImbalance;
- hal_data->PHYRegDef[RF_PATH_B].rfRxIQImbalance = rOFDM0_XBRxIQImbalance;
- hal_data->PHYRegDef[RF_PATH_C].rfRxIQImbalance = rOFDM0_XCRxIQImbalance;
- hal_data->PHYRegDef[RF_PATH_D].rfRxIQImbalance = rOFDM0_XDRxIQImbalance;
-
- hal_data->PHYRegDef[RF_PATH_A].rfRxAFE = rOFDM0_XARxAFE;
- hal_data->PHYRegDef[RF_PATH_B].rfRxAFE = rOFDM0_XBRxAFE;
- hal_data->PHYRegDef[RF_PATH_C].rfRxAFE = rOFDM0_XCRxAFE;
- hal_data->PHYRegDef[RF_PATH_D].rfRxAFE = rOFDM0_XDRxAFE;
-
- hal_data->PHYRegDef[RF_PATH_A].rfTxIQImbalance = rOFDM0_XATxIQImbalance;
- hal_data->PHYRegDef[RF_PATH_B].rfTxIQImbalance = rOFDM0_XBTxIQImbalance;
- hal_data->PHYRegDef[RF_PATH_C].rfTxIQImbalance = rOFDM0_XCTxIQImbalance;
- hal_data->PHYRegDef[RF_PATH_D].rfTxIQImbalance = rOFDM0_XDTxIQImbalance;
-
- hal_data->PHYRegDef[RF_PATH_A].rfTxAFE = rOFDM0_XATxAFE;
- hal_data->PHYRegDef[RF_PATH_B].rfTxAFE = rOFDM0_XBTxAFE;
- hal_data->PHYRegDef[RF_PATH_C].rfTxAFE = rOFDM0_XCTxAFE;
- hal_data->PHYRegDef[RF_PATH_D].rfTxAFE = rOFDM0_XDTxAFE;
-
- hal_data->PHYRegDef[RF_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack;
- hal_data->PHYRegDef[RF_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack;
- hal_data->PHYRegDef[RF_PATH_C].rfLSSIReadBack = rFPGA0_XC_LSSIReadBack;
- hal_data->PHYRegDef[RF_PATH_D].rfLSSIReadBack = rFPGA0_XD_LSSIReadBack;
-
- hal_data->PHYRegDef[RF_PATH_A].rfLSSIReadBackPi = TransceiverA_HSPI_Readback;
- hal_data->PHYRegDef[RF_PATH_B].rfLSSIReadBackPi = TransceiverB_HSPI_Readback;
+ struct bb_reg_def *RegDef[4];
+
+ RegDef[RF_PATH_A] = &(hal_data->PHYRegDef[RF_PATH_A]);
+ RegDef[RF_PATH_B] = &(hal_data->PHYRegDef[RF_PATH_B]);
+ RegDef[RF_PATH_C] = &(hal_data->PHYRegDef[RF_PATH_C]);
+ RegDef[RF_PATH_D] = &(hal_data->PHYRegDef[RF_PATH_D]);
+
+ RegDef[RF_PATH_A]->rfintfs = rFPGA0_XAB_RFInterfaceSW;
+ RegDef[RF_PATH_B]->rfintfs = rFPGA0_XAB_RFInterfaceSW;
+ RegDef[RF_PATH_C]->rfintfs = rFPGA0_XCD_RFInterfaceSW;
+ RegDef[RF_PATH_D]->rfintfs = rFPGA0_XCD_RFInterfaceSW;
+
+ RegDef[RF_PATH_A]->rfintfi = rFPGA0_XAB_RFInterfaceRB;
+ RegDef[RF_PATH_B]->rfintfi = rFPGA0_XAB_RFInterfaceRB;
+ RegDef[RF_PATH_C]->rfintfi = rFPGA0_XCD_RFInterfaceRB;
+ RegDef[RF_PATH_D]->rfintfi = rFPGA0_XCD_RFInterfaceRB;
+
+ RegDef[RF_PATH_A]->rfintfo = rFPGA0_XA_RFInterfaceOE;
+ RegDef[RF_PATH_B]->rfintfo = rFPGA0_XB_RFInterfaceOE;
+
+ RegDef[RF_PATH_A]->rfintfe = rFPGA0_XA_RFInterfaceOE;
+ RegDef[RF_PATH_B]->rfintfe = rFPGA0_XB_RFInterfaceOE;
+
+ RegDef[RF_PATH_A]->rf3wireOffset = rFPGA0_XA_LSSIParameter;
+ RegDef[RF_PATH_B]->rf3wireOffset = rFPGA0_XB_LSSIParameter;
+
+ RegDef[RF_PATH_A]->rfLSSI_Select = rFPGA0_XAB_RFParameter;
+ RegDef[RF_PATH_B]->rfLSSI_Select = rFPGA0_XAB_RFParameter;
+ RegDef[RF_PATH_C]->rfLSSI_Select = rFPGA0_XCD_RFParameter;
+ RegDef[RF_PATH_D]->rfLSSI_Select = rFPGA0_XCD_RFParameter;
+
+ RegDef[RF_PATH_A]->rfTxGainStage = rFPGA0_TxGainStage;
+ RegDef[RF_PATH_B]->rfTxGainStage = rFPGA0_TxGainStage;
+ RegDef[RF_PATH_C]->rfTxGainStage = rFPGA0_TxGainStage;
+ RegDef[RF_PATH_D]->rfTxGainStage = rFPGA0_TxGainStage;
+
+ RegDef[RF_PATH_A]->rfHSSIPara1 = rFPGA0_XA_HSSIParameter1;
+ RegDef[RF_PATH_B]->rfHSSIPara1 = rFPGA0_XB_HSSIParameter1;
+
+ RegDef[RF_PATH_A]->rfHSSIPara2 = rFPGA0_XA_HSSIParameter2;
+ RegDef[RF_PATH_B]->rfHSSIPara2 = rFPGA0_XB_HSSIParameter2;
+
+ RegDef[RF_PATH_A]->rfSwitchControl = rFPGA0_XAB_SwitchControl;
+ RegDef[RF_PATH_B]->rfSwitchControl = rFPGA0_XAB_SwitchControl;
+ RegDef[RF_PATH_C]->rfSwitchControl = rFPGA0_XCD_SwitchControl;
+ RegDef[RF_PATH_D]->rfSwitchControl = rFPGA0_XCD_SwitchControl;
+
+ RegDef[RF_PATH_A]->rfAGCControl1 = rOFDM0_XAAGCCore1;
+ RegDef[RF_PATH_B]->rfAGCControl1 = rOFDM0_XBAGCCore1;
+ RegDef[RF_PATH_C]->rfAGCControl1 = rOFDM0_XCAGCCore1;
+ RegDef[RF_PATH_D]->rfAGCControl1 = rOFDM0_XDAGCCore1;
+
+ RegDef[RF_PATH_A]->rfAGCControl2 = rOFDM0_XAAGCCore2;
+ RegDef[RF_PATH_B]->rfAGCControl2 = rOFDM0_XBAGCCore2;
+ RegDef[RF_PATH_C]->rfAGCControl2 = rOFDM0_XCAGCCore2;
+ RegDef[RF_PATH_D]->rfAGCControl2 = rOFDM0_XDAGCCore2;
+
+ RegDef[RF_PATH_A]->rfRxIQImbalance = rOFDM0_XARxIQImbalance;
+ RegDef[RF_PATH_B]->rfRxIQImbalance = rOFDM0_XBRxIQImbalance;
+ RegDef[RF_PATH_C]->rfRxIQImbalance = rOFDM0_XCRxIQImbalance;
+ RegDef[RF_PATH_D]->rfRxIQImbalance = rOFDM0_XDRxIQImbalance;
+
+ RegDef[RF_PATH_A]->rfRxAFE = rOFDM0_XARxAFE;
+ RegDef[RF_PATH_B]->rfRxAFE = rOFDM0_XBRxAFE;
+ RegDef[RF_PATH_C]->rfRxAFE = rOFDM0_XCRxAFE;
+ RegDef[RF_PATH_D]->rfRxAFE = rOFDM0_XDRxAFE;
+
+ RegDef[RF_PATH_A]->rfTxIQImbalance = rOFDM0_XATxIQImbalance;
+ RegDef[RF_PATH_B]->rfTxIQImbalance = rOFDM0_XBTxIQImbalance;
+ RegDef[RF_PATH_C]->rfTxIQImbalance = rOFDM0_XCTxIQImbalance;
+ RegDef[RF_PATH_D]->rfTxIQImbalance = rOFDM0_XDTxIQImbalance;
+
+ RegDef[RF_PATH_A]->rfTxAFE = rOFDM0_XATxAFE;
+ RegDef[RF_PATH_B]->rfTxAFE = rOFDM0_XBTxAFE;
+ RegDef[RF_PATH_C]->rfTxAFE = rOFDM0_XCTxAFE;
+ RegDef[RF_PATH_D]->rfTxAFE = rOFDM0_XDTxAFE;
+
+ RegDef[RF_PATH_A]->rfLSSIReadBack = rFPGA0_XA_LSSIReadBack;
+ RegDef[RF_PATH_B]->rfLSSIReadBack = rFPGA0_XB_LSSIReadBack;
+ RegDef[RF_PATH_C]->rfLSSIReadBack = rFPGA0_XC_LSSIReadBack;
+ RegDef[RF_PATH_D]->rfLSSIReadBack = rFPGA0_XD_LSSIReadBack;
+
+ RegDef[RF_PATH_A]->rfLSSIReadBackPi = TransceiverA_HSPI_Readback;
+ RegDef[RF_PATH_B]->rfLSSIReadBackPi = TransceiverB_HSPI_Readback;
}
static bool config_parafile(struct adapter *adapt)
--
1.9.1
next reply other threads:[~2015-03-24 19:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-24 19:49 Vatika Harlalka [this message]
2015-03-25 11:17 ` [Outreachy kernel] [PATCH] Staging: rtl8188eu: Add new variable to make code compact Greg KH
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=20150324194901.GA6284@akanksha \
--to=vatikaharlalka@gmail.com \
--cc=outreachy-kernel@googlegroups.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.