From eae10b8ea5c08115d0eccd8adc89794c5a41727a Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Mon, 13 Apr 2015 23:47:31 +0200 Subject: [PATCH] staging: rtl8192e: Fix DEEP_INDENTATION warnings in rtl_dm.c Separate parts of dm_TXPowerTrackingCallback_TSSI() into two new functions: - dm_tx_update_tssi_weak_signal() - dm_tx_update_tssi_strong_signal() Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 180 +++++++++++---------- 1 file changed, 95 insertions(+), 85 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 9de584639c56..ba69157a86b4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -542,6 +542,97 @@ static u8 CCKSwingTable_Ch14[CCK_Table_length][8] = { #define Tssi_Report_Value2 0x13e #define FW_Busy_Flag 0x13f +static void dm_tx_update_tssi_weak_signal(struct net_device *dev, u8 RF_Type) +{ + struct r8192_priv *p = rtllib_priv(dev); + + if (RF_Type == RF_2T4R) { + if ((p->rfa_txpowertrackingindex > 0) && + (p->rfc_txpowertrackingindex > 0)) { + p->rfa_txpowertrackingindex--; + if (p->rfa_txpowertrackingindex_real > 4) { + p->rfa_txpowertrackingindex_real--; + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); + } + + p->rfc_txpowertrackingindex--; + if (p->rfc_txpowertrackingindex_real > 4) { + p->rfc_txpowertrackingindex_real--; + rtl8192_setBBreg(dev, + rOFDM0_XCTxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[p->rfc_txpowertrackingindex_real]); + } + } else { + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[4]); + rtl8192_setBBreg(dev, + rOFDM0_XCTxIQImbalance, + bMaskDWord, dm_tx_bb_gain[4]); + } + } else { + if (p->rfa_txpowertrackingindex > 0) { + p->rfa_txpowertrackingindex--; + if (p->rfa_txpowertrackingindex_real > 4) { + p->rfa_txpowertrackingindex_real--; + rtl8192_setBBreg(dev, + rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); + } + } else { + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, dm_tx_bb_gain[4]); + } + } +} + +static void dm_tx_update_tssi_strong_signal(struct net_device *dev, u8 RF_Type) +{ + struct r8192_priv *p = rtllib_priv(dev); + + if (RF_Type == RF_2T4R) { + if ((p->rfa_txpowertrackingindex < TxBBGainTableLength - 1) && + (p->rfc_txpowertrackingindex < TxBBGainTableLength - 1)) { + p->rfa_txpowertrackingindex++; + p->rfa_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, + rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); + p->rfc_txpowertrackingindex++; + p->rfc_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, + rOFDM0_XCTxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[p->rfc_txpowertrackingindex_real]); + } else { + rtl8192_setBBreg(dev, + rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[TxBBGainTableLength - 1]); + rtl8192_setBBreg(dev, rOFDM0_XCTxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[TxBBGainTableLength - 1]); + } + } else { + if (p->rfa_txpowertrackingindex < (TxBBGainTableLength - 1)) { + p->rfa_txpowertrackingindex++; + p->rfa_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]); + } else { + rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, + bMaskDWord, + dm_tx_bb_gain[TxBBGainTableLength - 1]); + } + } +} + static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); @@ -672,92 +763,11 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) priv->CCKPresentAttentuation); return; } - if (Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) { - if (RF_Type == RF_2T4R) { - - if ((priv->rfa_txpowertrackingindex > 0) && - (priv->rfc_txpowertrackingindex > 0)) { - priv->rfa_txpowertrackingindex--; - if (priv->rfa_txpowertrackingindex_real > 4) { - priv->rfa_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[priv->rfa_txpowertrackingindex_real]); - } - - priv->rfc_txpowertrackingindex--; - if (priv->rfc_txpowertrackingindex_real > 4) { - priv->rfc_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[priv->rfc_txpowertrackingindex_real]); - } - } else { - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[4]); - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, dm_tx_bb_gain[4]); - } - } else { - if (priv->rfa_txpowertrackingindex > 0) { - priv->rfa_txpowertrackingindex--; - if (priv->rfa_txpowertrackingindex_real > 4) { - priv->rfa_txpowertrackingindex_real--; - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[priv->rfa_txpowertrackingindex_real]); - } - } else - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, dm_tx_bb_gain[4]); + if (Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) + dm_tx_update_tssi_weak_signal(dev, RF_Type); + else + dm_tx_update_tssi_strong_signal(dev, RF_Type); - } - } else { - if (RF_Type == RF_2T4R) { - if ((priv->rfa_txpowertrackingindex < - TxBBGainTableLength - 1) && - (priv->rfc_txpowertrackingindex < - TxBBGainTableLength - 1)) { - priv->rfa_txpowertrackingindex++; - priv->rfa_txpowertrackingindex_real++; - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[priv->rfa_txpowertrackingindex_real]); - priv->rfc_txpowertrackingindex++; - priv->rfc_txpowertrackingindex_real++; - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[priv->rfc_txpowertrackingindex_real]); - } else { - rtl8192_setBBreg(dev, - rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[TxBBGainTableLength - 1]); - rtl8192_setBBreg(dev, - rOFDM0_XCTxIQImbalance, - bMaskDWord, dm_tx_bb_gain[TxBBGainTableLength - 1]); - } - } else { - if (priv->rfa_txpowertrackingindex < (TxBBGainTableLength - 1)) { - priv->rfa_txpowertrackingindex++; - priv->rfa_txpowertrackingindex_real++; - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[priv->rfa_txpowertrackingindex_real]); - } else - rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, - bMaskDWord, - dm_tx_bb_gain[TxBBGainTableLength - 1]); - } - } if (RF_Type == RF_2T4R) { priv->CCKPresentAttentuation_difference = priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default; -- 2.20.1