lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1428448137-26768-9-git-send-email-mateusz.kulikowski@gmail.com>
Date:	Wed,  8 Apr 2015 01:08:57 +0200
From:	Mateusz Kulikowski <mateusz.kulikowski@...il.com>
To:	gregkh@...uxfoundation.org
Cc:	Mateusz Kulikowski <mateusz.kulikowski@...il.com>,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH 8/8] 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 <mateusz.kulikowski@...il.com>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 176 +++++++++++++++--------------
 1 file changed, 93 insertions(+), 83 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
index 9de5846..66baed80 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);
@@ -673,90 +764,9 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
 				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]);
-
-				}
+				dm_tx_update_tssi_weak_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]);
-				}
+				dm_tx_update_tssi_strong_signal(dev, RF_Type);
 			}
 			if (RF_Type == RF_2T4R) {
 				priv->CCKPresentAttentuation_difference
-- 
1.8.4.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

Powered by Openwall GNU/*/Linux Powered by OpenVZ