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: <1432223628-1664-23-git-send-email-mateusz.kulikowski@gmail.com>
Date:	Thu, 21 May 2015 17:53:35 +0200
From:	Mateusz Kulikowski <mateusz.kulikowski@...il.com>
To:	gregkh@...uxfoundation.org
Cc:	Mateusz Kulikowski <mateusz.kulikowski@...il.com>,
	dan.carpenter@...cle.com, joe@...ches.com,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH v4 22/35] staging: rtl8192e: Fix LONG_LINE warnings

Fix most of simple LONG_LINE warnings. None of the changes should affect
behaviour of code, so several modifications are included in this patch:
- Code is reindented where needed
- Local variable names are compacted (priv -> p)
- Unnecessary casts are removed
- Nested ifs are replaced with logical and
- a = b = c = d expressions are split
- Replace if/then series with clamp_t()
- Removed unneeded scopes

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@...il.com>
---
 drivers/staging/rtl8192e/dot11d.h                  |   4 +-
 drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c     |  22 +--
 .../staging/rtl8192e/rtl8192e/r8192E_firmware.c    |  29 ++--
 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c     |   4 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c       |   3 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c         | 191 +++++++++++++--------
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c         |   3 +-
 drivers/staging/rtl8192e/rtl819x_HTProc.c          |   3 +-
 drivers/staging/rtl8192e/rtl819x_TSProc.c          |  21 ++-
 drivers/staging/rtl8192e/rtllib_rx.c               | 171 +++++++++++-------
 drivers/staging/rtl8192e/rtllib_softmac.c          |  36 ++--
 drivers/staging/rtl8192e/rtllib_tx.c               |  41 ++---
 12 files changed, 314 insertions(+), 214 deletions(-)

diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h
index aad3394..69e0f8f 100644
--- a/drivers/staging/rtl8192e/dot11d.h
+++ b/drivers/staging/rtl8192e/dot11d.h
@@ -74,8 +74,8 @@ static inline void cpMacAddr(unsigned char *des, unsigned char *src)
 	(GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0)
 
 #define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa)		\
-	 ether_addr_equal_unaligned(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, \
-	__pTa)
+	 ether_addr_equal_unaligned( \
+		GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
 #define UPDATE_CIE_SRC(__pIeeeDev, __pTa)		\
 	cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
 
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 6966fd4..4bd8885 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -30,7 +30,8 @@
 #include "rtl_dm.h"
 #include "rtl_wx.h"
 
-static int WDCAPARA_ADD[] = {EDCAPARA_BE, EDCAPARA_BK, EDCAPARA_VI, EDCAPARA_VO};
+static int WDCAPARA_ADD[] = {EDCAPARA_BE, EDCAPARA_BK, EDCAPARA_VI,
+			     EDCAPARA_VO};
 
 void rtl8192e_start_beacon(struct net_device *dev)
 {
@@ -187,22 +188,21 @@ void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val)
 		u8		u1bAIFS;
 		u32		u4bAcParam;
 		u8 mode = priv->rtllib->mode;
-		struct rtllib_qos_parameters *qos_parameters =
+		struct rtllib_qos_parameters *qop =
 			 &priv->rtllib->current_network.qos_data.parameters;
 
-		u1bAIFS = qos_parameters->aifs[pAcParam] *
+		u1bAIFS = qop->aifs[pAcParam] *
 			  ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime;
 
 		dm_init_edca_turbo(dev);
 
-		u4bAcParam = (((le16_to_cpu(
-					qos_parameters->tx_op_limit[pAcParam])) <<
-			     AC_PARAM_TXOP_LIMIT_OFFSET) |
-			     ((le16_to_cpu(qos_parameters->cw_max[pAcParam])) <<
-			     AC_PARAM_ECW_MAX_OFFSET) |
-			     ((le16_to_cpu(qos_parameters->cw_min[pAcParam])) <<
-			     AC_PARAM_ECW_MIN_OFFSET) |
-			     (((u32)u1bAIFS) << AC_PARAM_AIFS_OFFSET));
+		u4bAcParam = (le16_to_cpu(qop->tx_op_limit[pAcParam]) <<
+			      AC_PARAM_TXOP_LIMIT_OFFSET) |
+				((le16_to_cpu(qop->cw_max[pAcParam])) <<
+				 AC_PARAM_ECW_MAX_OFFSET) |
+				((le16_to_cpu(qop->cw_min[pAcParam])) <<
+				 AC_PARAM_ECW_MIN_OFFSET) |
+				(((u32)u1bAIFS) << AC_PARAM_AIFS_OFFSET);
 
 		RT_TRACE(COMP_DBG, "%s():HW_VAR_AC_PARAM eACI:%x:%x\n",
 			 __func__, eACI, u4bAcParam);
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
index c465f87..02c5b0a 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
@@ -230,7 +230,7 @@ bool init_firmware(struct net_device *dev)
 
 	u32	file_length = 0;
 	u8	*mapped_file = NULL;
-	u8	init_step = 0;
+	u8	i = 0;
 	enum opt_rst_type rst_opt = OPT_SYSTEM_RESET;
 	enum firmware_init_step starting_state = FW_INIT_STEP0_BOOT;
 
@@ -250,10 +250,9 @@ bool init_firmware(struct net_device *dev)
 			 "PlatformInitFirmware: undefined firmware state\n");
 	}
 
-	for (init_step = starting_state; init_step <= FW_INIT_STEP2_DATA;
-	     init_step++) {
+	for (i = starting_state; i <= FW_INIT_STEP2_DATA; i++) {
 		if (rst_opt == OPT_SYSTEM_RESET) {
-			if (pfirmware->firmware_buf_size[init_step] == 0) {
+			if (pfirmware->firmware_buf_size[i] == 0) {
 				const char *fw_name[3] = {
 					RTL8192E_BOOT_IMG_FW,
 					RTL8192E_MAIN_IMG_FW,
@@ -263,7 +262,7 @@ bool init_firmware(struct net_device *dev)
 				int rc;
 
 				rc = request_firmware(&fw_entry,
-						      fw_name[init_step],
+						      fw_name[i],
 						      &priv->pdev->dev);
 				if (rc < 0) {
 					RT_TRACE(COMP_FIRMWARE,
@@ -271,24 +270,24 @@ bool init_firmware(struct net_device *dev)
 					goto download_firmware_fail;
 				}
 				if (fw_entry->size >
-				    sizeof(pfirmware->firmware_buf[init_step])) {
+				    sizeof(pfirmware->firmware_buf[i])) {
 					RT_TRACE(COMP_FIRMWARE,
 						 "img file size exceed the container struct buffer fail!\n");
 					goto download_firmware_fail;
 				}
 
-				if (init_step != FW_INIT_STEP1_MAIN) {
-					memcpy(pfirmware->firmware_buf[init_step],
+				if (i != FW_INIT_STEP1_MAIN) {
+					memcpy(pfirmware->firmware_buf[i],
 					       fw_entry->data, fw_entry->size);
-					pfirmware->firmware_buf_size[init_step] =
+					pfirmware->firmware_buf_size[i] =
 						fw_entry->size;
 
 				} else {
-					memset(pfirmware->firmware_buf[init_step],
+					memset(pfirmware->firmware_buf[i],
 					       0, 128);
-					memcpy(&pfirmware->firmware_buf[init_step][128],
+					memcpy(&pfirmware->firmware_buf[i][128],
 					       fw_entry->data, fw_entry->size);
-					pfirmware->firmware_buf_size[init_step] =
+					pfirmware->firmware_buf_size[i] =
 						fw_entry->size + 128;
 				}
 
@@ -297,14 +296,14 @@ bool init_firmware(struct net_device *dev)
 			}
 		}
 
-		mapped_file = pfirmware->firmware_buf[init_step];
-		file_length = pfirmware->firmware_buf_size[init_step];
+		mapped_file = pfirmware->firmware_buf[i];
+		file_length = pfirmware->firmware_buf_size[i];
 
 		rt_status = fw_download_code(dev, mapped_file, file_length);
 		if (!rt_status)
 			goto download_firmware_fail;
 
-		if (!firmware_check_ready(dev, init_step))
+		if (!firmware_check_ready(dev, i))
 			goto download_firmware_fail;
 	}
 
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index eea2e39..0765c97 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -628,8 +628,8 @@ void rtl8192_phy_getTxPower(struct net_device *dev)
 	priv->DefaultInitialGain[3] = read_nic_byte(dev, rOFDM0_XDAGCCore1);
 	RT_TRACE(COMP_INIT,
 		 "Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x)\n",
-		priv->DefaultInitialGain[0], priv->DefaultInitialGain[1],
-		priv->DefaultInitialGain[2], priv->DefaultInitialGain[3]);
+		 priv->DefaultInitialGain[0], priv->DefaultInitialGain[1],
+		 priv->DefaultInitialGain[2], priv->DefaultInitialGain[3]);
 
 	priv->framesync = read_nic_byte(dev, rOFDM0_RxDetector3);
 	priv->framesyncC34 = read_nic_dword(dev, rOFDM0_RxDetector2);
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 9d96565..f5240f5 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -2068,8 +2068,7 @@ static short rtl8192_alloc_rx_desc_ring(struct net_device *dev)
 	int i, rx_queue_idx;
 
 	for (rx_queue_idx = 0; rx_queue_idx < MAX_RX_QUEUE; rx_queue_idx++) {
-		priv->rx_ring[rx_queue_idx] =
-			pci_zalloc_consistent(priv->pdev,
+		priv->rx_ring[rx_queue_idx] = pci_zalloc_consistent(priv->pdev,
 					      sizeof(*priv->rx_ring[rx_queue_idx]) * priv->rxringcount,
 					      &priv->rx_ring_dma[rx_queue_idx]);
 		if (!priv->rx_ring[rx_queue_idx] ||
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
index ba69157..a921857 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
@@ -248,7 +248,8 @@ void init_hal_dm(struct net_device *dev)
 	if (IS_HARDWARE_TYPE_8192SE(dev))
 		dm_Init_WA_Broadcom_IOT(dev);
 
-	INIT_DELAYED_WORK_RSL(&priv->gpio_change_rf_wq, (void *)dm_CheckRfCtrlGPIO, dev);
+	INIT_DELAYED_WORK_RSL(&priv->gpio_change_rf_wq,
+			      (void *)dm_CheckRfCtrlGPIO, dev);
 }
 
 void deinit_hal_dm(struct net_device *dev)
@@ -288,8 +289,8 @@ void hal_dm_watchdog(struct net_device *dev)
 static void dm_check_ac_dc_power(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
-	static char *ac_dc_check_script_path = "/etc/acpi/wireless-rtl-ac-dc-power.sh";
-	char *argv[] = {ac_dc_check_script_path, DRV_NAME, NULL};
+	static char *ac_dc_script = "/etc/acpi/wireless-rtl-ac-dc-power.sh";
+	char *argv[] = {ac_dc_script, DRV_NAME, NULL};
 	static char *envp[] = {"HOME=/",
 			"TERM=linux",
 			"PATH=/usr/bin:/bin",
@@ -303,7 +304,7 @@ static void dm_check_ac_dc_power(struct net_device *dev)
 
 	if (priv->rtllib->state != RTLLIB_LINKED)
 		return;
-	call_usermodehelper(ac_dc_check_script_path, argv, envp, UMH_WAIT_PROC);
+	call_usermodehelper(ac_dc_script, argv, envp, UMH_WAIT_PROC);
 
 	return;
 };
@@ -313,7 +314,7 @@ void init_rate_adaptive(struct net_device *dev)
 {
 
 	struct r8192_priv *priv = rtllib_priv(dev);
-	struct rate_adaptive *pra = (struct rate_adaptive *)&priv->rate_adaptive;
+	struct rate_adaptive *pra = &priv->rate_adaptive;
 
 	pra->ratr_state = DM_RATR_STA_MAX;
 	pra->high2low_rssi_thresh_for_ra = RateAdaptiveTH_High;
@@ -354,14 +355,15 @@ static void dm_check_rate_adaptive(struct net_device *dev)
 {
 	struct r8192_priv *priv = rtllib_priv(dev);
 	struct rt_hi_throughput *pHTInfo = priv->rtllib->pHTInfo;
-	struct rate_adaptive *pra = (struct rate_adaptive *)&priv->rate_adaptive;
+	struct rate_adaptive *pra = &priv->rate_adaptive;
 	u32 currentRATR, targetRATR = 0;
 	u32 LowRSSIThreshForRA = 0, HighRSSIThreshForRA = 0;
 	bool bshort_gi_enabled = false;
 	static u8 ping_rssi_state;
 
 	if (!priv->up) {
-		RT_TRACE(COMP_RATE, "<---- dm_check_rate_adaptive(): driver is going to unload\n");
+		RT_TRACE(COMP_RATE,
+			 "<---- dm_check_rate_adaptive(): driver is going to unload\n");
 		return;
 	}
 
@@ -374,25 +376,31 @@ static void dm_check_rate_adaptive(struct net_device *dev)
 
 	if (priv->rtllib->state == RTLLIB_LINKED) {
 
-		bshort_gi_enabled = (pHTInfo->bCurTxBW40MHz && pHTInfo->bCurShortGI40MHz) ||
-			(!pHTInfo->bCurTxBW40MHz && pHTInfo->bCurShortGI20MHz);
-
+		bshort_gi_enabled = (pHTInfo->bCurTxBW40MHz &&
+				     pHTInfo->bCurShortGI40MHz) ||
+				    (!pHTInfo->bCurTxBW40MHz &&
+				     pHTInfo->bCurShortGI20MHz);
 
 		pra->upper_rssi_threshold_ratr =
-				(pra->upper_rssi_threshold_ratr & (~BIT31)) | ((bshort_gi_enabled) ? BIT31 : 0);
+				(pra->upper_rssi_threshold_ratr & (~BIT31)) |
+				((bshort_gi_enabled) ? BIT31 : 0);
 
 		pra->middle_rssi_threshold_ratr =
-				(pra->middle_rssi_threshold_ratr & (~BIT31)) | ((bshort_gi_enabled) ? BIT31 : 0);
+				(pra->middle_rssi_threshold_ratr & (~BIT31)) |
+				((bshort_gi_enabled) ? BIT31 : 0);
 
 		if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) {
 			pra->low_rssi_threshold_ratr =
-				(pra->low_rssi_threshold_ratr_40M & (~BIT31)) | ((bshort_gi_enabled) ? BIT31 : 0);
+				(pra->low_rssi_threshold_ratr_40M & (~BIT31)) |
+				((bshort_gi_enabled) ? BIT31 : 0);
 		} else {
 			pra->low_rssi_threshold_ratr =
-			(pra->low_rssi_threshold_ratr_20M & (~BIT31)) | ((bshort_gi_enabled) ? BIT31 : 0);
+				(pra->low_rssi_threshold_ratr_20M & (~BIT31)) |
+				((bshort_gi_enabled) ? BIT31 : 0);
 		}
 		pra->ping_rssi_ratr =
-				(pra->ping_rssi_ratr & (~BIT31)) | ((bshort_gi_enabled) ? BIT31 : 0);
+				(pra->ping_rssi_ratr & (~BIT31)) |
+				((bshort_gi_enabled) ? BIT31 : 0);
 
 		if (pra->ratr_state == DM_RATR_STA_HIGH) {
 			HighRSSIThreshForRA	= pra->high2low_rssi_thresh_for_ra;
@@ -408,10 +416,12 @@ static void dm_check_rate_adaptive(struct net_device *dev)
 					(pra->low_rssi_thresh_for_ra40M) : (pra->low_rssi_thresh_for_ra20M);
 		}
 
-		if (priv->undecorated_smoothed_pwdb >= (long)HighRSSIThreshForRA) {
+		if (priv->undecorated_smoothed_pwdb >=
+		    (long)HighRSSIThreshForRA) {
 			pra->ratr_state = DM_RATR_STA_HIGH;
 			targetRATR = pra->upper_rssi_threshold_ratr;
-		} else if (priv->undecorated_smoothed_pwdb >= (long)LowRSSIThreshForRA) {
+		} else if (priv->undecorated_smoothed_pwdb >=
+			   (long)LowRSSIThreshForRA) {
 			pra->ratr_state = DM_RATR_STA_MIDDLE;
 			targetRATR = pra->middle_rssi_threshold_ratr;
 		} else {
@@ -420,8 +430,10 @@ static void dm_check_rate_adaptive(struct net_device *dev)
 		}
 
 		if (pra->ping_rssi_enable) {
-			if (priv->undecorated_smoothed_pwdb < (long)(pra->ping_rssi_thresh_for_ra+5)) {
-				if ((priv->undecorated_smoothed_pwdb < (long)pra->ping_rssi_thresh_for_ra) ||
+			if (priv->undecorated_smoothed_pwdb <
+			    (long)(pra->ping_rssi_thresh_for_ra+5)) {
+				if ((priv->undecorated_smoothed_pwdb <
+				     (long)pra->ping_rssi_thresh_for_ra) ||
 				    ping_rssi_state) {
 					pra->ratr_state = DM_RATR_STA_LOW;
 					targetRATR = pra->ping_rssi_ratr;
@@ -722,7 +734,8 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
 			if (viviflag) {
 				write_nic_byte(dev, Pw_Track_Flag, 0);
 				viviflag = false;
-				RT_TRACE(COMP_POWER_TRACKING, "we filted this data\n");
+				RT_TRACE(COMP_POWER_TRACKING,
+					 "we filted this data\n");
 				for (k = 0; k < 5; k++)
 					tmp_report[k] = 0;
 				break;
@@ -731,7 +744,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
 			for (k = 0; k < 5; k++)
 				Avg_TSSI_Meas_from_driver += tmp_report[k];
 
-			Avg_TSSI_Meas_from_driver = Avg_TSSI_Meas_from_driver*100/5;
+			Avg_TSSI_Meas_from_driver *= 100 / 5;
 			RT_TRACE(COMP_POWER_TRACKING,
 				 "Avg_TSSI_Meas_from_driver = %d\n",
 				 Avg_TSSI_Meas_from_driver);
@@ -844,12 +857,15 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
 	int i = 0, CCKSwingNeedUpdate = 0;
 
 	if (!priv->btxpower_trackingInit) {
-		tmpRegA = rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, bMaskDWord);
+		tmpRegA = rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance,
+					     bMaskDWord);
 		for (i = 0; i < OFDM_Table_Length; i++) {
 			if (tmpRegA == OFDMSwingTable[i]) {
 				priv->OFDM_index[0] = (u8)i;
-				RT_TRACE(COMP_POWER_TRACKING, "Initial reg0x%x = 0x%x, OFDM_index = 0x%x\n",
-					rOFDM0_XATxIQImbalance, tmpRegA, priv->OFDM_index[0]);
+				RT_TRACE(COMP_POWER_TRACKING,
+					 "Initial reg0x%x = 0x%x, OFDM_index = 0x%x\n",
+					 rOFDM0_XATxIQImbalance, tmpRegA,
+					 priv->OFDM_index[0]);
 			}
 		}
 
@@ -997,7 +1013,8 @@ static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev)
 
 
 	 if (tx_power_track_counter >= 180) {
-		queue_delayed_work_rsl(priv->priv_wq, &priv->txpower_tracking_wq, 0);
+		queue_delayed_work_rsl(priv->priv_wq,
+				       &priv->txpower_tracking_wq, 0);
 		tx_power_track_counter = 0;
 	}
 
@@ -1084,53 +1101,57 @@ static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool  bInCH14)
 	}
 }
 
-static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev,	bool  bInCH14)
+static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev,
+					     bool bInCH14)
 {
 	u32 TempVal;
 	struct r8192_priv *priv = rtllib_priv(dev);
 
 	TempVal = 0;
 	if (!bInCH14) {
-		TempVal =	CCKSwingTable_Ch1_Ch13[priv->CCK_index][0] +
-					(CCKSwingTable_Ch1_Ch13[priv->CCK_index][1]<<8);
+		TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][0] +
+			  (CCKSwingTable_Ch1_Ch13[priv->CCK_index][1] << 8);
 		rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal);
-		RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n",
-			rCCK0_TxFilter1, TempVal);
-		TempVal =	CCKSwingTable_Ch1_Ch13[priv->CCK_index][2] +
-					(CCKSwingTable_Ch1_Ch13[priv->CCK_index][3]<<8) +
-					(CCKSwingTable_Ch1_Ch13[priv->CCK_index][4]<<16)+
-					(CCKSwingTable_Ch1_Ch13[priv->CCK_index][5]<<24);
+		RT_TRACE(COMP_POWER_TRACKING,
+			 "CCK not chnl 14, reg 0x%x = 0x%x\n", rCCK0_TxFilter1,
+			 TempVal);
+		TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][2] +
+			  (CCKSwingTable_Ch1_Ch13[priv->CCK_index][3] << 8) +
+			  (CCKSwingTable_Ch1_Ch13[priv->CCK_index][4] << 16)+
+			  (CCKSwingTable_Ch1_Ch13[priv->CCK_index][5] << 24);
 		rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal);
-		RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n",
-			rCCK0_TxFilter2, TempVal);
-		TempVal =	CCKSwingTable_Ch1_Ch13[priv->CCK_index][6] +
-					(CCKSwingTable_Ch1_Ch13[priv->CCK_index][7]<<8);
+		RT_TRACE(COMP_POWER_TRACKING,
+			 "CCK not chnl 14, reg 0x%x = 0x%x\n", rCCK0_TxFilter2,
+			 TempVal);
+		TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][6] +
+			  (CCKSwingTable_Ch1_Ch13[priv->CCK_index][7] << 8);
 
 		rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal);
-		RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n",
-			rCCK0_DebugPort, TempVal);
+		RT_TRACE(COMP_POWER_TRACKING,
+			 "CCK not chnl 14, reg 0x%x = 0x%x\n", rCCK0_DebugPort,
+			 TempVal);
 	} else {
-		TempVal =	CCKSwingTable_Ch14[priv->CCK_index][0] +
-					(CCKSwingTable_Ch14[priv->CCK_index][1]<<8);
+		TempVal = CCKSwingTable_Ch14[priv->CCK_index][0] +
+			  (CCKSwingTable_Ch14[priv->CCK_index][1] << 8);
 
 		rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal);
 		RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n",
 			rCCK0_TxFilter1, TempVal);
-		TempVal =	CCKSwingTable_Ch14[priv->CCK_index][2] +
-					(CCKSwingTable_Ch14[priv->CCK_index][3]<<8) +
-					(CCKSwingTable_Ch14[priv->CCK_index][4]<<16)+
-					(CCKSwingTable_Ch14[priv->CCK_index][5]<<24);
+		TempVal = CCKSwingTable_Ch14[priv->CCK_index][2] +
+			  (CCKSwingTable_Ch14[priv->CCK_index][3] << 8) +
+			  (CCKSwingTable_Ch14[priv->CCK_index][4] << 16)+
+			  (CCKSwingTable_Ch14[priv->CCK_index][5] << 24);
 		rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal);
 		RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n",
 			rCCK0_TxFilter2, TempVal);
-		TempVal =	CCKSwingTable_Ch14[priv->CCK_index][6] +
-					(CCKSwingTable_Ch14[priv->CCK_index][7]<<8);
+		TempVal = CCKSwingTable_Ch14[priv->CCK_index][6] +
+			  (CCKSwingTable_Ch14[priv->CCK_index][7]<<8);
 
 		rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal);
 		RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n",
 			rCCK0_DebugPort, TempVal);
 	}
-	}
+}
 
 void dm_cck_txpower_adjust(struct net_device *dev, bool  binch14)
 {
@@ -1181,7 +1202,8 @@ void dm_restore_dynamic_mechanism_state(struct net_device *dev)
 	u32 ratr_value;
 
 	if (!priv->up) {
-		RT_TRACE(COMP_RATE, "<---- dm_restore_dynamic_mechanism_state(): driver is going to unload\n");
+		RT_TRACE(COMP_RATE,
+			 "<---- dm_restore_dynamic_mechanism_state(): driver is going to unload\n");
 		return;
 	}
 
@@ -1325,8 +1347,10 @@ static void dm_dig_init(struct net_device *dev)
 
 	dm_digtable.dig_state		= DM_STA_DIG_MAX;
 	dm_digtable.dig_highpwr_state	= DM_STA_DIG_MAX;
-	dm_digtable.CurSTAConnectState = dm_digtable.PreSTAConnectState = DIG_STA_DISCONNECT;
-	dm_digtable.CurAPConnectState = dm_digtable.PreAPConnectState = DIG_AP_DISCONNECT;
+	dm_digtable.CurSTAConnectState = DIG_STA_DISCONNECT;
+	dm_digtable.PreSTAConnectState = DIG_STA_DISCONNECT;
+	dm_digtable.CurAPConnectState = DIG_AP_DISCONNECT;
+	dm_digtable.PreAPConnectState = DIG_AP_DISCONNECT;
 	dm_digtable.initialgain_lowerbound_state = false;
 
 	dm_digtable.rssi_low_thresh	= DM_DIG_THRESH_LOW;
@@ -1512,11 +1536,14 @@ static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev)
 	struct r8192_priv *priv = rtllib_priv(dev);
 	static u32 reset_cnt_highpwr;
 
-	if ((priv->undecorated_smoothed_pwdb > dm_digtable.rssi_high_power_lowthresh) &&
-		(priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_highthresh))
+	if ((priv->undecorated_smoothed_pwdb >
+	     dm_digtable.rssi_high_power_lowthresh) &&
+	    (priv->undecorated_smoothed_pwdb <
+	     dm_digtable.rssi_high_power_highthresh))
 		return;
 
-	if (priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_power_highthresh) {
+	if (priv->undecorated_smoothed_pwdb >=
+	    dm_digtable.rssi_high_power_highthresh) {
 		if (dm_digtable.dig_highpwr_state == DM_STA_DIG_ON &&
 			(priv->reset_count == reset_cnt_highpwr))
 			return;
@@ -1532,8 +1559,10 @@ static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev)
 			return;
 		dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF;
 
-		if (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_lowthresh &&
-			 priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh) {
+		if ((priv->undecorated_smoothed_pwdb <
+		     dm_digtable.rssi_high_power_lowthresh) &&
+		    (priv->undecorated_smoothed_pwdb >=
+		    dm_digtable.rssi_high_thresh)) {
 			if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
 				write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20);
 			else
@@ -1562,12 +1591,12 @@ static void dm_initial_gain(struct net_device *dev)
 
 	if (dm_digtable.PreSTAConnectState == dm_digtable.CurSTAConnectState) {
 		if (dm_digtable.CurSTAConnectState == DIG_STA_CONNECT) {
-			if ((dm_digtable.rssi_val+10-dm_digtable.backoff_val) > dm_digtable.rx_gain_range_max)
-				dm_digtable.cur_ig_value = dm_digtable.rx_gain_range_max;
-			else if ((dm_digtable.rssi_val+10-dm_digtable.backoff_val) < dm_digtable.rx_gain_range_min)
-				dm_digtable.cur_ig_value = dm_digtable.rx_gain_range_min;
-			else
-				dm_digtable.cur_ig_value = dm_digtable.rssi_val+10-dm_digtable.backoff_val;
+			long gain_range = dm_digtable.rssi_val + 10 -
+					  dm_digtable.backoff_val;
+			gain_range = clamp_t(long, gain_range,
+					     dm_digtable.rx_gain_range_min,
+					     dm_digtable.rx_gain_range_max);
+			dm_digtable.cur_ig_value = gain_range;
 		} else {
 			if (dm_digtable.cur_ig_value == 0)
 				dm_digtable.cur_ig_value = priv->DefaultInitialGain[0];
@@ -1613,15 +1642,23 @@ static void dm_pd_th(struct net_device *dev)
 
 	if (dm_digtable.PreSTAConnectState == dm_digtable.CurSTAConnectState) {
 		if (dm_digtable.CurSTAConnectState == DIG_STA_CONNECT) {
-			if (dm_digtable.rssi_val >= dm_digtable.rssi_high_power_highthresh)
-				dm_digtable.curpd_thstate = DIG_PD_AT_HIGH_POWER;
-			else if (dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh)
-				dm_digtable.curpd_thstate = DIG_PD_AT_LOW_POWER;
-			else if ((dm_digtable.rssi_val >= dm_digtable.rssi_high_thresh) &&
-					(dm_digtable.rssi_val < dm_digtable.rssi_high_power_lowthresh))
-				dm_digtable.curpd_thstate = DIG_PD_AT_NORMAL_POWER;
+			if (dm_digtable.rssi_val >=
+			    dm_digtable.rssi_high_power_highthresh)
+				dm_digtable.curpd_thstate =
+							DIG_PD_AT_HIGH_POWER;
+			else if (dm_digtable.rssi_val <=
+				 dm_digtable.rssi_low_thresh)
+				dm_digtable.curpd_thstate =
+							DIG_PD_AT_LOW_POWER;
+			else if ((dm_digtable.rssi_val >=
+				  dm_digtable.rssi_high_thresh) &&
+				 (dm_digtable.rssi_val <
+				  dm_digtable.rssi_high_power_lowthresh))
+				dm_digtable.curpd_thstate =
+							DIG_PD_AT_NORMAL_POWER;
 			else
-				dm_digtable.curpd_thstate = dm_digtable.prepd_thstate;
+				dm_digtable.curpd_thstate =
+						dm_digtable.prepd_thstate;
 		} else {
 			dm_digtable.curpd_thstate = DIG_PD_AT_LOW_POWER;
 		}
@@ -1641,7 +1678,8 @@ static void dm_pd_th(struct net_device *dev)
 				write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00);
 			else
 				write_nic_byte(dev, rOFDM0_RxDetector1, 0x42);
-		} else if (dm_digtable.curpd_thstate == DIG_PD_AT_NORMAL_POWER) {
+		} else if (dm_digtable.curpd_thstate ==
+			   DIG_PD_AT_NORMAL_POWER) {
 			if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
 				write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20);
 			else
@@ -1796,7 +1834,8 @@ static void dm_check_edca_turbo(struct net_device *dev)
 		 if (priv->bcurrent_turbo_EDCA) {
 			u8 tmp = AC0_BE;
 
-			priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, (u8 *)(&tmp));
+			priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM,
+						      (u8 *)(&tmp));
 			priv->bcurrent_turbo_EDCA = false;
 		}
 	}
@@ -1866,7 +1905,8 @@ void dm_CheckRfCtrlGPIO(void *data)
 	bool bActuallySet = false;
 	char *argv[3];
 	static char *RadioPowerPath = "/etc/acpi/events/RadioPower.sh";
-	static char *envp[] = {"HOME=/", "TERM=linux", "PATH=/usr/bin:/bin", NULL};
+	static char *envp[] = {"HOME=/", "TERM=linux", "PATH=/usr/bin:/bin",
+			       NULL};
 
 	bActuallySet = false;
 
@@ -1897,7 +1937,8 @@ void dm_CheckRfCtrlGPIO(void *data)
 	if (bActuallySet) {
 		mdelay(1000);
 		priv->bHwRfOffAction = 1;
-		MgntActSet_RF_State(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW, true);
+		MgntActSet_RF_State(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW,
+				    true);
 		if (priv->bHwRadioOff)
 			argv[1] = "RFOFF";
 		else
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index 76b8b7c..c750c39 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -613,7 +613,8 @@ static int r8192_wx_set_nick(struct net_device *dev,
 	if (wrqu->data.length > IW_ESSID_MAX_SIZE)
 		return -E2BIG;
 	down(&priv->wx_sem);
-	wrqu->data.length = min_t(size_t, wrqu->data.length, sizeof(priv->nick));
+	wrqu->data.length = min_t(size_t, wrqu->data.length,
+				  sizeof(priv->nick));
 	memset(priv->nick, 0, sizeof(priv->nick));
 	memcpy(priv->nick, extra, wrqu->data.length);
 	up(&priv->wx_sem);
diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c
index 3edd5d1..dcf8db1 100644
--- a/drivers/staging/rtl8192e/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c
@@ -236,7 +236,8 @@ static bool HTIOTActIsDisableMCSTwoSpatialStream(struct rtllib_device *ieee)
 	return false;
 }
 
-static u8 HTIOTActIsDisableEDCATurbo(struct rtllib_device *ieee, u8 *PeerMacAddr)
+static u8 HTIOTActIsDisableEDCATurbo(struct rtllib_device *ieee,
+				     u8 *PeerMacAddr)
 {
 	return false;
 }
diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c
index dea86ea..8a5dd6e 100644
--- a/drivers/staging/rtl8192e/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c
@@ -49,8 +49,10 @@ static void RxPktPendingTimeout(unsigned long data)
 			if (index == 0)
 				pRxTs->RxIndicateSeq = pReorderEntry->SeqNum;
 
-			if (SN_LESS(pReorderEntry->SeqNum, pRxTs->RxIndicateSeq) ||
-				SN_EQUAL(pReorderEntry->SeqNum, pRxTs->RxIndicateSeq)) {
+			if (SN_LESS(pReorderEntry->SeqNum,
+				    pRxTs->RxIndicateSeq) ||
+			    SN_EQUAL(pReorderEntry->SeqNum,
+				     pRxTs->RxIndicateSeq)) {
 				list_del_init(&pReorderEntry->List);
 
 				if (SN_EQUAL(pReorderEntry->SeqNum,
@@ -92,7 +94,8 @@ static void RxPktPendingTimeout(unsigned long data)
 	if (bPktInBuf && (pRxTs->RxTimeoutIndicateSeq == 0xffff)) {
 		pRxTs->RxTimeoutIndicateSeq = pRxTs->RxIndicateSeq;
 		mod_timer(&pRxTs->RxPktPendingTimer,  jiffies +
-			  msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime));
+			  msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime)
+			  );
 	}
 	spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags);
 }
@@ -269,10 +272,10 @@ static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee,
 		if (!search_dir[dir])
 			continue;
 		list_for_each_entry(pRet, psearch_list, List) {
-			if (memcmp(pRet->Addr, Addr, 6) == 0)
-				if (pRet->TSpec.f.TSInfo.field.ucTSID == TID)
-					if (pRet->TSpec.f.TSInfo.field.ucDirection == dir)
-						break;
+			if (memcmp(pRet->Addr, Addr, 6) == 0 &&
+			    pRet->TSpec.f.TSInfo.field.ucTSID == TID &&
+			    pRet->TSpec.f.TSInfo.field.ucDirection == dir)
+				break;
 
 		}
 		if (&pRet->List  != psearch_list)
@@ -415,8 +418,8 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,
 	return false;
 }
 
-static void RemoveTsEntry(struct rtllib_device *ieee, struct ts_common_info *pTs,
-			  enum tr_select TxRxSelect)
+static void RemoveTsEntry(struct rtllib_device *ieee,
+			  struct ts_common_info *pTs, enum tr_select TxRxSelect)
 {
 	del_timer_sync(&pTs->SetupTimer);
 	del_timer_sync(&pTs->InactTimer);
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 3c9d80c..c888f2d 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -45,8 +45,9 @@
 #include "dot11d.h"
 
 static inline void rtllib_monitor_rx(struct rtllib_device *ieee,
-				struct sk_buff *skb, struct rtllib_rx_stats *rx_status,
-				size_t hdr_length)
+				     struct sk_buff *skb,
+				     struct rtllib_rx_stats *rx_status,
+				     size_t hdr_length)
 {
 	skb->dev = ieee->dev;
 	skb_reset_mac_header(skb);
@@ -101,7 +102,8 @@ rtllib_frag_cache_get(struct rtllib_device *ieee,
 	struct rtllib_hdr_4addrqos *hdr_4addrqos;
 	u8 tid;
 
-	if (((fc & RTLLIB_FCTL_DSTODS) == RTLLIB_FCTL_DSTODS) && RTLLIB_QOS_HAS_SEQ(fc)) {
+	if (((fc & RTLLIB_FCTL_DSTODS) == RTLLIB_FCTL_DSTODS) &&
+	    RTLLIB_QOS_HAS_SEQ(fc)) {
 		hdr_4addrqos = (struct rtllib_hdr_4addrqos *)hdr;
 		tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & RTLLIB_QCTL_TID;
 		tid = UP2AC(tid);
@@ -123,7 +125,8 @@ rtllib_frag_cache_get(struct rtllib_device *ieee,
 				    2 /* alignment */ +
 				    8 /* WEP */ +
 				    ETH_ALEN /* WDS */ +
-				    (RTLLIB_QOS_HAS_SEQ(fc) ? 2 : 0) /* QOS Control */);
+				    /* QOS Control */
+				    (RTLLIB_QOS_HAS_SEQ(fc) ? 2 : 0));
 		if (skb == NULL)
 			return NULL;
 
@@ -169,7 +172,8 @@ static int rtllib_frag_cache_invalidate(struct rtllib_device *ieee,
 	struct rtllib_hdr_4addrqos *hdr_4addrqos;
 	u8 tid;
 
-	if (((fc & RTLLIB_FCTL_DSTODS) == RTLLIB_FCTL_DSTODS) && RTLLIB_QOS_HAS_SEQ(fc)) {
+	if (((fc & RTLLIB_FCTL_DSTODS) == RTLLIB_FCTL_DSTODS) &&
+	    RTLLIB_QOS_HAS_SEQ(fc)) {
 		hdr_4addrqos = (struct rtllib_hdr_4addrqos *)hdr;
 		tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & RTLLIB_QCTL_TID;
 		tid = UP2AC(tid);
@@ -291,7 +295,8 @@ rtllib_rx_frame_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
 		return 0;
 
 	if (ieee->hwsec_active) {
-		struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
+		struct cb_desc *tcb_desc = (struct cb_desc *)
+						(skb->cb + MAX_DEV_ADDR_SIZE);
 
 		tcb_desc->bHwSec = 1;
 
@@ -331,7 +336,8 @@ rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb,
 	if (crypt == NULL || crypt->ops->decrypt_msdu == NULL)
 		return 0;
 	if (ieee->hwsec_active) {
-		struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
+		struct cb_desc *tcb_desc = (struct cb_desc *)
+						(skb->cb + MAX_DEV_ADDR_SIZE);
 
 		tcb_desc->bHwSec = 1;
 
@@ -371,7 +377,8 @@ static int is_duplicate_packet(struct rtllib_device *ieee,
 	struct rtllib_hdr_4addrqos *hdr_4addrqos;
 	u8 tid;
 
-	if (((fc & RTLLIB_FCTL_DSTODS) == RTLLIB_FCTL_DSTODS) && RTLLIB_QOS_HAS_SEQ(fc)) {
+	if (((fc & RTLLIB_FCTL_DSTODS) == RTLLIB_FCTL_DSTODS) &&
+	    RTLLIB_QOS_HAS_SEQ(fc)) {
 		hdr_4addrqos = (struct rtllib_hdr_4addrqos *)header;
 		tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & RTLLIB_QCTL_TID;
 		tid = UP2AC(tid);
@@ -399,7 +406,8 @@ static int is_duplicate_packet(struct rtllib_device *ieee,
 				break;
 		}
 		if (p == &ieee->ibss_mac_hash[index]) {
-			entry = kmalloc(sizeof(struct ieee_ibss_seq), GFP_ATOMIC);
+			entry = kmalloc(sizeof(struct ieee_ibss_seq),
+					GFP_ATOMIC);
 			if (!entry)
 				return 0;
 
@@ -469,7 +477,8 @@ static bool AddReorderEntry(struct rx_ts_record *pTS,
 	return true;
 }
 
-void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prxbIndicateArray, u8 index)
+void rtllib_indicate_packets(struct rtllib_device *ieee,
+			     struct rtllib_rxb **prxbIndicateArray, u8 index)
 {
 	struct net_device_stats *stats = &ieee->stats;
 	u8 i = 0, j = 0;
@@ -484,9 +493,12 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx
 		/* convert hdr + possible LLC headers into Ethernet header */
 			ethertype = (sub_skb->data[6] << 8) | sub_skb->data[7];
 			if (sub_skb->len >= 8 &&
-			    ((memcmp(sub_skb->data, rfc1042_header, SNAP_SIZE) == 0 &&
-			    ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
-			    memcmp(sub_skb->data, bridge_tunnel_header, SNAP_SIZE) == 0)) {
+			    ((memcmp(sub_skb->data, rfc1042_header,
+				     SNAP_SIZE) == 0 &&
+			      ethertype != ETH_P_AARP &&
+			      ethertype != ETH_P_IPX) ||
+			    memcmp(sub_skb->data, bridge_tunnel_header,
+				   SNAP_SIZE) == 0)) {
 				/* remove RFC1042 or Bridge-Tunnel encapsulation
 				 * and replace EtherType
 				 */
@@ -512,11 +524,13 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx
 				stats->rx_bytes += sub_skb->len;
 
 				memset(sub_skb->cb, 0, sizeof(sub_skb->cb));
-				sub_skb->protocol = eth_type_trans(sub_skb, ieee->dev);
+				sub_skb->protocol = eth_type_trans(sub_skb,
+								   ieee->dev);
 				sub_skb->dev = ieee->dev;
 				sub_skb->dev->stats.rx_packets++;
 				sub_skb->dev->stats.rx_bytes += sub_skb->len;
-				sub_skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */
+				/* 802.11 crc not sufficient */
+				sub_skb->ip_summed = CHECKSUM_NONE;
 				ieee->last_rx_ps_time = jiffies;
 				netif_rx(sub_skb);
 			}
@@ -526,7 +540,8 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx
 	}
 }
 
-void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee,	struct rx_ts_record *pTS)
+void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee,
+				 struct rx_ts_record *pTS)
 {
 	struct rx_reorder_entry *pRxReorderEntry;
 	u8 RfdCnt = 0;
@@ -540,7 +555,9 @@ void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee,	struct rx_ts_record
 			break;
 		}
 
-		pRxReorderEntry = (struct rx_reorder_entry *)list_entry(pTS->RxPendingPktList.prev, struct rx_reorder_entry, List);
+		pRxReorderEntry = (struct rx_reorder_entry *)
+				  list_entry(pTS->RxPendingPktList.prev,
+					     struct rx_reorder_entry, List);
 		netdev_dbg(ieee->dev, "%s(): Indicate SeqNum %d!\n", __func__,
 			   pRxReorderEntry->SeqNum);
 		list_del_init(&pRxReorderEntry->List);
@@ -548,7 +565,8 @@ void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee,	struct rx_ts_record
 		ieee->RfdArray[RfdCnt] = pRxReorderEntry->prxb;
 
 		RfdCnt = RfdCnt + 1;
-		list_add_tail(&pRxReorderEntry->List, &ieee->RxReorder_Unused_List);
+		list_add_tail(&pRxReorderEntry->List,
+			      &ieee->RxReorder_Unused_List);
 	}
 	rtllib_indicate_packets(ieee, ieee->RfdArray, RfdCnt);
 
@@ -607,10 +625,11 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
 		if (SeqNum >= (WinSize - 1))
 			pTS->RxIndicateSeq = SeqNum + 1 - WinSize;
 		else
-			pTS->RxIndicateSeq = 4095 - (WinSize - (SeqNum + 1)) + 1;
-		netdev_dbg(ieee->dev,
-			   "Window Shift! IndicateSeq: %d, NewSeq: %d\n",
-			   pTS->RxIndicateSeq, SeqNum);
+			pTS->RxIndicateSeq = 4095 -
+					     (WinSize - (SeqNum + 1)) + 1;
+			netdev_dbg(ieee->dev,
+				   "Window Shift! IndicateSeq: %d, NewSeq: %d\n",
+				   pTS->RxIndicateSeq, SeqNum);
 	}
 
 	/* Indication process.
@@ -625,7 +644,8 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
 	 */
 	if (bMatchWinStart) {
 		/* Current packet is going to be indicated.*/
-		netdev_dbg(ieee->dev, "Packets indication! IndicateSeq: %d, NewSeq: %d\n",
+		netdev_dbg(ieee->dev,
+			   "Packets indication! IndicateSeq: %d, NewSeq: %d\n",
 			   pTS->RxIndicateSeq, SeqNum);
 		ieee->prxbIndicateArray[0] = prxb;
 		index = 1;
@@ -637,24 +657,26 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
 					struct rx_reorder_entry, List);
 			list_del_init(&pReorderEntry->List);
 
-			/* Make a reorder entry and insert into a the packet list.*/
+			/* Make a reorder entry and insert
+			 * into a the packet list.
+			 */
 			pReorderEntry->SeqNum = SeqNum;
 			pReorderEntry->prxb = prxb;
 
 			if (!AddReorderEntry(pTS, pReorderEntry)) {
+				int i;
+
 				netdev_dbg(ieee->dev,
 					   "%s(): Duplicate packet is dropped. IndicateSeq: %d, NewSeq: %d\n",
 					   __func__, pTS->RxIndicateSeq,
 					   SeqNum);
 				list_add_tail(&pReorderEntry->List,
-					      &ieee->RxReorder_Unused_List); {
-					int i;
+					      &ieee->RxReorder_Unused_List);
 
-					for (i = 0; i < prxb->nr_subframes; i++)
-						dev_kfree_skb(prxb->subframes[i]);
-					kfree(prxb);
-					prxb = NULL;
-				}
+				for (i = 0; i < prxb->nr_subframes; i++)
+					dev_kfree_skb(prxb->subframes[i]);
+				kfree(prxb);
+				prxb = NULL;
 			} else {
 				netdev_dbg(ieee->dev,
 					   "Pkt insert into struct buffer. IndicateSeq: %d, NewSeq: %d\n",
@@ -685,10 +707,12 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
 		netdev_dbg(ieee->dev, "%s(): start RREORDER indicate\n",
 			   __func__);
 
-		pReorderEntry = (struct rx_reorder_entry *)list_entry(pTS->RxPendingPktList.prev,
-				 struct rx_reorder_entry, List);
+		pReorderEntry = (struct rx_reorder_entry *)
+					list_entry(pTS->RxPendingPktList.prev,
+						   struct rx_reorder_entry,
+						   List);
 		if (SN_LESS(pReorderEntry->SeqNum, pTS->RxIndicateSeq) ||
-				SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq)) {
+		    SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq)) {
 			/* This protect struct buffer from overflow. */
 			if (index >= REORDER_WIN_SIZE) {
 				netdev_err(ieee->dev,
@@ -701,7 +725,8 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,
 			list_del_init(&pReorderEntry->List);
 
 			if (SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq))
-				pTS->RxIndicateSeq = (pTS->RxIndicateSeq + 1) % 4096;
+				pTS->RxIndicateSeq = (pTS->RxIndicateSeq + 1) %
+						     4096;
 
 			ieee->prxbIndicateArray[index] = pReorderEntry->prxb;
 			netdev_dbg(ieee->dev, "%s(): Indicate SeqNum %d!\n",
@@ -916,7 +941,8 @@ static int rtllib_rx_check_duplicate(struct rtllib_device *ieee,
 		!ieee->current_network.qos_data.active ||
 		!IsDataFrame(skb->data) ||
 		IsLegacyDataFrame(skb->data)) {
-		if (!((type == RTLLIB_FTYPE_MGMT) && (stype == RTLLIB_STYPE_BEACON))) {
+		if (!((type == RTLLIB_FTYPE_MGMT) &&
+		      (stype == RTLLIB_STYPE_BEACON))) {
 			if (is_duplicate_packet(ieee, hdr))
 				return -1;
 		}
@@ -1019,7 +1045,8 @@ static int rtllib_rx_data_filter(struct rtllib_device *ieee, u16 fc,
 
 		/* {broad,multi}cast packets to our BSS go through */
 		if (is_multicast_ether_addr(dst)) {
-			if (memcmp(bssid, ieee->current_network.bssid, ETH_ALEN))
+			if (memcmp(bssid, ieee->current_network.bssid,
+				   ETH_ALEN))
 				return -1;
 		}
 	}
@@ -1197,7 +1224,8 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb,
 	return 0;
 }
 
-static void rtllib_rx_check_leave_lps(struct rtllib_device *ieee, u8 unicast, u8 nr_subframes)
+static void rtllib_rx_check_leave_lps(struct rtllib_device *ieee, u8 unicast,
+				      u8 nr_subframes)
 {
 	if (unicast) {
 
@@ -1314,7 +1342,8 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
 	/*Filter pkt has too small length */
 	hdrlen = rtllib_rx_get_hdrlen(ieee, skb, rx_stats);
 	if (skb->len < hdrlen) {
-		netdev_info(dev, "%s():ERR!!! skb->len is smaller than hdrlen\n",
+		netdev_info(dev,
+			    "%s():ERR!!! skb->len is smaller than hdrlen\n",
 			    __func__);
 		goto rx_dropped;
 	}
@@ -1359,10 +1388,13 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
 		goto rx_dropped;
 
 	/* Send pspoll based on moredata */
-	if ((ieee->iw_mode == IW_MODE_INFRA)  && (ieee->sta_sleep == LPS_IS_SLEEP)
-		&& (ieee->polling) && (!bToOtherSTA)) {
+	if ((ieee->iw_mode == IW_MODE_INFRA)  &&
+	    (ieee->sta_sleep == LPS_IS_SLEEP) &&
+	    (ieee->polling) && (!bToOtherSTA)) {
 		if (WLAN_FC_MORE_DATA(fc)) {
-			/* more data bit is set, let's request a new frame from the AP */
+			/* more data bit is set, let's request a new frame
+			 * from the AP
+			 */
 			rtllib_sta_ps_send_pspoll_frame(ieee);
 		} else {
 			ieee->polling =  false;
@@ -1388,7 +1420,8 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
 		&& (!bToOtherSTA)) {
 		TID = Frame_QoSTID(skb->data);
 		SeqNum = WLAN_GET_SEQ_SEQ(sc);
-		GetTs(ieee, (struct ts_common_info **) &pTS, hdr->addr2, TID, RX_DIR, true);
+		GetTs(ieee, (struct ts_common_info **) &pTS, hdr->addr2, TID,
+		      RX_DIR, true);
 		if (TID != 0 && TID != 3)
 			ieee->bis_any_nonbepkts = true;
 	}
@@ -1403,7 +1436,9 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
 	/* to parse amsdu packets */
 	/* qos data packets & reserved bit is 1 */
 	if (parse_subframe(ieee, skb, rx_stats, rxb, src, dst) == 0) {
-		/* only to free rxb, and not submit the packets to upper layer */
+		/* only to free rxb, and not submit the packets
+		 * to upper layer
+		 */
 		for (i = 0; i < rxb->nr_subframes; i++)
 			dev_kfree_skb(rxb->subframes[i]);
 		kfree(rxb);
@@ -1425,7 +1460,8 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
 	}
 
 	/* Indicate packets to upper layer or Rx Reorder */
-	if (ieee->pHTInfo->bCurRxReorderEnable == false || pTS == NULL || bToOtherSTA)
+	if (ieee->pHTInfo->bCurRxReorderEnable == false || pTS == NULL ||
+	    bToOtherSTA)
 		rtllib_rx_indicate_pkt_legacy(ieee, rx_stats, rxb, dst, src);
 	else
 		RxReorderIndicatePacket(ieee, rxb, pTS, SeqNum);
@@ -1554,8 +1590,9 @@ static int rtllib_verify_qos_info(struct rtllib_qos_information_element
 
 /* Parse a QoS parameter element */
 static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info
-					    *element_param, struct rtllib_info_element
-					    *info_element)
+							*element_param,
+					 struct rtllib_info_element
+							*info_element)
 {
 	int ret = 0;
 	u16 size = sizeof(struct rtllib_qos_parameter_info) - 2;
@@ -1577,10 +1614,10 @@ static int rtllib_read_qos_param_element(struct rtllib_qos_parameter_info
 }
 
 /* Parse a QoS information element */
-static int rtllib_read_qos_info_element(struct
-					   rtllib_qos_information_element
-					   *element_info, struct rtllib_info_element
-					   *info_element)
+static int rtllib_read_qos_info_element(struct rtllib_qos_information_element
+							*element_info,
+					struct rtllib_info_element
+							*info_element)
 {
 	int ret = 0;
 	u16 size = sizeof(struct rtllib_qos_information_element) - 2;
@@ -1590,7 +1627,8 @@ static int rtllib_read_qos_info_element(struct
 	if (info_element == NULL)
 		return -1;
 
-	if ((info_element->id == QOS_ELEMENT_ID) && (info_element->len == size)) {
+	if ((info_element->id == QOS_ELEMENT_ID) &&
+	    (info_element->len == size)) {
 		memcpy(element_info->qui, info_element->data,
 		       info_element->len);
 		element_info->elementID = info_element->id;
@@ -1600,14 +1638,14 @@ static int rtllib_read_qos_info_element(struct
 
 	if (ret == 0)
 		ret = rtllib_verify_qos_info(element_info,
-						QOS_OUI_INFO_SUB_TYPE);
+					     QOS_OUI_INFO_SUB_TYPE);
 	return ret;
 }
 
 
 /* Write QoS parameters from the ac parameters. */
 static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info *param_elm,
-		struct rtllib_qos_data *qos_data)
+					       struct rtllib_qos_data *qos_data)
 {
 	struct rtllib_qos_ac_parameter *ac_params;
 	struct rtllib_qos_parameters *qos_param = &(qos_data->parameters);
@@ -1653,9 +1691,11 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info
 		/* WMM spec P.11: The minimum value for AIFSN shall be 2 */
 		qos_param->aifs[aci] = (qos_param->aifs[aci] < 2) ? 2 : qos_param->aifs[aci];
 
-		qos_param->cw_min[aci] = cpu_to_le16(ac_params->ecw_min_max & 0x0F);
+		qos_param->cw_min[aci] = cpu_to_le16(ac_params->ecw_min_max &
+						     0x0F);
 
-		qos_param->cw_max[aci] = cpu_to_le16((ac_params->ecw_min_max & 0xF0) >> 4);
+		qos_param->cw_max[aci] = cpu_to_le16((ac_params->ecw_min_max &
+						      0xF0) >> 4);
 
 		qos_param->flag[aci] =
 		    (ac_params->aci_aifsn & 0x10) ? 0x01 : 0x00;
@@ -1746,15 +1786,19 @@ static inline void rtllib_extract_country_ie(
 {
 	if (IS_DOT11D_ENABLE(ieee)) {
 		if (info_element->len != 0) {
-			memcpy(network->CountryIeBuf, info_element->data, info_element->len);
+			memcpy(network->CountryIeBuf, info_element->data,
+			       info_element->len);
 			network->CountryIeLen = info_element->len;
 
 			if (!IS_COUNTRY_IE_VALID(ieee)) {
-				if (rtllib_act_scanning(ieee, false) && ieee->FirstIe_InScan)
+				if (rtllib_act_scanning(ieee, false) &&
+				    ieee->FirstIe_InScan)
 					netdev_info(ieee->dev,
 						    "Received beacon ContryIE, SSID: <%s>\n",
 						    network->ssid);
-				Dot11d_UpdateCountryIe(ieee, addr2, info_element->len, info_element->data);
+				Dot11d_UpdateCountryIe(ieee, addr2,
+						       info_element->len,
+						       info_element->data);
 			}
 		}
 
@@ -1933,7 +1977,8 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee,
 			network->MBssidMask = network->CcxRmState[1] & 0x07;
 			if (network->MBssidMask != 0) {
 				network->bMBssidValid = true;
-				network->MBssidMask = 0xff << (network->MBssidMask);
+				network->MBssidMask = 0xff <<
+						      (network->MBssidMask);
 				ether_addr_copy(network->MBssid,
 						network->bssid);
 				network->MBssid[5] &= network->MBssidMask;
@@ -2005,7 +2050,8 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
 
 			network->ssid_len = min(info_element->len,
 						(u8) IW_ESSID_MAX_SIZE);
-			memcpy(network->ssid, info_element->data, network->ssid_len);
+			memcpy(network->ssid, info_element->data,
+			       network->ssid_len);
 			if (network->ssid_len < IW_ESSID_MAX_SIZE)
 				memset(network->ssid + network->ssid_len, 0,
 				       IW_ESSID_MAX_SIZE - network->ssid_len);
@@ -2176,7 +2222,8 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
 		case MFIE_TYPE_HT_INFO:
 			netdev_dbg(ieee->dev, "MFIE_TYPE_HT_INFO: %d bytes\n",
 				   info_element->len);
-			tmp_htinfo_len = min_t(u8, info_element->len, MAX_IE_LEN);
+			tmp_htinfo_len = min_t(u8, info_element->len,
+					       MAX_IE_LEN);
 			if (tmp_htinfo_len) {
 				network->bssht.bdHTSpecVer = HT_SPEC_VER_IEEE;
 				network->bssht.bdHTInfoLen = tmp_htinfo_len >
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index d32954e..5e0d0f8 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -272,9 +272,10 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee)
 			ieee->seq_ctrl[0]++;
 
 		/* check whether the managed packet queued greater than 5 */
-		if (!ieee->check_nic_enough_desc(ieee->dev, tcb_desc->queue_index) ||
-		    (skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 0) ||
-		    (ieee->queue_stop)) {
+		if (!ieee->check_nic_enough_desc(ieee->dev,
+						 tcb_desc->queue_index) ||
+		    skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) ||
+		    ieee->queue_stop) {
 			/* insert the skb packet to the management queue
 			 *
 			 * as for the completion function, it does not need
@@ -1483,7 +1484,8 @@ static void rtllib_associate_step1(struct rtllib_device *ieee, u8 *daddr)
 	}
 }
 
-static void rtllib_auth_challenge(struct rtllib_device *ieee, u8 *challenge, int chlen)
+static void rtllib_auth_challenge(struct rtllib_device *ieee, u8 *challenge,
+				  int chlen)
 {
 	u8 *c;
 	struct sk_buff *skb;
@@ -1740,7 +1742,7 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee,
 				/* Join the network for the first time */
 				ieee->AsocRetryCount = 0;
 				if ((ieee->current_network.qos_data.supported == 1) &&
-				   ieee->current_network.bssht.bdSupportHT)
+				    ieee->current_network.bssht.bdSupportHT)
 					HTResetSelfAndSavePeerSetting(ieee,
 						 &(ieee->current_network));
 				else
@@ -1755,14 +1757,19 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee,
 					   &ieee->associate_procedure_wq, 0);
 			} else {
 				if (rtllib_is_54g(&ieee->current_network) &&
-					(ieee->modulation & RTLLIB_OFDM_MODULATION)) {
+				    (ieee->modulation &
+				     RTLLIB_OFDM_MODULATION)) {
 					ieee->rate = 108;
-					ieee->SetWirelessMode(ieee->dev, IEEE_G);
-					netdev_info(ieee->dev, "Using G rates\n");
+					ieee->SetWirelessMode(ieee->dev,
+							      IEEE_G);
+					netdev_info(ieee->dev,
+						    "Using G rates\n");
 				} else {
 					ieee->rate = 22;
-					ieee->SetWirelessMode(ieee->dev, IEEE_B);
-					netdev_info(ieee->dev, "Using B rates\n");
+					ieee->SetWirelessMode(ieee->dev,
+							      IEEE_B);
+					netdev_info(ieee->dev,
+						    "Using B rates\n");
 				}
 				memset(ieee->dot11HTOperationalRateSet, 0, 16);
 				ieee->state = RTLLIB_LINKED;
@@ -2024,7 +2031,7 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time)
 		if (ieee->bAwakePktSent) {
 			pPSC->LPSAwakeIntvl = 1;
 		} else {
-			u8		MaxPeriod = 1;
+			u8 MaxPeriod = 1;
 
 			if (pPSC->LPSAwakeIntvl == 0)
 				pPSC->LPSAwakeIntvl = 1;
@@ -2195,7 +2202,8 @@ void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success)
 }
 EXPORT_SYMBOL(rtllib_ps_tx_ack);
 
-static void rtllib_process_action(struct rtllib_device *ieee, struct sk_buff *skb)
+static void rtllib_process_action(struct rtllib_device *ieee,
+				  struct sk_buff *skb)
 {
 	struct rtllib_hdr_3addr *header = (struct rtllib_hdr_3addr *) skb->data;
 	u8 *act = rtllib_get_payload((struct rtllib_hdr *)header);
@@ -3677,8 +3685,8 @@ static void rtllib_MgntDisconnectIBSS(struct rtllib_device *rtllib)
 
 }
 
-static void rtllib_MlmeDisassociateRequest(struct rtllib_device *rtllib, u8 *asSta,
-				    u8 asRsn)
+static void rtllib_MlmeDisassociateRequest(struct rtllib_device *rtllib,
+					   u8 *asSta, u8 asRsn)
 {
 	u8 i;
 	u8	OpMode;
diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c
index 05cf95c..db239bb 100644
--- a/drivers/staging/rtl8192e/rtllib_tx.c
+++ b/drivers/staging/rtl8192e/rtllib_tx.c
@@ -57,18 +57,19 @@
  *
  *
  * 802.11 frame_control for data frames - 2 bytes
- *      ,-----------------------------------------------------------------------------------------.
- * bits | 0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  a  |  b  |  c  |  d  |  e   |
- *      |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------|
- * val  | 0  |  0  |  0  |  1  |  x  |  0  |  0  |  0  |  1  |  0  |  x  |  x  |  x  |  x  |  x   |
- *      |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------|
- * desc | ^-ver-^  |  ^type-^  |  ^-----subtype-----^  | to  |from |more |retry| pwr |more |wep   |
- *      |          |           | x=0 data,x=1 data+ack | DS  | DS  |frag |     | mgm |data |      |
- *      '-----------------------------------------------------------------------------------------'
- *                                                   /\
- *                                                   |
- * 802.11 Data Frame                                 |
- *          ,--------- 'ctrl' expands to >-----------'
+ *      ,--------------------------------------------------------------------.
+ * bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |  9 |  a |  b  |  c  |  d  | e  |
+ *      |---|---|---|---|---|---|---|---|---|----|----|-----|-----|-----|----|
+ * val  | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 |  0 |  x |  x  |  x  |  x  | x  |
+ *      |---|---|---|---|---|---|---|---|---|----|----|-----|-----|-----|----|
+ * desc |  ver  | type  |  ^-subtype-^  |to |from|more|retry| pwr |more |wep |
+ *      |       |       | x=0 data      |DS | DS |frag|     | mgm |data |    |
+ *      |       |       | x=1 data+ack  |   |    |    |     |     |     |    |
+ *      '--------------------------------------------------------------------'
+ *                                           /\
+ *                                           |
+ * 802.11 Data Frame                         |
+ *          ,--------- 'ctrl' expands to >---'
  *          |
  *       ,--'---,-------------------------------------------------------------.
  * Bytes |  2   |  2   |    6    |    6    |    6    |  2   | 0..2312 |   4  |
@@ -112,15 +113,15 @@
  *       `-----------------------------------------'
  * Total: 18 non-data bytes
  *
- * In the event that fragmentation is required, the incoming payload is split into
- * N parts of size ieee->fts.  The first fragment contains the SNAP header and the
- * remaining packets are just data.
+ * In the event that fragmentation is required, the incoming payload is split
+ * into N parts of size ieee->fts.  The first fragment contains the SNAP header
+ * and the remaining packets are just data.
  *
- * If encryption is enabled, each fragment payload size is reduced by enough space
- * to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP)
- * So if you have 1500 bytes of payload with ieee->fts set to 500 without
- * encryption it will take 3 frames.  With WEP it will take 4 frames as the
- * payload of each frame is reduced to 492 bytes.
+ * If encryption is enabled, each fragment payload size is reduced by enough
+ * space to add the prefix and postfix (IV and ICV totalling 8 bytes in
+ * the case of WEP) So if you have 1500 bytes of payload with ieee->fts set to
+ * 500 without encryption it will take 3 frames.  With WEP it will take 4 frames
+ * as the payload of each frame is reduced to 492 bytes.
  *
  * SKB visualization
  *
-- 
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