All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c
@ 2014-01-04 15:25 Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 01/13] Staging: vt6656: Fix indentation of bssdb.c Sebastian Rachuj
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Sebastian Rachuj @ 2014-01-04 15:25 UTC (permalink / raw)
  To: sebastian.rachuj
  Cc: linux-kernel, linux, forest, gregkh, more.andres, tvboxspy,
	devel, linux-kernel

This patch series reformats the bssdb.c file of the vt6656 driver in
staging. It resolves all errors and some warnings which checkpatch.pl
discovered.

However some occurrences of the following warnings are not patched:
- Lines over 80 characters
- Too many indentation levels
- printk should include KERN_ facility level

The first two noted types of warnings require more code modification
to reduce the indentation level. The latter should be fixed along with
the removal of the custom printk macro in
drivers/staging/vt6656/device.h.

NOTE: As the first patch retabs the complete file, you might consider
using "git diff --ignore-all-space"

No functional changes should be introduced by these patches.

Changes for v3:
As noted by Dan Carpenter, a commit of us introduced bogus
parentheses to conform with the corrupt "coding style" that was used
in this file. Therefore we now added another commit that removes all
these parentheses altogether. Additionally another new commit
simplifies comparisons agains NULL. The first 9 patches remain
unchanged.

Changes for v2:
As requested, the changes are now split into a series of smaller,
fine-grained patches. The reference git tree, that was used to create
it this time, is linux-next.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 01/13] Staging: vt6656: Fix indentation of bssdb.c
  2014-01-04 15:25 [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c Sebastian Rachuj
@ 2014-01-04 15:25 ` Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 02/13] Staging: vt6656: Adjust comments in bssdb.c Sebastian Rachuj
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sebastian Rachuj @ 2014-01-04 15:25 UTC (permalink / raw)
  To: sebastian.rachuj
  Cc: linux-kernel, linux, forest, gregkh, more.andres, tvboxspy,
	devel, linux-kernel

From: Simon Schuster <linux@rationality.eu>

Corrects indentation by using tabs instead of spaces. This also
includes modification of the alignment of multi-line expressions and
statements.

Signed-off-by: Sebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: Simon Schuster <linux@rationality.eu>
---
 drivers/staging/vt6656/bssdb.c | 2027 ++++++++++++++++++++--------------------
 1 file changed, 1016 insertions(+), 1011 deletions(-)

diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index 8d2c43d..a670272 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -21,15 +21,15 @@
  * Purpose: Handles the Basic Service Set & Node Database functions
  *
  * Functions:
- *      BSSpSearchBSSList - Search known BSS list for Desire SSID or BSSID
- *      BSSvClearBSSList - Clear BSS List
- *      BSSbInsertToBSSList - Insert a BSS set into known BSS list
- *      BSSbUpdateToBSSList - Update BSS set in known BSS list
- *      BSSbIsSTAInNodeDB - Search Node DB table to find the index of matched DstAddr
- *      BSSvCreateOneNode - Allocate an Node for Node DB
- *      BSSvUpdateAPNode - Update AP Node content in Index 0 of KnownNodeDB
- *      BSSvSecondCallBack - One second timer callback function to update Node DB info & AP link status
- *      BSSvUpdateNodeTxCounter - Update Tx attemps, Tx failure counter in Node DB for auto-fall back rate control
+ *	BSSpSearchBSSList       - Search known BSS list for Desire SSID or BSSID
+ *	BSSvClearBSSList        - Clear BSS List
+ *	BSSbInsertToBSSList     - Insert a BSS set into known BSS list
+ *	BSSbUpdateToBSSList     - Update BSS set in known BSS list
+ *	BSSbIsSTAInNodeDB       - Search Node DB table to find the index of matched DstAddr
+ *	BSSvCreateOneNode       - Allocate an Node for Node DB
+ *	BSSvUpdateAPNode        - Update AP Node content in Index 0 of KnownNodeDB
+ *	BSSvSecondCallBack      - One second timer callback function to update Node DB info & AP link status
+ *	BSSvUpdateNodeTxCounter - Update Tx attemps, Tx failure counter in Node DB for auto-fallback rate control
  *
  * Revision History:
  *
@@ -59,23 +59,23 @@
 #include "iowpa.h"
 #include "power.h"
 
-static int          msglevel                =MSG_LEVEL_INFO;
-//static int          msglevel                =MSG_LEVEL_DEBUG;
-
-static const u16             awHWRetry0[5][5] = {
-                                            {RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
-                                            {RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M},
-                                            {RATE_36M, RATE_36M, RATE_24M, RATE_18M, RATE_18M},
-                                            {RATE_48M, RATE_48M, RATE_36M, RATE_24M, RATE_24M},
-                                            {RATE_54M, RATE_54M, RATE_48M, RATE_36M, RATE_36M}
-                                           };
-static const u16             awHWRetry1[5][5] = {
-                                            {RATE_18M, RATE_18M, RATE_12M, RATE_6M, RATE_6M},
-                                            {RATE_24M, RATE_24M, RATE_18M, RATE_6M, RATE_6M},
-                                            {RATE_36M, RATE_36M, RATE_24M, RATE_12M, RATE_12M},
-                                            {RATE_48M, RATE_48M, RATE_24M, RATE_12M, RATE_12M},
-                                            {RATE_54M, RATE_54M, RATE_36M, RATE_18M, RATE_18M}
-                                           };
+static int msglevel =MSG_LEVEL_INFO;
+//static int msglevel =MSG_LEVEL_DEBUG;
+
+static const u16 awHWRetry0[5][5] = {
+			{RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
+			{RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M},
+			{RATE_36M, RATE_36M, RATE_24M, RATE_18M, RATE_18M},
+			{RATE_48M, RATE_48M, RATE_36M, RATE_24M, RATE_24M},
+			{RATE_54M, RATE_54M, RATE_48M, RATE_36M, RATE_36M}
+		};
+static const u16 awHWRetry1[5][5] = {
+			{RATE_18M, RATE_18M, RATE_12M, RATE_6M, RATE_6M},
+			{RATE_24M, RATE_24M, RATE_18M, RATE_6M, RATE_6M},
+			{RATE_36M, RATE_36M, RATE_24M, RATE_12M, RATE_12M},
+			{RATE_48M, RATE_48M, RATE_24M, RATE_12M, RATE_12M},
+			{RATE_54M, RATE_54M, RATE_36M, RATE_18M, RATE_18M}
+		};
 
 static void s_vCheckSensitivity(struct vnt_private *pDevice);
 static void s_vCheckPreEDThreshold(struct vnt_private *pDevice);
@@ -84,16 +84,16 @@ static void s_uCalculateLinkQual(struct vnt_private *pDevice);
 /*+
  *
  * Routine Description:
- *    Search known BSS list for Desire SSID or BSSID.
+ *	  Search known BSS list for Desire SSID or BSSID.
  *
  * Return Value:
- *    PTR to KnownBSS or NULL
+ *	  PTR to KnownBSS or NULL
  *
 -*/
 
 PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
-		u8 *pbyDesireBSSID, u8 *pbyDesireSSID,
-		CARD_PHY_TYPE ePhyType)
+			    u8 *pbyDesireBSSID, u8 *pbyDesireSSID,
+			    CARD_PHY_TYPE ePhyType)
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 	u8 *pbyBSSID = NULL;
@@ -104,134 +104,134 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 	int ii = 0;
 	int jj = 0;
 
-    if (pbyDesireBSSID != NULL) {
+	if (pbyDesireBSSID != NULL) {
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
 			"BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID);
-	if ((!is_broadcast_ether_addr(pbyDesireBSSID)) &&
-	     (memcmp(pbyDesireBSSID, ZeroBSSID, 6)!= 0)){
-            pbyBSSID = pbyDesireBSSID;
-        }
-    }
-    if (pbyDesireSSID != NULL) {
-        if (((PWLAN_IE_SSID)pbyDesireSSID)->len != 0) {
-            pSSID = (PWLAN_IE_SSID) pbyDesireSSID;
-        }
-    }
-
-    if ((pbyBSSID != NULL)&&(pDevice->bRoaming == false)) {
-        // match BSSID first
-        for (ii = 0; ii <MAX_BSS_NUM; ii++) {
-            pCurrBSS = &(pMgmt->sBSSList[ii]);
-
-	   pCurrBSS->bSelected = false;
-
-            if ((pCurrBSS->bActive) &&
-                (pCurrBSS->bSelected == false)) {
-		    if (ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) {
-                    if (pSSID != NULL) {
-                        // compare ssid
-                        if ( !memcmp(pSSID->abySSID,
-                            ((PWLAN_IE_SSID)pCurrBSS->abySSID)->abySSID,
-                            pSSID->len)) {
-                            if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
-                                ((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
-                                ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))
-                                ) {
-                                pCurrBSS->bSelected = true;
-                                return(pCurrBSS);
-                            }
-                        }
-                    } else {
-                        if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
-                            ((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
-                            ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))
-                            ) {
-                            pCurrBSS->bSelected = true;
-                            return(pCurrBSS);
-                        }
-                    }
-                }
-            }
-        }
-    } else {
-        // ignore BSSID
-        for (ii = 0; ii <MAX_BSS_NUM; ii++) {
-            pCurrBSS = &(pMgmt->sBSSList[ii]);
-
-           //2007-0721-01<Mark>by MikeLiu
-         //   if ((pCurrBSS->bActive) &&
-         //       (pCurrBSS->bSelected == false)) {
-
-	  pCurrBSS->bSelected = false;
-          if (pCurrBSS->bActive) {
-
-                if (pSSID != NULL) {
-                    // matched SSID
-                    if (memcmp(pSSID->abySSID,
-                        ((PWLAN_IE_SSID)pCurrBSS->abySSID)->abySSID,
-                        pSSID->len) ||
-                        (pSSID->len != ((PWLAN_IE_SSID)pCurrBSS->abySSID)->len)) {
-                        // SSID not match skip this BSS
-                        continue;
-                      }
-                }
-                if (((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) ||
-                    ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))
-                    ){
-                    // Type not match skip this BSS
-                    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSS type mismatch.... Config[%d] BSS[0x%04x]\n", pMgmt->eConfigMode, pCurrBSS->wCapInfo);
-                    continue;
-                }
-
-                if (ePhyType != PHY_TYPE_AUTO) {
-                    if (((ePhyType == PHY_TYPE_11A) && (PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse)) ||
-                        ((ePhyType != PHY_TYPE_11A) && (PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) {
-                        // PhyType not match skip this BSS
-                        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse);
-                        continue;
-                    }
-                }
-
-        pMgmt->pSameBSS[jj].uChannel = pCurrBSS->uChannel;
-		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
-			"BSSpSearchBSSList pSelect1[%pM]\n",
-			pCurrBSS->abyBSSID);
-        jj++;
-
-                if (pSelect == NULL) {
-                    pSelect = pCurrBSS;
-                } else {
-                    // compare RSSI, select the strongest signal 
-                    if (pCurrBSS->uRSSI < pSelect->uRSSI) {
-                        pSelect = pCurrBSS;
-                    }
-                }
-            }
-        }
-
-pDevice->bSameBSSMaxNum = jj;
-
-        if (pSelect != NULL) {
-            pSelect->bSelected = true;
-                        if (pDevice->bRoaming == false)  {
-	//       Einsn Add @20070907
-			memcpy(pbyDesireSSID,pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1) ;
-                                                }
-
-            return(pSelect);
-        }
-    }
-    return(NULL);
+		if ((!is_broadcast_ether_addr(pbyDesireBSSID)) &&
+			(memcmp(pbyDesireBSSID, ZeroBSSID, 6)!= 0)){
+				pbyBSSID = pbyDesireBSSID;
+		}
+	}
+	if (pbyDesireSSID != NULL) {
+		if (((PWLAN_IE_SSID)pbyDesireSSID)->len != 0) {
+			pSSID = (PWLAN_IE_SSID) pbyDesireSSID;
+		}
+	}
+
+	if ((pbyBSSID != NULL)&&(pDevice->bRoaming == false)) {
+		// match BSSID first
+		for (ii = 0; ii <MAX_BSS_NUM; ii++) {
+			pCurrBSS = &(pMgmt->sBSSList[ii]);
+
+			pCurrBSS->bSelected = false;
+
+			if ((pCurrBSS->bActive) &&
+				(pCurrBSS->bSelected == false)) {
+				if (ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) {
+					if (pSSID != NULL) {
+						// compare ssid
+						if ( !memcmp(pSSID->abySSID,
+							((PWLAN_IE_SSID)pCurrBSS->abySSID)->abySSID,
+							pSSID->len)) {
+							if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
+								((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
+								((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))
+								) {
+								pCurrBSS->bSelected = true;
+								return(pCurrBSS);
+							}
+						}
+					} else {
+						if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
+							((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
+							((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))
+							) {
+							pCurrBSS->bSelected = true;
+							return(pCurrBSS);
+						}
+					}
+				}
+			}
+		}
+	} else {
+		// ignore BSSID
+		for (ii = 0; ii <MAX_BSS_NUM; ii++) {
+			pCurrBSS = &(pMgmt->sBSSList[ii]);
+
+			//2007-0721-01<Mark>by MikeLiu
+			//   if ((pCurrBSS->bActive) &&
+			//		  (pCurrBSS->bSelected == false)) {
+
+			pCurrBSS->bSelected = false;
+			if (pCurrBSS->bActive) {
+
+				if (pSSID != NULL) {
+					// matched SSID
+					if (memcmp(pSSID->abySSID,
+						((PWLAN_IE_SSID)pCurrBSS->abySSID)->abySSID,
+						pSSID->len) ||
+						(pSSID->len != ((PWLAN_IE_SSID)pCurrBSS->abySSID)->len)) {
+						// SSID not match skip this BSS
+						continue;
+					  }
+				}
+				if (((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) ||
+					((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))
+					){
+					// Type not match skip this BSS
+					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSS type mismatch.... Config[%d] BSS[0x%04x]\n", pMgmt->eConfigMode, pCurrBSS->wCapInfo);
+					continue;
+				}
+
+				if (ePhyType != PHY_TYPE_AUTO) {
+					if (((ePhyType == PHY_TYPE_11A) && (PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse)) ||
+						((ePhyType != PHY_TYPE_11A) && (PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) {
+						// PhyType not match skip this BSS
+						DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse);
+						continue;
+					}
+				}
+
+				pMgmt->pSameBSS[jj].uChannel = pCurrBSS->uChannel;
+				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+					"BSSpSearchBSSList pSelect1[%pM]\n",
+					pCurrBSS->abyBSSID);
+				jj++;
+
+				if (pSelect == NULL) {
+					pSelect = pCurrBSS;
+				} else {
+					// compare RSSI, select the strongest signal
+					if (pCurrBSS->uRSSI < pSelect->uRSSI) {
+						pSelect = pCurrBSS;
+					}
+				}
+			}
+		}
+
+		pDevice->bSameBSSMaxNum = jj;
+
+		if (pSelect != NULL) {
+			pSelect->bSelected = true;
+			if (pDevice->bRoaming == false)  {
+				// Einsn Add @20070907
+				memcpy(pbyDesireSSID,pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1) ;
+			}
+
+			return(pSelect);
+		}
+	}
+	return(NULL);
 
 }
 
 /*+
  *
  * Routine Description:
- *    Clear BSS List
+ *	  Clear BSS List
  *
  * Return Value:
- *    None.
+ *	  None.
  *
 -*/
 
@@ -240,65 +240,70 @@ void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID)
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 	int ii;
 
-    for (ii = 0; ii < MAX_BSS_NUM; ii++) {
-        if (bKeepCurrBSSID) {
-            if (pMgmt->sBSSList[ii].bActive &&
-		ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID,
-				 pMgmt->abyCurrBSSID)) {
- //mike mark: there are two BSSID's in list. If that AP is in hidden ssid mode, one SSID is null,
- //                 but other's might not be obvious, so if it associate's with your STA,
- //                 you must keep the two of them!!
-               // bKeepCurrBSSID = false;
-                continue;
-            }
-        }
-
-	pMgmt->sBSSList[ii].bActive = false;
-        memset(&pMgmt->sBSSList[ii], 0, sizeof(KnownBSS));
-    }
-    BSSvClearAnyBSSJoinRecord(pDevice);
+	for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+		if (bKeepCurrBSSID) {
+			if (pMgmt->sBSSList[ii].bActive &&
+				ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID,
+				pMgmt->abyCurrBSSID)) {
+
+				//mike mark:
+				//there are two BSSID's in list. If that AP is
+				//in hidden ssid mode, one SSID is null, but
+				//other's might not be obvious, so if it
+				//associate's with your STA, you must keep the
+				//two of them!!  bKeepCurrBSSID = false;
+
+				continue;
+			}
+		}
+
+		pMgmt->sBSSList[ii].bActive = false;
+		memset(&pMgmt->sBSSList[ii], 0, sizeof(KnownBSS));
+	}
+	BSSvClearAnyBSSJoinRecord(pDevice);
 }
 
 /*+
  *
  * Routine Description:
- *    search BSS list by BSSID & SSID if matched
+ *	  search BSS list by BSSID & SSID if matched
  *
  * Return Value:
- *    true if found.
+ *	  true if found.
  *
 -*/
 PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice,
-	u8 *abyBSSID, PWLAN_IE_SSID pSSID)
+			      u8 *abyBSSID,
+			      PWLAN_IE_SSID pSSID)
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 	PKnownBSS pBSSList = NULL;
 	int ii;
 
-    for (ii = 0; ii < MAX_BSS_NUM; ii++) {
-        pBSSList = &(pMgmt->sBSSList[ii]);
-        if (pBSSList->bActive) {
-		if (ether_addr_equal(pBSSList->abyBSSID, abyBSSID)) {
-                if (pSSID->len == ((PWLAN_IE_SSID)pBSSList->abySSID)->len){
-                    if (memcmp(pSSID->abySSID,
-                            ((PWLAN_IE_SSID)pBSSList->abySSID)->abySSID,
-                            pSSID->len) == 0)
-                        return pBSSList;
-                }
-            }
-        }
-    }
-
-    return NULL;
+	for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+		pBSSList = &(pMgmt->sBSSList[ii]);
+		if (pBSSList->bActive) {
+			if (ether_addr_equal(pBSSList->abyBSSID, abyBSSID)) {
+				if (pSSID->len == ((PWLAN_IE_SSID)pBSSList->abySSID)->len){
+					if (memcmp(pSSID->abySSID,
+						((PWLAN_IE_SSID)pBSSList->abySSID)->abySSID,
+						pSSID->len) == 0)
+						return pBSSList;
+				}
+			}
+		}
+	}
+
+	return NULL;
 };
 
 /*+
  *
  * Routine Description:
- *    Insert a BSS set into known BSS list
+ *	  Insert a BSS set into known BSS list
  *
  * Return Value:
- *    true if success.
+ *	  true if success.
  *
 -*/
 
@@ -327,153 +332,153 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 	unsigned int ii;
 	bool bParsingQuiet = false;
 
-    pBSSList = (PKnownBSS)&(pMgmt->sBSSList[0]);
-
-    for (ii = 0; ii < MAX_BSS_NUM; ii++) {
-        pBSSList = (PKnownBSS)&(pMgmt->sBSSList[ii]);
-        if (!pBSSList->bActive)
-                break;
-    }
-
-    if (ii == MAX_BSS_NUM){
-        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get free KnowBSS node failed.\n");
-        return false;
-    }
-    // save the BSS info
-    pBSSList->bActive = true;
-    memcpy( pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN);
+	pBSSList = (PKnownBSS)&(pMgmt->sBSSList[0]);
+
+	for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+		pBSSList = (PKnownBSS)&(pMgmt->sBSSList[ii]);
+		if (!pBSSList->bActive)
+			break;
+	}
+
+	if (ii == MAX_BSS_NUM){
+		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get free KnowBSS node failed.\n");
+		return false;
+	}
+	// save the BSS info
+	pBSSList->bActive = true;
+	memcpy( pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN);
 	pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp);
-    pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
-    pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
-    pBSSList->uClearCount = 0;
-
-    if (pSSID->len > WLAN_SSID_MAXLEN)
-        pSSID->len = WLAN_SSID_MAXLEN;
-    memcpy( pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
-
-    pBSSList->uChannel = byCurrChannel;
-
-    if (pSuppRates->len > WLAN_RATES_MAXLEN)
-        pSuppRates->len = WLAN_RATES_MAXLEN;
-    memcpy( pBSSList->abySuppRates, pSuppRates, pSuppRates->len + WLAN_IEHDR_LEN);
-
-    if (pExtSuppRates != NULL) {
-        if (pExtSuppRates->len > WLAN_RATES_MAXLEN)
-            pExtSuppRates->len = WLAN_RATES_MAXLEN;
-        memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, pExtSuppRates->len + WLAN_IEHDR_LEN);
-        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSbInsertToBSSList: pExtSuppRates->len = %d\n", pExtSuppRates->len);
-
-    } else {
-        memset(pBSSList->abyExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
-    }
-    pBSSList->sERP.byERP = psERP->byERP;
-    pBSSList->sERP.bERPExist = psERP->bERPExist;
-
-    // Check if BSS is 802.11a/b/g
-    if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) {
-        pBSSList->eNetworkTypeInUse = PHY_TYPE_11A;
-    } else {
-        if (pBSSList->sERP.bERPExist == true) {
-            pBSSList->eNetworkTypeInUse = PHY_TYPE_11G;
-        } else {
-            pBSSList->eNetworkTypeInUse = PHY_TYPE_11B;
-        }
-    }
-
-    pBSSList->byRxRate = pRxPacket->byRxRate;
-    pBSSList->qwLocalTSF = pRxPacket->qwLocalTSF;
-    pBSSList->uRSSI = pRxPacket->uRSSI;
-    pBSSList->bySQ = pRxPacket->bySQ;
-
-   if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
-        (pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
-        // assoc with BSS
-        if (pBSSList == pMgmt->pCurrBSS) {
-            bParsingQuiet = true;
-        }
-    }
-
-    WPA_ClearRSN(pBSSList);
-
-    if (pRSNWPA != NULL) {
-	unsigned int uLen = pRSNWPA->len + 2;
-
-	if (uLen <= (uIELength -
-		     (unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) {
-		pBSSList->wWPALen = uLen;
-		memcpy(pBSSList->byWPAIE, pRSNWPA, uLen);
-		WPA_ParseRSN(pBSSList, pRSNWPA);
+	pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
+	pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
+	pBSSList->uClearCount = 0;
+
+	if (pSSID->len > WLAN_SSID_MAXLEN)
+		pSSID->len = WLAN_SSID_MAXLEN;
+	memcpy( pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
+
+	pBSSList->uChannel = byCurrChannel;
+
+	if (pSuppRates->len > WLAN_RATES_MAXLEN)
+		pSuppRates->len = WLAN_RATES_MAXLEN;
+	memcpy( pBSSList->abySuppRates, pSuppRates, pSuppRates->len + WLAN_IEHDR_LEN);
+
+	if (pExtSuppRates != NULL) {
+		if (pExtSuppRates->len > WLAN_RATES_MAXLEN)
+			pExtSuppRates->len = WLAN_RATES_MAXLEN;
+		memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, pExtSuppRates->len + WLAN_IEHDR_LEN);
+		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSbInsertToBSSList: pExtSuppRates->len = %d\n", pExtSuppRates->len);
+
+	} else {
+		memset(pBSSList->abyExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
 	}
-    }
+	pBSSList->sERP.byERP = psERP->byERP;
+	pBSSList->sERP.bERPExist = psERP->bERPExist;
 
-    WPA2_ClearRSN(pBSSList);
+	// Check if BSS is 802.11a/b/g
+	if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) {
+		pBSSList->eNetworkTypeInUse = PHY_TYPE_11A;
+	} else {
+		if (pBSSList->sERP.bERPExist == true) {
+			pBSSList->eNetworkTypeInUse = PHY_TYPE_11G;
+		} else {
+			pBSSList->eNetworkTypeInUse = PHY_TYPE_11B;
+		}
+	}
 
-    if (pRSN != NULL) {
-	unsigned int uLen = pRSN->len + 2;
+	pBSSList->byRxRate = pRxPacket->byRxRate;
+	pBSSList->qwLocalTSF = pRxPacket->qwLocalTSF;
+	pBSSList->uRSSI = pRxPacket->uRSSI;
+	pBSSList->bySQ = pRxPacket->bySQ;
 
-	if (uLen <= (uIELength -
-		     (unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) {
-		pBSSList->wRSNLen = uLen;
-		memcpy(pBSSList->byRSNIE, pRSN, uLen);
-		WPA2vParseRSN(pBSSList, pRSN);
+	if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
+		(pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
+		// assoc with BSS
+		if (pBSSList == pMgmt->pCurrBSS) {
+			bParsingQuiet = true;
+		}
 	}
-    }
-
-    if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pBSSList->bWPA2Valid == true)) {
-
-        PSKeyItem  pTransmitKey = NULL;
-        bool       bIs802_1x = false;
-
-        for (ii = 0; ii < pBSSList->wAKMSSAuthCount; ii ++) {
-            if (pBSSList->abyAKMSSAuthType[ii] == WLAN_11i_AKMSS_802_1X) {
-                bIs802_1x = true;
-                break;
-            }
-        }
-        if ((bIs802_1x == true) && (pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len) &&
-            ( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID, pSSID->len))) {
-
-		bAdd_PMKID_Candidate((void *) pDevice,
-				     pBSSList->abyBSSID,
-				     &pBSSList->sRSNCapObj);
-
-            if ((pDevice->bLinkPass == true) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
-                if ((KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, PAIRWISE_KEY, &pTransmitKey) == true) ||
-                    (KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, GROUP_KEY, &pTransmitKey) == true)) {
-                    pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList;
-                    pDevice->gsPMKIDCandidate.Version = 1;
-
-                }
-
-            }
-        }
-    }
-
-    if (pDevice->bUpdateBBVGA) {
-        // Monitor if RSSI is too strong.
-        pBSSList->byRSSIStatCnt = 0;
-        RFvRSSITodBm(pDevice, (u8)(pRxPacket->uRSSI), &pBSSList->ldBmMAX);
-        pBSSList->ldBmAverage[0] = pBSSList->ldBmMAX;
-        pBSSList->ldBmAverRange = pBSSList->ldBmMAX;
-        for (ii = 1; ii < RSSI_STAT_COUNT; ii++)
-            pBSSList->ldBmAverage[ii] = 0;
-    }
-
-    pBSSList->uIELength = uIELength;
-    if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN)
-        pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN;
-    memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength);
-
-    return true;
+
+	WPA_ClearRSN(pBSSList);
+
+	if (pRSNWPA != NULL) {
+		unsigned int uLen = pRSNWPA->len + 2;
+
+		if (uLen <= (uIELength -
+				(unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) {
+			pBSSList->wWPALen = uLen;
+			memcpy(pBSSList->byWPAIE, pRSNWPA, uLen);
+			WPA_ParseRSN(pBSSList, pRSNWPA);
+		}
+	}
+
+	WPA2_ClearRSN(pBSSList);
+
+	if (pRSN != NULL) {
+		unsigned int uLen = pRSN->len + 2;
+
+		if (uLen <= (uIELength -
+				(unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) {
+			pBSSList->wRSNLen = uLen;
+			memcpy(pBSSList->byRSNIE, pRSN, uLen);
+			WPA2vParseRSN(pBSSList, pRSN);
+		}
+	}
+
+	if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pBSSList->bWPA2Valid == true)) {
+
+		PSKeyItem  pTransmitKey = NULL;
+		bool	   bIs802_1x = false;
+
+		for (ii = 0; ii < pBSSList->wAKMSSAuthCount; ii ++) {
+			if (pBSSList->abyAKMSSAuthType[ii] == WLAN_11i_AKMSS_802_1X) {
+				bIs802_1x = true;
+				break;
+			}
+		}
+		if ((bIs802_1x == true) && (pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len) &&
+			( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID, pSSID->len))) {
+
+			bAdd_PMKID_Candidate((void *) pDevice,
+					 pBSSList->abyBSSID,
+					 &pBSSList->sRSNCapObj);
+
+			if ((pDevice->bLinkPass == true) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
+				if ((KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, PAIRWISE_KEY, &pTransmitKey) == true) ||
+					(KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, GROUP_KEY, &pTransmitKey) == true)) {
+					pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList;
+					pDevice->gsPMKIDCandidate.Version = 1;
+
+				}
+
+			}
+		}
+	}
+
+	if (pDevice->bUpdateBBVGA) {
+		// Monitor if RSSI is too strong.
+		pBSSList->byRSSIStatCnt = 0;
+		RFvRSSITodBm(pDevice, (u8)(pRxPacket->uRSSI), &pBSSList->ldBmMAX);
+		pBSSList->ldBmAverage[0] = pBSSList->ldBmMAX;
+		pBSSList->ldBmAverRange = pBSSList->ldBmMAX;
+		for (ii = 1; ii < RSSI_STAT_COUNT; ii++)
+			pBSSList->ldBmAverage[ii] = 0;
+	}
+
+	pBSSList->uIELength = uIELength;
+	if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN)
+		pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN;
+	memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength);
+
+	return true;
 }
 
 /*+
  *
  * Routine Description:
- *    Update BSS set in known BSS list
+ *	  Update BSS set in known BSS list
  *
  * Return Value:
- *    true if success.
+ *	  true if success.
  *
 -*/
 // TODO: input structure modify
@@ -504,202 +509,203 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 	signed long ldBm, ldBmSum;
 	bool bParsingQuiet = false;
 
-    if (pBSSList == NULL)
-        return false;
+	if (pBSSList == NULL)
+		return false;
 
 	pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp);
 
-    pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
-    pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
-    pBSSList->uClearCount = 0;
-    pBSSList->uChannel = byCurrChannel;
-
-    if (pSSID->len > WLAN_SSID_MAXLEN)
-        pSSID->len = WLAN_SSID_MAXLEN;
-
-    if ((pSSID->len != 0) && (pSSID->abySSID[0] != 0))
-        memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
-    memcpy(pBSSList->abySuppRates, pSuppRates,pSuppRates->len + WLAN_IEHDR_LEN);
-
-    if (pExtSuppRates != NULL) {
-        memcpy(pBSSList->abyExtSuppRates, pExtSuppRates,pExtSuppRates->len + WLAN_IEHDR_LEN);
-    } else {
-        memset(pBSSList->abyExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
-    }
-    pBSSList->sERP.byERP = psERP->byERP;
-    pBSSList->sERP.bERPExist = psERP->bERPExist;
-
-    // Check if BSS is 802.11a/b/g
-    if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) {
-        pBSSList->eNetworkTypeInUse = PHY_TYPE_11A;
-    } else {
-        if (pBSSList->sERP.bERPExist == true) {
-            pBSSList->eNetworkTypeInUse = PHY_TYPE_11G;
-        } else {
-            pBSSList->eNetworkTypeInUse = PHY_TYPE_11B;
-        }
-    }
-
-    pBSSList->byRxRate = pRxPacket->byRxRate;
-    pBSSList->qwLocalTSF = pRxPacket->qwLocalTSF;
-    if(bChannelHit)
-        pBSSList->uRSSI = pRxPacket->uRSSI;
-    pBSSList->bySQ = pRxPacket->bySQ;
-
-   if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
-        (pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
-        // assoc with BSS
-        if (pBSSList == pMgmt->pCurrBSS) {
-            bParsingQuiet = true;
-        }
-    }
-
-   WPA_ClearRSN(pBSSList);         //mike update
-
-   if (pRSNWPA != NULL) {
-	unsigned int uLen = pRSNWPA->len + 2;
-	if (uLen <= (uIELength -
-		     (unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) {
-		pBSSList->wWPALen = uLen;
-		memcpy(pBSSList->byWPAIE, pRSNWPA, uLen);
-		WPA_ParseRSN(pBSSList, pRSNWPA);
+	pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
+	pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
+	pBSSList->uClearCount = 0;
+	pBSSList->uChannel = byCurrChannel;
+
+	if (pSSID->len > WLAN_SSID_MAXLEN)
+		pSSID->len = WLAN_SSID_MAXLEN;
+
+	if ((pSSID->len != 0) && (pSSID->abySSID[0] != 0))
+		memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
+	memcpy(pBSSList->abySuppRates, pSuppRates,pSuppRates->len + WLAN_IEHDR_LEN);
+
+	if (pExtSuppRates != NULL) {
+		memcpy(pBSSList->abyExtSuppRates, pExtSuppRates,pExtSuppRates->len + WLAN_IEHDR_LEN);
+	} else {
+		memset(pBSSList->abyExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
 	}
-   }
+	pBSSList->sERP.byERP = psERP->byERP;
+	pBSSList->sERP.bERPExist = psERP->bERPExist;
 
-   WPA2_ClearRSN(pBSSList);  //mike update
+	// Check if BSS is 802.11a/b/g
+	if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) {
+		pBSSList->eNetworkTypeInUse = PHY_TYPE_11A;
+	} else {
+		if (pBSSList->sERP.bERPExist == true) {
+			pBSSList->eNetworkTypeInUse = PHY_TYPE_11G;
+		} else {
+			pBSSList->eNetworkTypeInUse = PHY_TYPE_11B;
+		}
+	}
 
-    if (pRSN != NULL) {
-	unsigned int uLen = pRSN->len + 2;
-	if (uLen <= (uIELength -
-			(unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) {
-		pBSSList->wRSNLen = uLen;
-		memcpy(pBSSList->byRSNIE, pRSN, uLen);
-		WPA2vParseRSN(pBSSList, pRSN);
+	pBSSList->byRxRate = pRxPacket->byRxRate;
+	pBSSList->qwLocalTSF = pRxPacket->qwLocalTSF;
+	if(bChannelHit)
+		pBSSList->uRSSI = pRxPacket->uRSSI;
+	pBSSList->bySQ = pRxPacket->bySQ;
+
+	if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
+		(pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
+		// assoc with BSS
+		if (pBSSList == pMgmt->pCurrBSS) {
+			bParsingQuiet = true;
+		}
 	}
-    }
-
-    if (pRxPacket->uRSSI != 0) {
-        RFvRSSITodBm(pDevice, (u8)(pRxPacket->uRSSI), &ldBm);
-        // Monitor if RSSI is too strong.
-        pBSSList->byRSSIStatCnt++;
-        pBSSList->byRSSIStatCnt %= RSSI_STAT_COUNT;
-        pBSSList->ldBmAverage[pBSSList->byRSSIStatCnt] = ldBm;
-        ldBmSum = 0;
-	for (ii = 0, jj = 0; ii < RSSI_STAT_COUNT; ii++) {
-		if (pBSSList->ldBmAverage[ii] != 0) {
-			pBSSList->ldBmMAX =
-				max(pBSSList->ldBmAverage[ii], ldBm);
-			ldBmSum +=
-				pBSSList->ldBmAverage[ii];
-			jj++;
+
+	WPA_ClearRSN(pBSSList); //mike update
+
+	if (pRSNWPA != NULL) {
+		unsigned int uLen = pRSNWPA->len + 2;
+		if (uLen <= (uIELength -
+				(unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) {
+			pBSSList->wWPALen = uLen;
+			memcpy(pBSSList->byWPAIE, pRSNWPA, uLen);
+			WPA_ParseRSN(pBSSList, pRSNWPA);
 		}
-        }
-        pBSSList->ldBmAverRange = ldBmSum /jj;
-    }
+	}
+
+	WPA2_ClearRSN(pBSSList); //mike update
 
-    pBSSList->uIELength = uIELength;
-    if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN)
-        pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN;
-    memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength);
+	if (pRSN != NULL) {
+		unsigned int uLen = pRSN->len + 2;
+		if (uLen <= (uIELength -
+				(unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) {
+			pBSSList->wRSNLen = uLen;
+			memcpy(pBSSList->byRSNIE, pRSN, uLen);
+			WPA2vParseRSN(pBSSList, pRSN);
+		}
+	}
 
-    return true;
+	if (pRxPacket->uRSSI != 0) {
+		RFvRSSITodBm(pDevice, (u8)(pRxPacket->uRSSI), &ldBm);
+		// Monitor if RSSI is too strong.
+		pBSSList->byRSSIStatCnt++;
+		pBSSList->byRSSIStatCnt %= RSSI_STAT_COUNT;
+		pBSSList->ldBmAverage[pBSSList->byRSSIStatCnt] = ldBm;
+		ldBmSum = 0;
+		for (ii = 0, jj = 0; ii < RSSI_STAT_COUNT; ii++) {
+			if (pBSSList->ldBmAverage[ii] != 0) {
+				pBSSList->ldBmMAX =
+					max(pBSSList->ldBmAverage[ii], ldBm);
+				ldBmSum +=
+					pBSSList->ldBmAverage[ii];
+				jj++;
+			}
+		}
+		pBSSList->ldBmAverRange = ldBmSum /jj;
+	}
+
+	pBSSList->uIELength = uIELength;
+	if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN)
+		pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN;
+	memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength);
+
+	return true;
 }
 
 /*+
  *
  * Routine Description:
- *    Search Node DB table to find the index of matched DstAddr
+ *	  Search Node DB table to find the index of matched DstAddr
  *
  * Return Value:
- *    None
+ *	  None
  *
 -*/
 
 int BSSbIsSTAInNodeDB(struct vnt_private *pDevice,
-		u8 *abyDstAddr, u32 *puNodeIndex)
+		      u8 *abyDstAddr,
+		      u32 *puNodeIndex)
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 	unsigned int ii;
 
-    // Index = 0 reserved for AP Node
-    for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
-        if (pMgmt->sNodeDBTable[ii].bActive) {
-		if (ether_addr_equal(abyDstAddr,
-				     pMgmt->sNodeDBTable[ii].abyMACAddr)) {
-                *puNodeIndex = ii;
-                return true;
-            }
-        }
-    }
-
-   return false;
+	// Index = 0 reserved for AP Node
+	for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
+		if (pMgmt->sNodeDBTable[ii].bActive) {
+			if (ether_addr_equal(abyDstAddr,
+				pMgmt->sNodeDBTable[ii].abyMACAddr)) {
+				*puNodeIndex = ii;
+				return true;
+			}
+		}
+	}
+
+	return false;
 };
 
 /*+
  *
  * Routine Description:
- *    Find an empty node and allocate it; if no empty node
- *    is found, then use the most inactive one.
+ *	  Find an empty node and allocate it; if no empty node
+ *	  is found, then use the most inactive one.
  *
  * Return Value:
- *    None
+ *	  None
  *
 -*/
 void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex)
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
-	int            ii;
+	int ii;
 	u32 BigestCount = 0;
 	u32 SelectIndex;
-	struct sk_buff  *skb;
-
-    // Index = 0 reserved for AP Node (In STA mode)
-    // Index = 0 reserved for Broadcast/MultiCast (In AP mode)
-    SelectIndex = 1;
-    for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
-        if (pMgmt->sNodeDBTable[ii].bActive) {
-            if (pMgmt->sNodeDBTable[ii].uInActiveCount > BigestCount) {
-                BigestCount = pMgmt->sNodeDBTable[ii].uInActiveCount;
-                SelectIndex = ii;
-            }
-        }
-        else {
-            break;
-        }
-    }
-
-    // if not found replace uInActiveCount with the largest one.
-    if ( ii == (MAX_NODE_NUM + 1)) {
-        *puNodeIndex = SelectIndex;
-        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Replace inactive node = %d\n", SelectIndex);
-        // clear ps buffer
-        if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next != NULL) {
-      	    while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)) != NULL)
-            dev_kfree_skb(skb);
-        }
-    }
-    else {
-        *puNodeIndex = ii;
-    }
-
-    memset(&pMgmt->sNodeDBTable[*puNodeIndex], 0, sizeof(KnownNodeDB));
-    pMgmt->sNodeDBTable[*puNodeIndex].bActive = true;
-    pMgmt->sNodeDBTable[*puNodeIndex].uRatePollTimeout = FALLBACK_POLL_SECOND;
-    // for AP mode PS queue
-    skb_queue_head_init(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue);
-    pMgmt->sNodeDBTable[*puNodeIndex].byAuthSequence = 0;
-    pMgmt->sNodeDBTable[*puNodeIndex].wEnQueueCnt = 0;
-    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii);
+	struct sk_buff *skb;
+
+	// Index = 0 reserved for AP Node (In STA mode)
+	// Index = 0 reserved for Broadcast/MultiCast (In AP mode)
+	SelectIndex = 1;
+	for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
+		if (pMgmt->sNodeDBTable[ii].bActive) {
+			if (pMgmt->sNodeDBTable[ii].uInActiveCount > BigestCount) {
+				BigestCount = pMgmt->sNodeDBTable[ii].uInActiveCount;
+				SelectIndex = ii;
+			}
+		}
+		else {
+			break;
+		}
+	}
+
+	// if not found replace uInActiveCount with the largest one.
+	if ( ii == (MAX_NODE_NUM + 1)) {
+		*puNodeIndex = SelectIndex;
+		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Replace inactive node = %d\n", SelectIndex);
+		// clear ps buffer
+		if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next != NULL) {
+			while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)) != NULL)
+				dev_kfree_skb(skb);
+		}
+	}
+	else {
+		*puNodeIndex = ii;
+	}
+
+	memset(&pMgmt->sNodeDBTable[*puNodeIndex], 0, sizeof(KnownNodeDB));
+	pMgmt->sNodeDBTable[*puNodeIndex].bActive = true;
+	pMgmt->sNodeDBTable[*puNodeIndex].uRatePollTimeout = FALLBACK_POLL_SECOND;
+	// for AP mode PS queue
+	skb_queue_head_init(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue);
+	pMgmt->sNodeDBTable[*puNodeIndex].byAuthSequence = 0;
+	pMgmt->sNodeDBTable[*puNodeIndex].wEnQueueCnt = 0;
+	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii);
 };
 
 /*+
  *
  * Routine Description:
- *    Remove Node by NodeIndex
+ *	  Remove Node by NodeIndex
  *
  *
  * Return Value:
- *    None
+ *	  None
  *
 -*/
 
@@ -707,72 +713,73 @@ void BSSvRemoveOneNode(struct vnt_private *pDevice, u32 uNodeIndex)
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 	u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
-	struct sk_buff  *skb;
-
-    while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue)) != NULL)
-            dev_kfree_skb(skb);
-    // clear context
-    memset(&pMgmt->sNodeDBTable[uNodeIndex], 0, sizeof(KnownNodeDB));
-    // clear tx bit map
-    pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[uNodeIndex].wAID >> 3] &=  ~byMask[pMgmt->sNodeDBTable[uNodeIndex].wAID & 7];
+	struct sk_buff *skb;
+
+	while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue)) != NULL)
+		dev_kfree_skb(skb);
+	// clear context
+	memset(&pMgmt->sNodeDBTable[uNodeIndex], 0, sizeof(KnownNodeDB));
+	// clear tx bit map
+	pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[uNodeIndex].wAID >> 3] &=  ~byMask[pMgmt->sNodeDBTable[uNodeIndex].wAID & 7];
 };
 /*+
  *
  * Routine Description:
- *    Update AP Node content in Index 0 of KnownNodeDB
+ *	  Update AP Node content in Index 0 of KnownNodeDB
  *
  *
  * Return Value:
- *    None
+ *	  None
  *
 -*/
 
-void BSSvUpdateAPNode(struct vnt_private *pDevice, u16 *pwCapInfo,
-	PWLAN_IE_SUPP_RATES pSuppRates, PWLAN_IE_SUPP_RATES pExtSuppRates)
+void BSSvUpdateAPNode(struct vnt_private *pDevice,
+		      u16 *pwCapInfo,
+		      PWLAN_IE_SUPP_RATES pSuppRates,
+		      PWLAN_IE_SUPP_RATES pExtSuppRates)
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 	u32 uRateLen = WLAN_RATES_MAXLEN;
 
-    memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB));
-
-    pMgmt->sNodeDBTable[0].bActive = true;
-    if (pDevice->byBBType == BB_TYPE_11B) {
-        uRateLen = WLAN_RATES_MAXLEN_11B;
-    }
-    pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pSuppRates,
-                                            (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
-                                            uRateLen);
-    pMgmt->abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pExtSuppRates,
-                                            (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates,
-                                            uRateLen);
-    RATEvParseMaxRate((void *) pDevice,
-                       (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
-                       (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates,
-                       true,
-                       &(pMgmt->sNodeDBTable[0].wMaxBasicRate),
-                       &(pMgmt->sNodeDBTable[0].wMaxSuppRate),
-                       &(pMgmt->sNodeDBTable[0].wSuppRate),
-                       &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate),
-                       &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate)
-                      );
-    memcpy(pMgmt->sNodeDBTable[0].abyMACAddr, pMgmt->abyCurrBSSID, WLAN_ADDR_LEN);
-    pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxSuppRate;
-    pMgmt->sNodeDBTable[0].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(*pwCapInfo);
-    pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND;
-    // Auto rate fallback function initiation.
-    // RATEbInit(pDevice);
-    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate);
+	memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB));
+
+	pMgmt->sNodeDBTable[0].bActive = true;
+	if (pDevice->byBBType == BB_TYPE_11B) {
+		uRateLen = WLAN_RATES_MAXLEN_11B;
+	}
+	pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pSuppRates,
+						(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
+						uRateLen);
+	pMgmt->abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pExtSuppRates,
+						(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates,
+						uRateLen);
+	RATEvParseMaxRate((void *) pDevice,
+			  (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
+			  (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates,
+			  true,
+			  &(pMgmt->sNodeDBTable[0].wMaxBasicRate),
+			  &(pMgmt->sNodeDBTable[0].wMaxSuppRate),
+			  &(pMgmt->sNodeDBTable[0].wSuppRate),
+			  &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate),
+			  &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate));
+	memcpy(pMgmt->sNodeDBTable[0].abyMACAddr, pMgmt->abyCurrBSSID, WLAN_ADDR_LEN);
+	pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxSuppRate;
+	pMgmt->sNodeDBTable[0].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(*pwCapInfo);
+	pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND;
+	// Auto rate fallback function initiation.
+	// RATEbInit(pDevice);
+	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate);
 
 };
 
 /*+
  *
  * Routine Description:
- *    Add Multicast Node content in Index 0 of KnownNodeDB
+ *	  Add Multicast Node content in Index 0 of KnownNodeDB
  *
  *
  * Return Value:
- *    None
+ *	  None
  *
 -*/
 
@@ -780,24 +787,23 @@ void BSSvAddMulticastNode(struct vnt_private *pDevice)
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 
-    if (!pDevice->bEnableHostWEP)
-        memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB));
-    memset(pMgmt->sNodeDBTable[0].abyMACAddr, 0xff, WLAN_ADDR_LEN);
-    pMgmt->sNodeDBTable[0].bActive = true;
-    pMgmt->sNodeDBTable[0].bPSEnable = false;
-    skb_queue_head_init(&pMgmt->sNodeDBTable[0].sTxPSQueue);
-    RATEvParseMaxRate((void *) pDevice,
-                      (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
-                      (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates,
-                      true,
-                      &(pMgmt->sNodeDBTable[0].wMaxBasicRate),
-                      &(pMgmt->sNodeDBTable[0].wMaxSuppRate),
-                       &(pMgmt->sNodeDBTable[0].wSuppRate),
-                      &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate),
-                      &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate)
-                     );
-    pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxBasicRate;
-    pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND;
+	if (!pDevice->bEnableHostWEP)
+		memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB));
+	memset(pMgmt->sNodeDBTable[0].abyMACAddr, 0xff, WLAN_ADDR_LEN);
+	pMgmt->sNodeDBTable[0].bActive = true;
+	pMgmt->sNodeDBTable[0].bPSEnable = false;
+	skb_queue_head_init(&pMgmt->sNodeDBTable[0].sTxPSQueue);
+	RATEvParseMaxRate((void *) pDevice,
+			  (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
+			  (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates,
+			  true,
+			  &(pMgmt->sNodeDBTable[0].wMaxBasicRate),
+			  &(pMgmt->sNodeDBTable[0].wMaxSuppRate),
+			  &(pMgmt->sNodeDBTable[0].wSuppRate),
+			  &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate),
+			  &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate));
+	pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxBasicRate;
+	pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND;
 
 };
 
@@ -806,11 +812,11 @@ void BSSvAddMulticastNode(struct vnt_private *pDevice)
  * Routine Description:
  *
  *
- *  Second call back function to update Node DB info & AP link status
+ *	Second call back function to update Node DB info & AP link status
  *
  *
  * Return Value:
- *    none.
+ *	  none.
  *
 -*/
 
@@ -828,302 +834,301 @@ void BSSvSecondCallBack(struct work_struct *work)
 	if (pDevice->Flags & fMP_DISCONNECTED)
 		return;
 
-    spin_lock_irq(&pDevice->lock);
-
-    pDevice->uAssocCount = 0;
-
-    //Power Saving Mode Tx Burst
-    if ( pDevice->bEnablePSMode == true ) {
-        pDevice->ulPSModeWaitTx++;
-        if ( pDevice->ulPSModeWaitTx >= 2 ) {
-            pDevice->ulPSModeWaitTx = 0;
-            pDevice->bPSModeTxBurst = false;
-        }
-    }
-
-    pDevice->byERPFlag &=
-        ~(WLAN_SET_ERP_BARKER_MODE(1) | WLAN_SET_ERP_NONERP_PRESENT(1));
-
-    if (pDevice->wUseProtectCntDown > 0) {
-        pDevice->wUseProtectCntDown --;
-    }
-    else {
-        // disable protect mode
-        pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1));
-    }
-
-if(pDevice->byReAssocCount > 0) {
-       pDevice->byReAssocCount++;
-   if((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) {  //10 sec timeout
-                     printk("Re-association timeout!!!\n");
-		   pDevice->byReAssocCount = 0;
-                    // if(pDevice->bWPASuppWextEnabled == true)
-                        {
-                  	union iwreq_data  wrqu;
-                  	memset(&wrqu, 0, sizeof (wrqu));
-                          wrqu.ap_addr.sa_family = ARPHRD_ETHER;
-                  	PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
-                  	wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
-                       }
-     }
-   else if(pDevice->bLinkPass == true)
-   	pDevice->byReAssocCount = 0;
-}
+	spin_lock_irq(&pDevice->lock);
+
+	pDevice->uAssocCount = 0;
+
+	//Power Saving Mode Tx Burst
+	if ( pDevice->bEnablePSMode == true ) {
+		pDevice->ulPSModeWaitTx++;
+		if ( pDevice->ulPSModeWaitTx >= 2 ) {
+			pDevice->ulPSModeWaitTx = 0;
+			pDevice->bPSModeTxBurst = false;
+		}
+	}
+
+	pDevice->byERPFlag &=
+		~(WLAN_SET_ERP_BARKER_MODE(1) | WLAN_SET_ERP_NONERP_PRESENT(1));
+
+	if (pDevice->wUseProtectCntDown > 0) {
+		pDevice->wUseProtectCntDown --;
+	}
+	else {
+		// disable protect mode
+		pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1));
+	}
 
- pMgmt->eLastState = pMgmt->eCurrState ;
+	if(pDevice->byReAssocCount > 0) {
+		pDevice->byReAssocCount++;
+		if((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) {  //10 sec timeout
+			printk("Re-association timeout!!!\n");
+			pDevice->byReAssocCount = 0;
+			// if(pDevice->bWPASuppWextEnabled == true)
+			{
+				union iwreq_data  wrqu;
+				memset(&wrqu, 0, sizeof (wrqu));
+				wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+				PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
+				wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
+			}
+		}
+		else if(pDevice->bLinkPass == true)
+			pDevice->byReAssocCount = 0;
+	}
+
+	pMgmt->eLastState = pMgmt->eCurrState ;
 
 	s_uCalculateLinkQual(pDevice);
 
-    for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) {
-
-        if (pMgmt->sNodeDBTable[ii].bActive) {
-            // Increase in-activity counter
-            pMgmt->sNodeDBTable[ii].uInActiveCount++;
-
-            if (ii > 0) {
-                if (pMgmt->sNodeDBTable[ii].uInActiveCount > MAX_INACTIVE_COUNT) {
-                    BSSvRemoveOneNode(pDevice, ii);
-                    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
-                        "Inactive timeout [%d] sec, STA index = [%d] remove\n", MAX_INACTIVE_COUNT, ii);
-                    continue;
-                }
-
-                if (pMgmt->sNodeDBTable[ii].eNodeState >= NODE_ASSOC) {
-
-                    pDevice->uAssocCount++;
-
-                    // check if Non ERP exist
-                    if (pMgmt->sNodeDBTable[ii].uInActiveCount < ERP_RECOVER_COUNT) {
-                        if (!pMgmt->sNodeDBTable[ii].bShortPreamble) {
-                            pDevice->byERPFlag |= WLAN_SET_ERP_BARKER_MODE(1);
-                            uLongPreambleSTACnt ++;
-                        }
-                        if (!pMgmt->sNodeDBTable[ii].bERPExist) {
-                            pDevice->byERPFlag |= WLAN_SET_ERP_NONERP_PRESENT(1);
-                            pDevice->byERPFlag |= WLAN_SET_ERP_USE_PROTECTION(1);
-                        }
-                        if (!pMgmt->sNodeDBTable[ii].bShortSlotTime)
-                            uNonShortSlotSTACnt++;
-                    }
-                }
-
-                // check if any STA in PS mode
-                if (pMgmt->sNodeDBTable[ii].bPSEnable)
-                    uSleepySTACnt++;
-
-            }
-
-            // Rate fallback check
-            if (!pDevice->bFixRate) {
-                if (ii > 0) {
-                    // ii = 0 for multicast node (AP & Adhoc)
-			RATEvTxRateFallBack((void *)pDevice,
-					    &(pMgmt->sNodeDBTable[ii]));
-                }
-                else {
-                    // ii = 0 reserved for unicast AP node (Infra STA)
-			if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)
-				RATEvTxRateFallBack((void *)pDevice,
-						    &(pMgmt->sNodeDBTable[ii]));
-                }
-
-            }
-
-            // check if pending PS queue
-            if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) {
-                DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending \n",
-                           ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt);
-                if ((ii >0) && (pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15)) {
-                    BSSvRemoveOneNode(pDevice, ii);
-                    DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Pending many queues PS STA Index = %d remove \n", ii);
-                    continue;
-                }
-            }
-        }
-
-    }
-
-    if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->byBBType == BB_TYPE_11G)) {
-
-        // on/off protect mode
-        if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) {
-            if (!pDevice->bProtectMode) {
-                MACvEnableProtectMD(pDevice);
-                pDevice->bProtectMode = true;
-            }
-        }
-        else {
-            if (pDevice->bProtectMode) {
-                MACvDisableProtectMD(pDevice);
-                pDevice->bProtectMode = false;
-            }
-        }
-        // on/off short slot time
-
-        if (uNonShortSlotSTACnt > 0) {
-            if (pDevice->bShortSlotTime) {
-                pDevice->bShortSlotTime = false;
-                BBvSetShortSlotTime(pDevice);
-		vUpdateIFS((void *)pDevice);
-            }
-        }
-        else {
-            if (!pDevice->bShortSlotTime) {
-                pDevice->bShortSlotTime = true;
-                BBvSetShortSlotTime(pDevice);
-		vUpdateIFS((void *)pDevice);
-            }
-        }
-
-        // on/off barker long preamble mode
-
-        if (uLongPreambleSTACnt > 0) {
-            if (!pDevice->bBarkerPreambleMd) {
-                MACvEnableBarkerPreambleMd(pDevice);
-                pDevice->bBarkerPreambleMd = true;
-            }
-        }
-        else {
-            if (pDevice->bBarkerPreambleMd) {
-                MACvDisableBarkerPreambleMd(pDevice);
-                pDevice->bBarkerPreambleMd = false;
-            }
-        }
-
-    }
-
-    // Check if any STA in PS mode, enable DTIM multicast deliver
-    if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
-        if (uSleepySTACnt > 0)
-            pMgmt->sNodeDBTable[0].bPSEnable = true;
-        else
-            pMgmt->sNodeDBTable[0].bPSEnable = false;
-    }
-
-    pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
-    pCurrSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
-
-    if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) ||
-        (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) {
-
-        if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS
-
-            if (pDevice->bUpdateBBVGA) {
-		s_vCheckSensitivity(pDevice);
-		s_vCheckPreEDThreshold(pDevice);
-            }
-
-    	    if ((pMgmt->sNodeDBTable[0].uInActiveCount >= (LOST_BEACON_COUNT/2)) &&
-    	        (pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) ) {
-    	        pDevice->byBBVGANew = pDevice->abyBBVGA[0];
-		bScheduleCommand((void *) pDevice,
-				 WLAN_CMD_CHANGE_BBSENSITIVITY,
-				 NULL);
-    	    }
-
-        	if (pMgmt->sNodeDBTable[0].uInActiveCount >= LOST_BEACON_COUNT) {
-                pMgmt->sNodeDBTable[0].bActive = false;
-                pMgmt->eCurrMode = WMAC_MODE_STANDBY;
-                pMgmt->eCurrState = WMAC_STATE_IDLE;
-                netif_stop_queue(pDevice->dev);
-                pDevice->bLinkPass = false;
-                ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW);
-                pDevice->bRoaming = true;
-                pDevice->bIsRoaming = false;
-
-                DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n", pMgmt->sNodeDBTable[0].uInActiveCount);
-		/* let wpa supplicant know AP may disconnect */
-      {
-	union iwreq_data  wrqu;
-	memset(&wrqu, 0, sizeof (wrqu));
-        wrqu.ap_addr.sa_family = ARPHRD_ETHER;
-	PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
-	wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
-     }
-            }
-        }
-        else if (pItemSSID->len != 0) {
-//Davidwang
-      if ((pDevice->bEnableRoaming == true)&&(!(pMgmt->Cisco_cckm))) {
-DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bRoaming %d, !\n", pDevice->bRoaming );
-DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bIsRoaming %d, !\n", pDevice->bIsRoaming );
-          if ((pDevice->bRoaming == true)&&(pDevice->bIsRoaming == true)){
-	    	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fast   Roaming ...\n");
-		BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass);
-		bScheduleCommand((void *) pDevice,
-				 WLAN_CMD_BSSID_SCAN,
-				 pMgmt->abyDesireSSID);
-		bScheduleCommand((void *) pDevice,
-				 WLAN_CMD_SSID,
-				 pMgmt->abyDesireSSID);
-                pDevice->uAutoReConnectTime = 0;
-                pDevice->uIsroamingTime = 0;
-                pDevice->bRoaming = false;
-          }
-      else if ((pDevice->bRoaming == false)&&(pDevice->bIsRoaming == true)) {
-                            pDevice->uIsroamingTime++;
-       if (pDevice->uIsroamingTime >= 20)
-            pDevice->bIsRoaming = false;
-         }
-
-   }
-else {
-            if (pDevice->uAutoReConnectTime < 10) {
-                pDevice->uAutoReConnectTime++;
-                //network manager support need not do Roaming scan???
-                if(pDevice->bWPASuppWextEnabled ==true)
-		 pDevice->uAutoReConnectTime = 0;
-            }
-            else {
-	    //mike use old encryption status for wpa reauthen
-	      if(pDevice->bWPADEVUp)
-	          pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus;
-
-                DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Roaming ...\n");
-		BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass);
-		pMgmt->eScanType = WMAC_SCAN_ACTIVE;
-		bScheduleCommand((void *) pDevice,
-				 WLAN_CMD_BSSID_SCAN,
-				 pMgmt->abyDesireSSID);
-		bScheduleCommand((void *) pDevice,
-				 WLAN_CMD_SSID,
-				 pMgmt->abyDesireSSID);
-                pDevice->uAutoReConnectTime = 0;
-            }
-        }
-    }
-    }
-
-    if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
-        // if adhoc started which essid is NULL string, rescanning.
-        if ((pMgmt->eCurrState == WMAC_STATE_STARTED) && (pCurrSSID->len == 0)) {
-            if (pDevice->uAutoReConnectTime < 10) {
-                pDevice->uAutoReConnectTime++;
-            }
-            else {
-                DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Adhoc re-scanning ...\n");
-	       pMgmt->eScanType = WMAC_SCAN_ACTIVE;
-		bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
-		bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL);
-                pDevice->uAutoReConnectTime = 0;
-            };
-        }
-        if (pMgmt->eCurrState == WMAC_STATE_JOINTED) {
-
-		if (pDevice->bUpdateBBVGA) {
-			s_vCheckSensitivity(pDevice);
-			s_vCheckPreEDThreshold(pDevice);
+	for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) {
+
+		if (pMgmt->sNodeDBTable[ii].bActive) {
+			// Increase in-activity counter
+			pMgmt->sNodeDBTable[ii].uInActiveCount++;
+
+			if (ii > 0) {
+				if (pMgmt->sNodeDBTable[ii].uInActiveCount > MAX_INACTIVE_COUNT) {
+					BSSvRemoveOneNode(pDevice, ii);
+					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+						"Inactive timeout [%d] sec, STA index = [%d] remove\n", MAX_INACTIVE_COUNT, ii);
+					continue;
+				}
+
+				if (pMgmt->sNodeDBTable[ii].eNodeState >= NODE_ASSOC) {
+
+					pDevice->uAssocCount++;
+
+					// check if Non ERP exist
+					if (pMgmt->sNodeDBTable[ii].uInActiveCount < ERP_RECOVER_COUNT) {
+						if (!pMgmt->sNodeDBTable[ii].bShortPreamble) {
+							pDevice->byERPFlag |= WLAN_SET_ERP_BARKER_MODE(1);
+							uLongPreambleSTACnt ++;
+						}
+						if (!pMgmt->sNodeDBTable[ii].bERPExist) {
+							pDevice->byERPFlag |= WLAN_SET_ERP_NONERP_PRESENT(1);
+							pDevice->byERPFlag |= WLAN_SET_ERP_USE_PROTECTION(1);
+						}
+						if (!pMgmt->sNodeDBTable[ii].bShortSlotTime)
+							uNonShortSlotSTACnt++;
+					}
+				}
+
+				// check if any STA in PS mode
+				if (pMgmt->sNodeDBTable[ii].bPSEnable)
+					uSleepySTACnt++;
+
+			}
+
+			// Rate fallback check
+			if (!pDevice->bFixRate) {
+				if (ii > 0) {
+					// ii = 0 for multicast node (AP & Adhoc)
+					RATEvTxRateFallBack((void *)pDevice,
+						&(pMgmt->sNodeDBTable[ii]));
+				}
+				else {
+					// ii = 0 reserved for unicast AP node (Infra STA)
+					if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)
+						RATEvTxRateFallBack((void *)pDevice,
+							&(pMgmt->sNodeDBTable[ii]));
+				}
+
+			}
+
+			// check if pending PS queue
+			if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) {
+				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending \n",
+						   ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt);
+				if ((ii >0) && (pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15)) {
+					BSSvRemoveOneNode(pDevice, ii);
+					DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Pending many queues PS STA Index = %d remove \n", ii);
+					continue;
+				}
+			}
 		}
-        	if (pMgmt->sNodeDBTable[0].uInActiveCount >=ADHOC_LOST_BEACON_COUNT) {
-        	    DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost other STA beacon [%d] sec, started !\n", pMgmt->sNodeDBTable[0].uInActiveCount);
-                pMgmt->sNodeDBTable[0].uInActiveCount = 0;
-                pMgmt->eCurrState = WMAC_STATE_STARTED;
-                netif_stop_queue(pDevice->dev);
-                pDevice->bLinkPass = false;
-                ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW);
-            }
-        }
-    }
+
+	}
+
+	if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->byBBType == BB_TYPE_11G)) {
+
+		// on/off protect mode
+		if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) {
+			if (!pDevice->bProtectMode) {
+				MACvEnableProtectMD(pDevice);
+				pDevice->bProtectMode = true;
+			}
+		}
+		else {
+			if (pDevice->bProtectMode) {
+				MACvDisableProtectMD(pDevice);
+				pDevice->bProtectMode = false;
+			}
+		}
+		// on/off short slot time
+
+		if (uNonShortSlotSTACnt > 0) {
+			if (pDevice->bShortSlotTime) {
+				pDevice->bShortSlotTime = false;
+				BBvSetShortSlotTime(pDevice);
+				vUpdateIFS((void *)pDevice);
+			}
+		}
+		else {
+			if (!pDevice->bShortSlotTime) {
+				pDevice->bShortSlotTime = true;
+				BBvSetShortSlotTime(pDevice);
+				vUpdateIFS((void *)pDevice);
+			}
+		}
+
+		// on/off barker long preamble mode
+
+		if (uLongPreambleSTACnt > 0) {
+			if (!pDevice->bBarkerPreambleMd) {
+				MACvEnableBarkerPreambleMd(pDevice);
+				pDevice->bBarkerPreambleMd = true;
+			}
+		}
+		else {
+			if (pDevice->bBarkerPreambleMd) {
+				MACvDisableBarkerPreambleMd(pDevice);
+				pDevice->bBarkerPreambleMd = false;
+			}
+		}
+
+	}
+
+	// Check if any STA in PS mode, enable DTIM multicast deliver
+	if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
+		if (uSleepySTACnt > 0)
+			pMgmt->sNodeDBTable[0].bPSEnable = true;
+		else
+			pMgmt->sNodeDBTable[0].bPSEnable = false;
+	}
+
+	pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
+	pCurrSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
+
+	if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) ||
+		(pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) {
+
+		if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS
+
+			if (pDevice->bUpdateBBVGA) {
+				s_vCheckSensitivity(pDevice);
+				s_vCheckPreEDThreshold(pDevice);
+			}
+
+			if ((pMgmt->sNodeDBTable[0].uInActiveCount >= (LOST_BEACON_COUNT/2)) &&
+				(pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) ) {
+				pDevice->byBBVGANew = pDevice->abyBBVGA[0];
+				bScheduleCommand((void *) pDevice,
+					WLAN_CMD_CHANGE_BBSENSITIVITY,
+					NULL);
+			}
+
+			if (pMgmt->sNodeDBTable[0].uInActiveCount >= LOST_BEACON_COUNT) {
+				pMgmt->sNodeDBTable[0].bActive = false;
+				pMgmt->eCurrMode = WMAC_MODE_STANDBY;
+				pMgmt->eCurrState = WMAC_STATE_IDLE;
+				netif_stop_queue(pDevice->dev);
+				pDevice->bLinkPass = false;
+				ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW);
+				pDevice->bRoaming = true;
+				pDevice->bIsRoaming = false;
+
+				DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n", pMgmt->sNodeDBTable[0].uInActiveCount);
+				/* let wpa supplicant know AP may disconnect */
+				{
+					union iwreq_data  wrqu;
+					memset(&wrqu, 0, sizeof (wrqu));
+						wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+					PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
+					wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
+				}
+			}
+		}
+		else if (pItemSSID->len != 0) {
+			//Davidwang
+			if ((pDevice->bEnableRoaming == true)&&(!(pMgmt->Cisco_cckm))) {
+				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bRoaming %d, !\n", pDevice->bRoaming );
+				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bIsRoaming %d, !\n", pDevice->bIsRoaming );
+				if ((pDevice->bRoaming == true)&&(pDevice->bIsRoaming == true)){
+					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fast   Roaming ...\n");
+					BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass);
+					bScheduleCommand((void *) pDevice,
+						WLAN_CMD_BSSID_SCAN,
+						pMgmt->abyDesireSSID);
+					bScheduleCommand((void *) pDevice,
+						WLAN_CMD_SSID,
+						pMgmt->abyDesireSSID);
+					pDevice->uAutoReConnectTime = 0;
+					pDevice->uIsroamingTime = 0;
+					pDevice->bRoaming = false;
+				}
+				else if ((pDevice->bRoaming == false)&&(pDevice->bIsRoaming == true)) {
+					pDevice->uIsroamingTime++;
+					if (pDevice->uIsroamingTime >= 20)
+						pDevice->bIsRoaming = false;
+				}
+			}
+			else {
+				if (pDevice->uAutoReConnectTime < 10) {
+					pDevice->uAutoReConnectTime++;
+					//network manager support need not do Roaming scan???
+					if(pDevice->bWPASuppWextEnabled ==true)
+						pDevice->uAutoReConnectTime = 0;
+				}
+				else {
+					//mike use old encryption status for wpa reauthen
+					if(pDevice->bWPADEVUp)
+						pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus;
+
+					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Roaming ...\n");
+					BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass);
+					pMgmt->eScanType = WMAC_SCAN_ACTIVE;
+					bScheduleCommand((void *) pDevice,
+							 WLAN_CMD_BSSID_SCAN,
+							 pMgmt->abyDesireSSID);
+					bScheduleCommand((void *) pDevice,
+							 WLAN_CMD_SSID,
+							 pMgmt->abyDesireSSID);
+					pDevice->uAutoReConnectTime = 0;
+				}
+			}
+		}
+	}
+
+	if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
+		// if adhoc started which essid is NULL string, rescanning.
+		if ((pMgmt->eCurrState == WMAC_STATE_STARTED) && (pCurrSSID->len == 0)) {
+			if (pDevice->uAutoReConnectTime < 10) {
+				pDevice->uAutoReConnectTime++;
+			}
+			else {
+				DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Adhoc re-scanning ...\n");
+				pMgmt->eScanType = WMAC_SCAN_ACTIVE;
+				bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
+				bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL);
+				pDevice->uAutoReConnectTime = 0;
+			};
+		}
+		if (pMgmt->eCurrState == WMAC_STATE_JOINTED) {
+
+			if (pDevice->bUpdateBBVGA) {
+				s_vCheckSensitivity(pDevice);
+				s_vCheckPreEDThreshold(pDevice);
+			}
+			if (pMgmt->sNodeDBTable[0].uInActiveCount >=ADHOC_LOST_BEACON_COUNT) {
+				DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost other STA beacon [%d] sec, started !\n", pMgmt->sNodeDBTable[0].uInActiveCount);
+				pMgmt->sNodeDBTable[0].uInActiveCount = 0;
+				pMgmt->eCurrState = WMAC_STATE_STARTED;
+				netif_stop_queue(pDevice->dev);
+				pDevice->bLinkPass = false;
+				ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW);
+			}
+		}
+	}
 
 	if (pDevice->bLinkPass == true) {
 		if (pMgmt->eAuthenMode < WMAC_AUTH_WPA ||
@@ -1142,7 +1147,7 @@ else {
 			netif_wake_queue(pDevice->dev);
 	}
 
-    spin_unlock_irq(&pDevice->lock);
+	spin_unlock_irq(&pDevice->lock);
 
 	schedule_delayed_work(&pDevice->second_callback_work, HZ);
 }
@@ -1152,11 +1157,11 @@ else {
  * Routine Description:
  *
  *
- *  Update Tx attemps, Tx failure counter in Node DB
+ *	Update Tx attemps, Tx failure counter in Node DB
  *
  *
  * Return Value:
- *    none.
+ *	  none.
  *
 -*/
 
@@ -1174,170 +1179,170 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 	u8 byPktNum;
 	u16 wFIFOCtl;
 
-    byPktNum = (byPktNO & 0x0F) >> 4;
-    byTxRetry = (byTSR & 0xF0) >> 4;
-    wRate = (u16) (byPktNO & 0xF0) >> 4;
-    wFIFOCtl = pkt_info[byPktNum].fifo_ctl;
-    pbyDestAddr = pkt_info[byPktNum].dest_addr;
-
-    if (wFIFOCtl & FIFOCTL_AUTO_FB_0) {
-        byFallBack = AUTO_FB_0;
-    } else if (wFIFOCtl & FIFOCTL_AUTO_FB_1) {
-        byFallBack = AUTO_FB_1;
-    } else {
-        byFallBack = AUTO_FB_NONE;
-    }
-
-    // Only Unicast using support rates
-    if (wFIFOCtl & FIFOCTL_NEEDACK) {
-        if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
-            pMgmt->sNodeDBTable[0].uTxAttempts += 1;
-            if ( !(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
-                // transmit success, TxAttempts at least plus one
-                pMgmt->sNodeDBTable[0].uTxOk[MAX_RATE]++;
-                if ( (byFallBack == AUTO_FB_NONE) ||
-                     (wRate < RATE_18M) ) {
-                    wFallBackRate = wRate;
-                } else if (byFallBack == AUTO_FB_0) {
-                    if (byTxRetry < 5)
-                        wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry];
-                    else
-                        wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
-                } else if (byFallBack == AUTO_FB_1) {
-                    if (byTxRetry < 5)
-                        wFallBackRate = awHWRetry1[wRate-RATE_18M][byTxRetry];
-                    else
-                        wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
-                }
-                pMgmt->sNodeDBTable[0].uTxOk[wFallBackRate]++;
-            } else {
-                pMgmt->sNodeDBTable[0].uTxFailures ++;
-            }
-            pMgmt->sNodeDBTable[0].uTxRetry += byTxRetry;
-            if (byTxRetry != 0) {
-                pMgmt->sNodeDBTable[0].uTxFail[MAX_RATE]+=byTxRetry;
-                if ( (byFallBack == AUTO_FB_NONE) ||
-                     (wRate < RATE_18M) ) {
-                    pMgmt->sNodeDBTable[0].uTxFail[wRate]+=byTxRetry;
-                } else if (byFallBack == AUTO_FB_0) {
-			for (ii = 0; ii < byTxRetry; ii++) {
-				if (ii < 5)
-					wFallBackRate =
-						awHWRetry0[wRate-RATE_18M][ii];
-				else
-					wFallBackRate =
-						awHWRetry0[wRate-RATE_18M][4];
-				pMgmt->sNodeDBTable[0].uTxFail[wFallBackRate]++;
+	byPktNum = (byPktNO & 0x0F) >> 4;
+	byTxRetry = (byTSR & 0xF0) >> 4;
+	wRate = (u16) (byPktNO & 0xF0) >> 4;
+	wFIFOCtl = pkt_info[byPktNum].fifo_ctl;
+	pbyDestAddr = pkt_info[byPktNum].dest_addr;
+
+	if (wFIFOCtl & FIFOCTL_AUTO_FB_0) {
+		byFallBack = AUTO_FB_0;
+	} else if (wFIFOCtl & FIFOCTL_AUTO_FB_1) {
+		byFallBack = AUTO_FB_1;
+	} else {
+		byFallBack = AUTO_FB_NONE;
+	}
+
+	// Only Unicast using support rates
+	if (wFIFOCtl & FIFOCTL_NEEDACK) {
+		if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
+			pMgmt->sNodeDBTable[0].uTxAttempts += 1;
+			if ( !(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
+				// transmit success, TxAttempts at least plus one
+				pMgmt->sNodeDBTable[0].uTxOk[MAX_RATE]++;
+				if ( (byFallBack == AUTO_FB_NONE) ||
+					 (wRate < RATE_18M) ) {
+					wFallBackRate = wRate;
+				} else if (byFallBack == AUTO_FB_0) {
+					if (byTxRetry < 5)
+						wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry];
+					else
+						wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
+				} else if (byFallBack == AUTO_FB_1) {
+					if (byTxRetry < 5)
+						wFallBackRate = awHWRetry1[wRate-RATE_18M][byTxRetry];
+					else
+						wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
+				}
+				pMgmt->sNodeDBTable[0].uTxOk[wFallBackRate]++;
+			} else {
+				pMgmt->sNodeDBTable[0].uTxFailures ++;
 			}
-                } else if (byFallBack == AUTO_FB_1) {
-			for (ii = 0; ii < byTxRetry; ii++) {
-				if (ii < 5)
-					wFallBackRate =
-						awHWRetry1[wRate-RATE_18M][ii];
-				else
-					wFallBackRate =
-						awHWRetry1[wRate-RATE_18M][4];
-				pMgmt->sNodeDBTable[0].uTxFail[wFallBackRate]++;
+			pMgmt->sNodeDBTable[0].uTxRetry += byTxRetry;
+			if (byTxRetry != 0) {
+				pMgmt->sNodeDBTable[0].uTxFail[MAX_RATE]+=byTxRetry;
+				if ( (byFallBack == AUTO_FB_NONE) ||
+					(wRate < RATE_18M) ) {
+					pMgmt->sNodeDBTable[0].uTxFail[wRate]+=byTxRetry;
+				} else if (byFallBack == AUTO_FB_0) {
+					for (ii = 0; ii < byTxRetry; ii++) {
+						if (ii < 5)
+							wFallBackRate =
+								awHWRetry0[wRate-RATE_18M][ii];
+						else
+							wFallBackRate =
+								awHWRetry0[wRate-RATE_18M][4];
+						pMgmt->sNodeDBTable[0].uTxFail[wFallBackRate]++;
+					}
+				} else if (byFallBack == AUTO_FB_1) {
+					for (ii = 0; ii < byTxRetry; ii++) {
+						if (ii < 5)
+							wFallBackRate =
+								awHWRetry1[wRate-RATE_18M][ii];
+						else
+							wFallBackRate =
+								awHWRetry1[wRate-RATE_18M][4];
+						pMgmt->sNodeDBTable[0].uTxFail[wFallBackRate]++;
+					}
+				}
+			}
+		}
+
+		if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
+			(pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
+
+			if (BSSbIsSTAInNodeDB((void *) pDevice,
+						  pbyDestAddr,
+						  &uNodeIndex)) {
+				pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1;
+				if ( !(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
+					// transmit success, TxAttempts at least plus one
+					pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++;
+					if ( (byFallBack == AUTO_FB_NONE) ||
+						(wRate < RATE_18M) ) {
+						wFallBackRate = wRate;
+					} else if (byFallBack == AUTO_FB_0) {
+						if (byTxRetry < 5)
+							wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry];
+						else
+							wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
+					} else if (byFallBack == AUTO_FB_1) {
+						if (byTxRetry < 5)
+							wFallBackRate = awHWRetry1[wRate-RATE_18M][byTxRetry];
+						else
+							wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
+					}
+					pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wFallBackRate]++;
+				} else {
+					pMgmt->sNodeDBTable[uNodeIndex].uTxFailures ++;
+				}
+				pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += byTxRetry;
+				if (byTxRetry != 0) {
+					pMgmt->sNodeDBTable[uNodeIndex].uTxFail[MAX_RATE]+=byTxRetry;
+					if ( (byFallBack == AUTO_FB_NONE) ||
+						(wRate < RATE_18M) ) {
+						pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wRate]+=byTxRetry;
+					} else if (byFallBack == AUTO_FB_0) {
+						for (ii = 0; ii < byTxRetry; ii++) {
+							if (ii < 5)
+								wFallBackRate =
+									awHWRetry0[wRate-RATE_18M][ii];
+							else
+								wFallBackRate =
+									awHWRetry0[wRate-RATE_18M][4];
+							pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++;
+						}
+					} else if (byFallBack == AUTO_FB_1) {
+						for (ii = 0; ii < byTxRetry; ii++) {
+							if (ii < 5)
+								wFallBackRate = awHWRetry1[wRate-RATE_18M][ii];
+							else
+								wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
+							pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++;
+						}
+					}
+				}
 			}
-                }
-            }
-        }
-
-	if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
-            (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
-
-		if (BSSbIsSTAInNodeDB((void *) pDevice,
-				      pbyDestAddr,
-				      &uNodeIndex)) {
-			pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1;
-                if ( !(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
-                    // transmit success, TxAttempts at least plus one
-                    pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++;
-                    if ( (byFallBack == AUTO_FB_NONE) ||
-                         (wRate < RATE_18M) ) {
-                        wFallBackRate = wRate;
-                    } else if (byFallBack == AUTO_FB_0) {
-                        if (byTxRetry < 5)
-                            wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry];
-                        else
-                            wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
-                    } else if (byFallBack == AUTO_FB_1) {
-                        if (byTxRetry < 5)
-                            wFallBackRate = awHWRetry1[wRate-RATE_18M][byTxRetry];
-                        else
-                            wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
-                    }
-                    pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wFallBackRate]++;
-                } else {
-                    pMgmt->sNodeDBTable[uNodeIndex].uTxFailures ++;
-                }
-                pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += byTxRetry;
-                if (byTxRetry != 0) {
-                    pMgmt->sNodeDBTable[uNodeIndex].uTxFail[MAX_RATE]+=byTxRetry;
-                    if ( (byFallBack == AUTO_FB_NONE) ||
-                         (wRate < RATE_18M) ) {
-                        pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wRate]+=byTxRetry;
-                    } else if (byFallBack == AUTO_FB_0) {
-			for (ii = 0; ii < byTxRetry; ii++) {
-				if (ii < 5)
-					wFallBackRate =
-						awHWRetry0[wRate-RATE_18M][ii];
-				else
-					wFallBackRate =
-						awHWRetry0[wRate-RATE_18M][4];
-				pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++;
-                        }
-                    } else if (byFallBack == AUTO_FB_1) {
-		      for (ii = 0; ii < byTxRetry; ii++) {
-			if (ii < 5)
-                                wFallBackRate = awHWRetry1[wRate-RATE_18M][ii];
-			else
-                                wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
-			pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++;
-		      }
-                    }
-                }
-            }
-        }
-    }
+		}
+	}
 }
 
 /*+
  *
  * Routine Description:
- *    Clear Nodes & skb in DB Table
+ *	  Clear Nodes & skb in DB Table
  *
  *
  * Parameters:
- *  In:
- *      hDeviceContext        - The adapter context.
- *      uStartIndex           - starting index
- *  Out:
- *      none
+ *	In:
+ *		hDeviceContext	- The adapter context.
+ *		uStartIndex	- starting index
+ *	Out:
+ *		none
  *
  * Return Value:
- *    None.
+ *	  None.
  *
 -*/
 
 void BSSvClearNodeDBTable(struct vnt_private *pDevice, u32 uStartIndex)
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
-	struct sk_buff  *skb;
+	struct sk_buff	*skb;
 	int ii;
 
-    for (ii = uStartIndex; ii < (MAX_NODE_NUM + 1); ii++) {
-        if (pMgmt->sNodeDBTable[ii].bActive) {
-            // check if sTxPSQueue has been initial
-            if (pMgmt->sNodeDBTable[ii].sTxPSQueue.next != NULL) {
-                while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL){
-                        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS skb != NULL %d\n", ii);
-                        dev_kfree_skb(skb);
-                }
-            }
-            memset(&pMgmt->sNodeDBTable[ii], 0, sizeof(KnownNodeDB));
-        }
-    }
+	for (ii = uStartIndex; ii < (MAX_NODE_NUM + 1); ii++) {
+		if (pMgmt->sNodeDBTable[ii].bActive) {
+			// check if sTxPSQueue has been initial
+			if (pMgmt->sNodeDBTable[ii].sTxPSQueue.next != NULL) {
+				while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL){
+					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS skb != NULL %d\n", ii);
+					dev_kfree_skb(skb);
+				}
+			}
+			memset(&pMgmt->sNodeDBTable[ii], 0, sizeof(KnownNodeDB));
+		}
+	}
 };
 
 static void s_vCheckSensitivity(struct vnt_private *pDevice)
@@ -1346,40 +1351,40 @@ static void s_vCheckSensitivity(struct vnt_private *pDevice)
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 	int ii;
 
-    if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
-        ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) {
-        pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID);
-        if (pBSSList != NULL) {
-		/* Update BB register if RSSI is too strong */
-		signed long    LocalldBmAverage = 0;
-		signed long    uNumofdBm = 0;
-            for (ii = 0; ii < RSSI_STAT_COUNT; ii++) {
-                if (pBSSList->ldBmAverage[ii] != 0) {
-                    uNumofdBm ++;
-                    LocalldBmAverage += pBSSList->ldBmAverage[ii];
-                }
-            }
-            if (uNumofdBm > 0) {
-                LocalldBmAverage = LocalldBmAverage/uNumofdBm;
-                for (ii=0;ii<BB_VGA_LEVEL;ii++) {
-                    DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LocalldBmAverage:%ld, %ld %02x\n", LocalldBmAverage, pDevice->ldBmThreshold[ii], pDevice->abyBBVGA[ii]);
-                    if (LocalldBmAverage < pDevice->ldBmThreshold[ii]) {
-                	    pDevice->byBBVGANew = pDevice->abyBBVGA[ii];
-                        break;
-                    }
-                }
-                if (pDevice->byBBVGANew != pDevice->byBBVGACurrent) {
-                    pDevice->uBBVGADiffCount++;
-                    if (pDevice->uBBVGADiffCount >= BB_VGA_CHANGE_THRESHOLD)
-			bScheduleCommand(pDevice,
-					 WLAN_CMD_CHANGE_BBSENSITIVITY,
-					 NULL);
-                } else {
-                    pDevice->uBBVGADiffCount = 0;
-                }
-            }
-        }
-    }
+	if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
+		((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) {
+		pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID);
+		if (pBSSList != NULL) {
+			/* Update BB register if RSSI is too strong */
+			signed long    LocalldBmAverage = 0;
+			signed long    uNumofdBm = 0;
+			for (ii = 0; ii < RSSI_STAT_COUNT; ii++) {
+				if (pBSSList->ldBmAverage[ii] != 0) {
+					uNumofdBm ++;
+					LocalldBmAverage += pBSSList->ldBmAverage[ii];
+				}
+			}
+			if (uNumofdBm > 0) {
+				LocalldBmAverage = LocalldBmAverage/uNumofdBm;
+				for (ii=0;ii<BB_VGA_LEVEL;ii++) {
+					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LocalldBmAverage:%ld, %ld %02x\n", LocalldBmAverage, pDevice->ldBmThreshold[ii], pDevice->abyBBVGA[ii]);
+					if (LocalldBmAverage < pDevice->ldBmThreshold[ii]) {
+						pDevice->byBBVGANew = pDevice->abyBBVGA[ii];
+						break;
+					}
+				}
+				if (pDevice->byBBVGANew != pDevice->byBBVGACurrent) {
+					pDevice->uBBVGADiffCount++;
+					if (pDevice->uBBVGADiffCount >= BB_VGA_CHANGE_THRESHOLD)
+						bScheduleCommand(pDevice,
+							WLAN_CMD_CHANGE_BBSENSITIVITY,
+							NULL);
+				} else {
+					pDevice->uBBVGADiffCount = 0;
+				}
+			}
+		}
+	}
 }
 
 static void s_uCalculateLinkQual(struct vnt_private *pDevice)
@@ -1436,13 +1441,13 @@ static void s_vCheckPreEDThreshold(struct vnt_private *pDevice)
 	PKnownBSS pBSSList = NULL;
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 
-    if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
-        ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) {
-        pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID);
-        if (pBSSList != NULL) {
-            pDevice->byBBPreEDRSSI = (u8) (~(pBSSList->ldBmAverRange) + 1);
-            BBvUpdatePreEDThreshold(pDevice, false);
-        }
-    }
+	if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
+		((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) {
+		pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID);
+		if (pBSSList != NULL) {
+			pDevice->byBBPreEDRSSI = (u8) (~(pBSSList->ldBmAverRange) + 1);
+			BBvUpdatePreEDThreshold(pDevice, false);
+		}
+	}
 }
 
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 02/13] Staging: vt6656: Adjust comments in bssdb.c
  2014-01-04 15:25 [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 01/13] Staging: vt6656: Fix indentation of bssdb.c Sebastian Rachuj
@ 2014-01-04 15:25 ` Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 03/13] Staging: vt6656: Remove unnecessary semicolons Sebastian Rachuj
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sebastian Rachuj @ 2014-01-04 15:25 UTC (permalink / raw)
  To: sebastian.rachuj
  Cc: linux-kernel, linux, forest, gregkh, more.andres, tvboxspy,
	devel, linux-kernel

From: Simon Schuster <linux@rationality.eu>

Changes C99-style comments to C89-style ones to conform to the linux
coding guidelines. Additionally removes plus and minus signs from the
function description comments.

Signed-off-by: Sebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: Simon Schuster <linux@rationality.eu>
---
 drivers/staging/vt6656/bssdb.c | 218 +++++++++++++++++------------------------
 1 file changed, 91 insertions(+), 127 deletions(-)

diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index a670272..d727662 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -36,7 +36,6 @@
  * Author: Lyndon Chen
  *
  * Date: July 17, 2002
- *
  */
 
 #include "tmacro.h"
@@ -60,7 +59,7 @@
 #include "power.h"
 
 static int msglevel =MSG_LEVEL_INFO;
-//static int msglevel =MSG_LEVEL_DEBUG;
+/* static int msglevel =MSG_LEVEL_DEBUG; */
 
 static const u16 awHWRetry0[5][5] = {
 			{RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
@@ -81,16 +80,13 @@ static void s_vCheckSensitivity(struct vnt_private *pDevice);
 static void s_vCheckPreEDThreshold(struct vnt_private *pDevice);
 static void s_uCalculateLinkQual(struct vnt_private *pDevice);
 
-/*+
- *
+/*
  * Routine Description:
  *	  Search known BSS list for Desire SSID or BSSID.
  *
  * Return Value:
  *	  PTR to KnownBSS or NULL
- *
--*/
-
+ */
 PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 			    u8 *pbyDesireBSSID, u8 *pbyDesireSSID,
 			    CARD_PHY_TYPE ePhyType)
@@ -119,7 +115,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 	}
 
 	if ((pbyBSSID != NULL)&&(pDevice->bRoaming == false)) {
-		// match BSSID first
+		/* match BSSID first */
 		for (ii = 0; ii <MAX_BSS_NUM; ii++) {
 			pCurrBSS = &(pMgmt->sBSSList[ii]);
 
@@ -129,7 +125,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 				(pCurrBSS->bSelected == false)) {
 				if (ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) {
 					if (pSSID != NULL) {
-						// compare ssid
+						/* compare ssid */
 						if ( !memcmp(pSSID->abySSID,
 							((PWLAN_IE_SSID)pCurrBSS->abySSID)->abySSID,
 							pSSID->len)) {
@@ -154,31 +150,31 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 			}
 		}
 	} else {
-		// ignore BSSID
+		/* ignore BSSID */
 		for (ii = 0; ii <MAX_BSS_NUM; ii++) {
 			pCurrBSS = &(pMgmt->sBSSList[ii]);
 
-			//2007-0721-01<Mark>by MikeLiu
-			//   if ((pCurrBSS->bActive) &&
-			//		  (pCurrBSS->bSelected == false)) {
+			/* 2007-0721-01<Mark>by MikeLiu
+			 *   if ((pCurrBSS->bActive) &&
+			 *		  (pCurrBSS->bSelected == false)) { */
 
 			pCurrBSS->bSelected = false;
 			if (pCurrBSS->bActive) {
 
 				if (pSSID != NULL) {
-					// matched SSID
+					/* matched SSID */
 					if (memcmp(pSSID->abySSID,
 						((PWLAN_IE_SSID)pCurrBSS->abySSID)->abySSID,
 						pSSID->len) ||
 						(pSSID->len != ((PWLAN_IE_SSID)pCurrBSS->abySSID)->len)) {
-						// SSID not match skip this BSS
+						/* SSID not match skip this BSS */
 						continue;
 					  }
 				}
 				if (((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) ||
 					((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))
 					){
-					// Type not match skip this BSS
+					/* Type not match skip this BSS */
 					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSS type mismatch.... Config[%d] BSS[0x%04x]\n", pMgmt->eConfigMode, pCurrBSS->wCapInfo);
 					continue;
 				}
@@ -186,7 +182,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 				if (ePhyType != PHY_TYPE_AUTO) {
 					if (((ePhyType == PHY_TYPE_11A) && (PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse)) ||
 						((ePhyType != PHY_TYPE_11A) && (PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) {
-						// PhyType not match skip this BSS
+						/* PhyType not match skip this BSS */
 						DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse);
 						continue;
 					}
@@ -201,7 +197,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 				if (pSelect == NULL) {
 					pSelect = pCurrBSS;
 				} else {
-					// compare RSSI, select the strongest signal
+					/* compare RSSI, select the strongest signal */
 					if (pCurrBSS->uRSSI < pSelect->uRSSI) {
 						pSelect = pCurrBSS;
 					}
@@ -214,7 +210,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 		if (pSelect != NULL) {
 			pSelect->bSelected = true;
 			if (pDevice->bRoaming == false)  {
-				// Einsn Add @20070907
+				/* Einsn Add @20070907 */
 				memcpy(pbyDesireSSID,pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1) ;
 			}
 
@@ -225,16 +221,13 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 
 }
 
-/*+
- *
+/*
  * Routine Description:
  *	  Clear BSS List
  *
  * Return Value:
  *	  None.
- *
--*/
-
+ */
 void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID)
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
@@ -246,12 +239,13 @@ void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID)
 				ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID,
 				pMgmt->abyCurrBSSID)) {
 
-				//mike mark:
-				//there are two BSSID's in list. If that AP is
-				//in hidden ssid mode, one SSID is null, but
-				//other's might not be obvious, so if it
-				//associate's with your STA, you must keep the
-				//two of them!!  bKeepCurrBSSID = false;
+				/* mike mark:
+				 * there are two BSSID's in list. If that AP is
+				 * in hidden ssid mode, one SSID is null, but
+				 * other's might not be obvious, so if it
+				 * associate's with your STA, you must keep the
+				 * two of them!!  bKeepCurrBSSID = false;
+				 */
 
 				continue;
 			}
@@ -263,15 +257,13 @@ void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID)
 	BSSvClearAnyBSSJoinRecord(pDevice);
 }
 
-/*+
- *
+/*
  * Routine Description:
  *	  search BSS list by BSSID & SSID if matched
  *
  * Return Value:
  *	  true if found.
- *
--*/
+ */
 PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice,
 			      u8 *abyBSSID,
 			      PWLAN_IE_SSID pSSID)
@@ -297,16 +289,13 @@ PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice,
 	return NULL;
 };
 
-/*+
- *
+/*
  * Routine Description:
  *	  Insert a BSS set into known BSS list
  *
  * Return Value:
  *	  true if success.
- *
--*/
-
+ */
 int BSSbInsertToBSSList(struct vnt_private *pDevice,
 			u8 *abyBSSIDAddr,
 			u64 qwTimestamp,
@@ -344,7 +333,7 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get free KnowBSS node failed.\n");
 		return false;
 	}
-	// save the BSS info
+	/* save the BSS info */
 	pBSSList->bActive = true;
 	memcpy( pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN);
 	pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp);
@@ -374,7 +363,7 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 	pBSSList->sERP.byERP = psERP->byERP;
 	pBSSList->sERP.bERPExist = psERP->bERPExist;
 
-	// Check if BSS is 802.11a/b/g
+	/* Check if BSS is 802.11a/b/g */
 	if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) {
 		pBSSList->eNetworkTypeInUse = PHY_TYPE_11A;
 	} else {
@@ -392,7 +381,7 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 
 	if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
 		(pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
-		// assoc with BSS
+		/* assoc with BSS */
 		if (pBSSList == pMgmt->pCurrBSS) {
 			bParsingQuiet = true;
 		}
@@ -455,7 +444,7 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 	}
 
 	if (pDevice->bUpdateBBVGA) {
-		// Monitor if RSSI is too strong.
+		/* Monitor if RSSI is too strong. */
 		pBSSList->byRSSIStatCnt = 0;
 		RFvRSSITodBm(pDevice, (u8)(pRxPacket->uRSSI), &pBSSList->ldBmMAX);
 		pBSSList->ldBmAverage[0] = pBSSList->ldBmMAX;
@@ -472,17 +461,14 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 	return true;
 }
 
-/*+
- *
+/*
  * Routine Description:
  *	  Update BSS set in known BSS list
  *
  * Return Value:
  *	  true if success.
- *
--*/
-// TODO: input structure modify
-
+ */
+/* TODO: input structure modify */
 int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 			u64 qwTimestamp,
 			u16 wBeaconInterval,
@@ -534,7 +520,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 	pBSSList->sERP.byERP = psERP->byERP;
 	pBSSList->sERP.bERPExist = psERP->bERPExist;
 
-	// Check if BSS is 802.11a/b/g
+	/* Check if BSS is 802.11a/b/g */
 	if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) {
 		pBSSList->eNetworkTypeInUse = PHY_TYPE_11A;
 	} else {
@@ -553,13 +539,13 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 
 	if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
 		(pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
-		// assoc with BSS
+		/* assoc with BSS */
 		if (pBSSList == pMgmt->pCurrBSS) {
 			bParsingQuiet = true;
 		}
 	}
 
-	WPA_ClearRSN(pBSSList); //mike update
+	WPA_ClearRSN(pBSSList); /* mike update */
 
 	if (pRSNWPA != NULL) {
 		unsigned int uLen = pRSNWPA->len + 2;
@@ -571,7 +557,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 		}
 	}
 
-	WPA2_ClearRSN(pBSSList); //mike update
+	WPA2_ClearRSN(pBSSList); /* mike update */
 
 	if (pRSN != NULL) {
 		unsigned int uLen = pRSN->len + 2;
@@ -585,7 +571,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 
 	if (pRxPacket->uRSSI != 0) {
 		RFvRSSITodBm(pDevice, (u8)(pRxPacket->uRSSI), &ldBm);
-		// Monitor if RSSI is too strong.
+		/* Monitor if RSSI is too strong. */
 		pBSSList->byRSSIStatCnt++;
 		pBSSList->byRSSIStatCnt %= RSSI_STAT_COUNT;
 		pBSSList->ldBmAverage[pBSSList->byRSSIStatCnt] = ldBm;
@@ -610,16 +596,13 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 	return true;
 }
 
-/*+
- *
+/*
  * Routine Description:
  *	  Search Node DB table to find the index of matched DstAddr
  *
  * Return Value:
  *	  None
- *
--*/
-
+ */
 int BSSbIsSTAInNodeDB(struct vnt_private *pDevice,
 		      u8 *abyDstAddr,
 		      u32 *puNodeIndex)
@@ -627,7 +610,7 @@ int BSSbIsSTAInNodeDB(struct vnt_private *pDevice,
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 	unsigned int ii;
 
-	// Index = 0 reserved for AP Node
+	/* Index = 0 reserved for AP Node */
 	for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
 		if (pMgmt->sNodeDBTable[ii].bActive) {
 			if (ether_addr_equal(abyDstAddr,
@@ -641,16 +624,14 @@ int BSSbIsSTAInNodeDB(struct vnt_private *pDevice,
 	return false;
 };
 
-/*+
- *
+/*
  * Routine Description:
  *	  Find an empty node and allocate it; if no empty node
  *	  is found, then use the most inactive one.
  *
  * Return Value:
  *	  None
- *
--*/
+ */
 void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex)
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
@@ -659,8 +640,8 @@ void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex)
 	u32 SelectIndex;
 	struct sk_buff *skb;
 
-	// Index = 0 reserved for AP Node (In STA mode)
-	// Index = 0 reserved for Broadcast/MultiCast (In AP mode)
+	/* Index = 0 reserved for AP Node (In STA mode)
+	   Index = 0 reserved for Broadcast/MultiCast (In AP mode) */
 	SelectIndex = 1;
 	for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
 		if (pMgmt->sNodeDBTable[ii].bActive) {
@@ -674,11 +655,11 @@ void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex)
 		}
 	}
 
-	// if not found replace uInActiveCount with the largest one.
+	/* if not found replace uInActiveCount with the largest one. */
 	if ( ii == (MAX_NODE_NUM + 1)) {
 		*puNodeIndex = SelectIndex;
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Replace inactive node = %d\n", SelectIndex);
-		// clear ps buffer
+		/* clear ps buffer */
 		if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next != NULL) {
 			while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)) != NULL)
 				dev_kfree_skb(skb);
@@ -691,24 +672,21 @@ void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex)
 	memset(&pMgmt->sNodeDBTable[*puNodeIndex], 0, sizeof(KnownNodeDB));
 	pMgmt->sNodeDBTable[*puNodeIndex].bActive = true;
 	pMgmt->sNodeDBTable[*puNodeIndex].uRatePollTimeout = FALLBACK_POLL_SECOND;
-	// for AP mode PS queue
+	/* for AP mode PS queue */
 	skb_queue_head_init(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue);
 	pMgmt->sNodeDBTable[*puNodeIndex].byAuthSequence = 0;
 	pMgmt->sNodeDBTable[*puNodeIndex].wEnQueueCnt = 0;
 	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii);
 };
 
-/*+
- *
+/*
  * Routine Description:
  *	  Remove Node by NodeIndex
  *
  *
  * Return Value:
  *	  None
- *
--*/
-
+ */
 void BSSvRemoveOneNode(struct vnt_private *pDevice, u32 uNodeIndex)
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
@@ -717,22 +695,20 @@ void BSSvRemoveOneNode(struct vnt_private *pDevice, u32 uNodeIndex)
 
 	while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue)) != NULL)
 		dev_kfree_skb(skb);
-	// clear context
+	/* clear context */
 	memset(&pMgmt->sNodeDBTable[uNodeIndex], 0, sizeof(KnownNodeDB));
-	// clear tx bit map
+	/* clear tx bit map */
 	pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[uNodeIndex].wAID >> 3] &=  ~byMask[pMgmt->sNodeDBTable[uNodeIndex].wAID & 7];
 };
-/*+
- *
+
+/*
  * Routine Description:
  *	  Update AP Node content in Index 0 of KnownNodeDB
  *
  *
  * Return Value:
  *	  None
- *
--*/
-
+ */
 void BSSvUpdateAPNode(struct vnt_private *pDevice,
 		      u16 *pwCapInfo,
 		      PWLAN_IE_SUPP_RATES pSuppRates,
@@ -766,23 +742,20 @@ void BSSvUpdateAPNode(struct vnt_private *pDevice,
 	pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxSuppRate;
 	pMgmt->sNodeDBTable[0].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(*pwCapInfo);
 	pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND;
-	// Auto rate fallback function initiation.
-	// RATEbInit(pDevice);
+	/* Auto rate fallback function initiation.
+	 * RATEbInit(pDevice); */
 	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate);
 
 };
 
-/*+
- *
+/*
  * Routine Description:
  *	  Add Multicast Node content in Index 0 of KnownNodeDB
  *
  *
  * Return Value:
  *	  None
- *
--*/
-
+ */
 void BSSvAddMulticastNode(struct vnt_private *pDevice)
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
@@ -807,8 +780,7 @@ void BSSvAddMulticastNode(struct vnt_private *pDevice)
 
 };
 
-/*+
- *
+/*
  * Routine Description:
  *
  *
@@ -817,9 +789,7 @@ void BSSvAddMulticastNode(struct vnt_private *pDevice)
  *
  * Return Value:
  *	  none.
- *
--*/
-
+ */
 void BSSvSecondCallBack(struct work_struct *work)
 {
 	struct vnt_private *pDevice = container_of(work,
@@ -838,7 +808,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 
 	pDevice->uAssocCount = 0;
 
-	//Power Saving Mode Tx Burst
+	/* Power Saving Mode Tx Burst */
 	if ( pDevice->bEnablePSMode == true ) {
 		pDevice->ulPSModeWaitTx++;
 		if ( pDevice->ulPSModeWaitTx >= 2 ) {
@@ -854,16 +824,16 @@ void BSSvSecondCallBack(struct work_struct *work)
 		pDevice->wUseProtectCntDown --;
 	}
 	else {
-		// disable protect mode
+		/* disable protect mode */
 		pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1));
 	}
 
 	if(pDevice->byReAssocCount > 0) {
 		pDevice->byReAssocCount++;
-		if((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) {  //10 sec timeout
+		if((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) {  /* 10 sec timeout */
 			printk("Re-association timeout!!!\n");
 			pDevice->byReAssocCount = 0;
-			// if(pDevice->bWPASuppWextEnabled == true)
+			/* if(pDevice->bWPASuppWextEnabled == true) */
 			{
 				union iwreq_data  wrqu;
 				memset(&wrqu, 0, sizeof (wrqu));
@@ -883,7 +853,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 	for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) {
 
 		if (pMgmt->sNodeDBTable[ii].bActive) {
-			// Increase in-activity counter
+			/* Increase in-activity counter */
 			pMgmt->sNodeDBTable[ii].uInActiveCount++;
 
 			if (ii > 0) {
@@ -898,7 +868,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 
 					pDevice->uAssocCount++;
 
-					// check if Non ERP exist
+					/* check if Non ERP exist */
 					if (pMgmt->sNodeDBTable[ii].uInActiveCount < ERP_RECOVER_COUNT) {
 						if (!pMgmt->sNodeDBTable[ii].bShortPreamble) {
 							pDevice->byERPFlag |= WLAN_SET_ERP_BARKER_MODE(1);
@@ -913,21 +883,21 @@ void BSSvSecondCallBack(struct work_struct *work)
 					}
 				}
 
-				// check if any STA in PS mode
+				/* check if any STA in PS mode */
 				if (pMgmt->sNodeDBTable[ii].bPSEnable)
 					uSleepySTACnt++;
 
 			}
 
-			// Rate fallback check
+			/* Rate fallback check */
 			if (!pDevice->bFixRate) {
 				if (ii > 0) {
-					// ii = 0 for multicast node (AP & Adhoc)
+					/* ii = 0 for multicast node (AP & Adhoc) */
 					RATEvTxRateFallBack((void *)pDevice,
 						&(pMgmt->sNodeDBTable[ii]));
 				}
 				else {
-					// ii = 0 reserved for unicast AP node (Infra STA)
+					/* ii = 0 reserved for unicast AP node (Infra STA) */
 					if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)
 						RATEvTxRateFallBack((void *)pDevice,
 							&(pMgmt->sNodeDBTable[ii]));
@@ -935,7 +905,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 
 			}
 
-			// check if pending PS queue
+			/* check if pending PS queue */
 			if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) {
 				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending \n",
 						   ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt);
@@ -951,7 +921,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 
 	if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->byBBType == BB_TYPE_11G)) {
 
-		// on/off protect mode
+		/* on/off protect mode */
 		if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) {
 			if (!pDevice->bProtectMode) {
 				MACvEnableProtectMD(pDevice);
@@ -964,7 +934,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 				pDevice->bProtectMode = false;
 			}
 		}
-		// on/off short slot time
+		/* on/off short slot time */
 
 		if (uNonShortSlotSTACnt > 0) {
 			if (pDevice->bShortSlotTime) {
@@ -981,7 +951,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 			}
 		}
 
-		// on/off barker long preamble mode
+		/* on/off barker long preamble mode */
 
 		if (uLongPreambleSTACnt > 0) {
 			if (!pDevice->bBarkerPreambleMd) {
@@ -998,7 +968,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 
 	}
 
-	// Check if any STA in PS mode, enable DTIM multicast deliver
+	/* Check if any STA in PS mode, enable DTIM multicast deliver */
 	if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
 		if (uSleepySTACnt > 0)
 			pMgmt->sNodeDBTable[0].bPSEnable = true;
@@ -1012,7 +982,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 	if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) ||
 		(pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) {
 
-		if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS
+		if (pMgmt->sNodeDBTable[0].bActive) { /* Assoc with BSS */
 
 			if (pDevice->bUpdateBBVGA) {
 				s_vCheckSensitivity(pDevice);
@@ -1049,7 +1019,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 			}
 		}
 		else if (pItemSSID->len != 0) {
-			//Davidwang
+			/* Davidwang */
 			if ((pDevice->bEnableRoaming == true)&&(!(pMgmt->Cisco_cckm))) {
 				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bRoaming %d, !\n", pDevice->bRoaming );
 				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bIsRoaming %d, !\n", pDevice->bIsRoaming );
@@ -1075,12 +1045,12 @@ void BSSvSecondCallBack(struct work_struct *work)
 			else {
 				if (pDevice->uAutoReConnectTime < 10) {
 					pDevice->uAutoReConnectTime++;
-					//network manager support need not do Roaming scan???
+					/* network manager support need not do Roaming scan??? */
 					if(pDevice->bWPASuppWextEnabled ==true)
 						pDevice->uAutoReConnectTime = 0;
 				}
 				else {
-					//mike use old encryption status for wpa reauthen
+					/* mike use old encryption status for wpa reauthen */
 					if(pDevice->bWPADEVUp)
 						pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus;
 
@@ -1100,7 +1070,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 	}
 
 	if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
-		// if adhoc started which essid is NULL string, rescanning.
+		/* if adhoc started which essid is NULL string, rescanning. */
 		if ((pMgmt->eCurrState == WMAC_STATE_STARTED) && (pCurrSSID->len == 0)) {
 			if (pDevice->uAutoReConnectTime < 10) {
 				pDevice->uAutoReConnectTime++;
@@ -1152,8 +1122,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 	schedule_delayed_work(&pDevice->second_callback_work, HZ);
 }
 
-/*+
- *
+/*
  * Routine Description:
  *
  *
@@ -1162,9 +1131,7 @@ void BSSvSecondCallBack(struct work_struct *work)
  *
  * Return Value:
  *	  none.
- *
--*/
-
+ */
 void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
@@ -1193,12 +1160,12 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 		byFallBack = AUTO_FB_NONE;
 	}
 
-	// Only Unicast using support rates
+	/* Only Unicast using support rates */
 	if (wFIFOCtl & FIFOCTL_NEEDACK) {
 		if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
 			pMgmt->sNodeDBTable[0].uTxAttempts += 1;
 			if ( !(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
-				// transmit success, TxAttempts at least plus one
+				/* transmit success, TxAttempts at least plus one */
 				pMgmt->sNodeDBTable[0].uTxOk[MAX_RATE]++;
 				if ( (byFallBack == AUTO_FB_NONE) ||
 					 (wRate < RATE_18M) ) {
@@ -1256,7 +1223,7 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 						  &uNodeIndex)) {
 				pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1;
 				if ( !(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
-					// transmit success, TxAttempts at least plus one
+					/* transmit success, TxAttempts at least plus one */
 					pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++;
 					if ( (byFallBack == AUTO_FB_NONE) ||
 						(wRate < RATE_18M) ) {
@@ -1307,8 +1274,7 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 	}
 }
 
-/*+
- *
+/*
  * Routine Description:
  *	  Clear Nodes & skb in DB Table
  *
@@ -1322,9 +1288,7 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
  *
  * Return Value:
  *	  None.
- *
--*/
-
+ */
 void BSSvClearNodeDBTable(struct vnt_private *pDevice, u32 uStartIndex)
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
@@ -1333,7 +1297,7 @@ void BSSvClearNodeDBTable(struct vnt_private *pDevice, u32 uStartIndex)
 
 	for (ii = uStartIndex; ii < (MAX_NODE_NUM + 1); ii++) {
 		if (pMgmt->sNodeDBTable[ii].bActive) {
-			// check if sTxPSQueue has been initial
+			/* check if sTxPSQueue has been initial */
 			if (pMgmt->sNodeDBTable[ii].sTxPSQueue.next != NULL) {
 				while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL){
 					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS skb != NULL %d\n", ii);
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 03/13] Staging: vt6656: Remove unnecessary semicolons
  2014-01-04 15:25 [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 01/13] Staging: vt6656: Fix indentation of bssdb.c Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 02/13] Staging: vt6656: Adjust comments in bssdb.c Sebastian Rachuj
@ 2014-01-04 15:25 ` Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 04/13] Staging: vt6656: Correct operator coding style Sebastian Rachuj
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sebastian Rachuj @ 2014-01-04 15:25 UTC (permalink / raw)
  To: sebastian.rachuj
  Cc: linux-kernel, linux, forest, gregkh, more.andres, tvboxspy,
	devel, linux-kernel

From: Simon Schuster <linux@rationality.eu>

After some blocks in bssdb.c there are semicolons that are not
required to be there. Therefore they are removed with this patch.

Signed-off-by: Sebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: Simon Schuster <linux@rationality.eu>
---
 drivers/staging/vt6656/bssdb.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index d727662..e9c61ee 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -287,7 +287,7 @@ PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice,
 	}
 
 	return NULL;
-};
+}
 
 /*
  * Routine Description:
@@ -677,7 +677,7 @@ void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex)
 	pMgmt->sNodeDBTable[*puNodeIndex].byAuthSequence = 0;
 	pMgmt->sNodeDBTable[*puNodeIndex].wEnQueueCnt = 0;
 	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii);
-};
+}
 
 /*
  * Routine Description:
@@ -699,7 +699,7 @@ void BSSvRemoveOneNode(struct vnt_private *pDevice, u32 uNodeIndex)
 	memset(&pMgmt->sNodeDBTable[uNodeIndex], 0, sizeof(KnownNodeDB));
 	/* clear tx bit map */
 	pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[uNodeIndex].wAID >> 3] &=  ~byMask[pMgmt->sNodeDBTable[uNodeIndex].wAID & 7];
-};
+}
 
 /*
  * Routine Description:
@@ -746,7 +746,7 @@ void BSSvUpdateAPNode(struct vnt_private *pDevice,
 	 * RATEbInit(pDevice); */
 	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate);
 
-};
+}
 
 /*
  * Routine Description:
@@ -778,7 +778,7 @@ void BSSvAddMulticastNode(struct vnt_private *pDevice)
 	pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxBasicRate;
 	pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND;
 
-};
+}
 
 /*
  * Routine Description:
@@ -1081,7 +1081,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 				bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
 				bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL);
 				pDevice->uAutoReConnectTime = 0;
-			};
+			}
 		}
 		if (pMgmt->eCurrState == WMAC_STATE_JOINTED) {
 
@@ -1307,7 +1307,7 @@ void BSSvClearNodeDBTable(struct vnt_private *pDevice, u32 uStartIndex)
 			memset(&pMgmt->sNodeDBTable[ii], 0, sizeof(KnownNodeDB));
 		}
 	}
-};
+}
 
 static void s_vCheckSensitivity(struct vnt_private *pDevice)
 {
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 04/13] Staging: vt6656: Correct operator coding style
  2014-01-04 15:25 [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c Sebastian Rachuj
                   ` (2 preceding siblings ...)
  2014-01-04 15:25 ` [PATCH 03/13] Staging: vt6656: Remove unnecessary semicolons Sebastian Rachuj
@ 2014-01-04 15:25 ` Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 05/13] Staging: vt6656: Correct single space mistakes Sebastian Rachuj
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sebastian Rachuj @ 2014-01-04 15:25 UTC (permalink / raw)
  To: sebastian.rachuj
  Cc: linux-kernel, linux, forest, gregkh, more.andres, tvboxspy,
	devel, linux-kernel

From: Simon Schuster <linux@rationality.eu>

Adds spaces around operators (like &&, ||, !=, +, ...) and removes
spaces before postfix increment and decrement operators. Parentheses
around return values are removed, too.

Signed-off-by: Sebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: Simon Schuster <linux@rationality.eu>
---
 drivers/staging/vt6656/bssdb.c | 64 +++++++++++++++++++++---------------------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index e9c61ee..84bac2d 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -58,8 +58,8 @@
 #include "iowpa.h"
 #include "power.h"
 
-static int msglevel =MSG_LEVEL_INFO;
-/* static int msglevel =MSG_LEVEL_DEBUG; */
+static int msglevel = MSG_LEVEL_INFO;
+/* static int msglevel = MSG_LEVEL_DEBUG; */
 
 static const u16 awHWRetry0[5][5] = {
 			{RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
@@ -104,7 +104,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
 			"BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID);
 		if ((!is_broadcast_ether_addr(pbyDesireBSSID)) &&
-			(memcmp(pbyDesireBSSID, ZeroBSSID, 6)!= 0)){
+			(memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)){
 				pbyBSSID = pbyDesireBSSID;
 		}
 	}
@@ -114,9 +114,9 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 		}
 	}
 
-	if ((pbyBSSID != NULL)&&(pDevice->bRoaming == false)) {
+	if ((pbyBSSID != NULL) && (pDevice->bRoaming == false)) {
 		/* match BSSID first */
-		for (ii = 0; ii <MAX_BSS_NUM; ii++) {
+		for (ii = 0; ii < MAX_BSS_NUM; ii++) {
 			pCurrBSS = &(pMgmt->sBSSList[ii]);
 
 			pCurrBSS->bSelected = false;
@@ -134,7 +134,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 								((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))
 								) {
 								pCurrBSS->bSelected = true;
-								return(pCurrBSS);
+								return pCurrBSS;
 							}
 						}
 					} else {
@@ -143,7 +143,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 							((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))
 							) {
 							pCurrBSS->bSelected = true;
-							return(pCurrBSS);
+							return pCurrBSS;
 						}
 					}
 				}
@@ -151,7 +151,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 		}
 	} else {
 		/* ignore BSSID */
-		for (ii = 0; ii <MAX_BSS_NUM; ii++) {
+		for (ii = 0; ii < MAX_BSS_NUM; ii++) {
 			pCurrBSS = &(pMgmt->sBSSList[ii]);
 
 			/* 2007-0721-01<Mark>by MikeLiu
@@ -211,13 +211,13 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 			pSelect->bSelected = true;
 			if (pDevice->bRoaming == false)  {
 				/* Einsn Add @20070907 */
-				memcpy(pbyDesireSSID,pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1) ;
+				memcpy(pbyDesireSSID, pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1) ;
 			}
 
-			return(pSelect);
+			return pSelect;
 		}
 	}
-	return(NULL);
+	return NULL;
 
 }
 
@@ -418,7 +418,7 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 		PSKeyItem  pTransmitKey = NULL;
 		bool	   bIs802_1x = false;
 
-		for (ii = 0; ii < pBSSList->wAKMSSAuthCount; ii ++) {
+		for (ii = 0; ii < pBSSList->wAKMSSAuthCount; ii++) {
 			if (pBSSList->abyAKMSSAuthType[ii] == WLAN_11i_AKMSS_802_1X) {
 				bIs802_1x = true;
 				break;
@@ -510,10 +510,10 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 
 	if ((pSSID->len != 0) && (pSSID->abySSID[0] != 0))
 		memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
-	memcpy(pBSSList->abySuppRates, pSuppRates,pSuppRates->len + WLAN_IEHDR_LEN);
+	memcpy(pBSSList->abySuppRates, pSuppRates, pSuppRates->len + WLAN_IEHDR_LEN);
 
 	if (pExtSuppRates != NULL) {
-		memcpy(pBSSList->abyExtSuppRates, pExtSuppRates,pExtSuppRates->len + WLAN_IEHDR_LEN);
+		memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, pExtSuppRates->len + WLAN_IEHDR_LEN);
 	} else {
 		memset(pBSSList->abyExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
 	}
@@ -585,7 +585,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 				jj++;
 			}
 		}
-		pBSSList->ldBmAverRange = ldBmSum /jj;
+		pBSSList->ldBmAverRange = ldBmSum / jj;
 	}
 
 	pBSSList->uIELength = uIELength;
@@ -821,7 +821,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 		~(WLAN_SET_ERP_BARKER_MODE(1) | WLAN_SET_ERP_NONERP_PRESENT(1));
 
 	if (pDevice->wUseProtectCntDown > 0) {
-		pDevice->wUseProtectCntDown --;
+		pDevice->wUseProtectCntDown--;
 	}
 	else {
 		/* disable protect mode */
@@ -872,7 +872,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 					if (pMgmt->sNodeDBTable[ii].uInActiveCount < ERP_RECOVER_COUNT) {
 						if (!pMgmt->sNodeDBTable[ii].bShortPreamble) {
 							pDevice->byERPFlag |= WLAN_SET_ERP_BARKER_MODE(1);
-							uLongPreambleSTACnt ++;
+							uLongPreambleSTACnt++;
 						}
 						if (!pMgmt->sNodeDBTable[ii].bERPExist) {
 							pDevice->byERPFlag |= WLAN_SET_ERP_NONERP_PRESENT(1);
@@ -909,7 +909,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 			if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) {
 				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending \n",
 						   ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt);
-				if ((ii >0) && (pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15)) {
+				if ((ii > 0) && (pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15)) {
 					BSSvRemoveOneNode(pDevice, ii);
 					DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Pending many queues PS STA Index = %d remove \n", ii);
 					continue;
@@ -1003,7 +1003,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 				pMgmt->eCurrState = WMAC_STATE_IDLE;
 				netif_stop_queue(pDevice->dev);
 				pDevice->bLinkPass = false;
-				ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW);
+				ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW);
 				pDevice->bRoaming = true;
 				pDevice->bIsRoaming = false;
 
@@ -1023,7 +1023,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 			if ((pDevice->bEnableRoaming == true)&&(!(pMgmt->Cisco_cckm))) {
 				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bRoaming %d, !\n", pDevice->bRoaming );
 				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bIsRoaming %d, !\n", pDevice->bIsRoaming );
-				if ((pDevice->bRoaming == true)&&(pDevice->bIsRoaming == true)){
+				if ((pDevice->bRoaming == true) && (pDevice->bIsRoaming == true)){
 					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fast   Roaming ...\n");
 					BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass);
 					bScheduleCommand((void *) pDevice,
@@ -1036,7 +1036,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 					pDevice->uIsroamingTime = 0;
 					pDevice->bRoaming = false;
 				}
-				else if ((pDevice->bRoaming == false)&&(pDevice->bIsRoaming == true)) {
+				else if ((pDevice->bRoaming == false) && (pDevice->bIsRoaming == true)) {
 					pDevice->uIsroamingTime++;
 					if (pDevice->uIsroamingTime >= 20)
 						pDevice->bIsRoaming = false;
@@ -1046,7 +1046,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 				if (pDevice->uAutoReConnectTime < 10) {
 					pDevice->uAutoReConnectTime++;
 					/* network manager support need not do Roaming scan??? */
-					if(pDevice->bWPASuppWextEnabled ==true)
+					if(pDevice->bWPASuppWextEnabled == true)
 						pDevice->uAutoReConnectTime = 0;
 				}
 				else {
@@ -1089,13 +1089,13 @@ void BSSvSecondCallBack(struct work_struct *work)
 				s_vCheckSensitivity(pDevice);
 				s_vCheckPreEDThreshold(pDevice);
 			}
-			if (pMgmt->sNodeDBTable[0].uInActiveCount >=ADHOC_LOST_BEACON_COUNT) {
+			if (pMgmt->sNodeDBTable[0].uInActiveCount >= ADHOC_LOST_BEACON_COUNT) {
 				DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost other STA beacon [%d] sec, started !\n", pMgmt->sNodeDBTable[0].uInActiveCount);
 				pMgmt->sNodeDBTable[0].uInActiveCount = 0;
 				pMgmt->eCurrState = WMAC_STATE_STARTED;
 				netif_stop_queue(pDevice->dev);
 				pDevice->bLinkPass = false;
-				ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW);
+				ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW);
 			}
 		}
 	}
@@ -1183,14 +1183,14 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 				}
 				pMgmt->sNodeDBTable[0].uTxOk[wFallBackRate]++;
 			} else {
-				pMgmt->sNodeDBTable[0].uTxFailures ++;
+				pMgmt->sNodeDBTable[0].uTxFailures++;
 			}
 			pMgmt->sNodeDBTable[0].uTxRetry += byTxRetry;
 			if (byTxRetry != 0) {
-				pMgmt->sNodeDBTable[0].uTxFail[MAX_RATE]+=byTxRetry;
+				pMgmt->sNodeDBTable[0].uTxFail[MAX_RATE] += byTxRetry;
 				if ( (byFallBack == AUTO_FB_NONE) ||
 					(wRate < RATE_18M) ) {
-					pMgmt->sNodeDBTable[0].uTxFail[wRate]+=byTxRetry;
+					pMgmt->sNodeDBTable[0].uTxFail[wRate] += byTxRetry;
 				} else if (byFallBack == AUTO_FB_0) {
 					for (ii = 0; ii < byTxRetry; ii++) {
 						if (ii < 5)
@@ -1241,14 +1241,14 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 					}
 					pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wFallBackRate]++;
 				} else {
-					pMgmt->sNodeDBTable[uNodeIndex].uTxFailures ++;
+					pMgmt->sNodeDBTable[uNodeIndex].uTxFailures++;
 				}
 				pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += byTxRetry;
 				if (byTxRetry != 0) {
-					pMgmt->sNodeDBTable[uNodeIndex].uTxFail[MAX_RATE]+=byTxRetry;
+					pMgmt->sNodeDBTable[uNodeIndex].uTxFail[MAX_RATE] += byTxRetry;
 					if ( (byFallBack == AUTO_FB_NONE) ||
 						(wRate < RATE_18M) ) {
-						pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wRate]+=byTxRetry;
+						pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wRate] += byTxRetry;
 					} else if (byFallBack == AUTO_FB_0) {
 						for (ii = 0; ii < byTxRetry; ii++) {
 							if (ii < 5)
@@ -1324,13 +1324,13 @@ static void s_vCheckSensitivity(struct vnt_private *pDevice)
 			signed long    uNumofdBm = 0;
 			for (ii = 0; ii < RSSI_STAT_COUNT; ii++) {
 				if (pBSSList->ldBmAverage[ii] != 0) {
-					uNumofdBm ++;
+					uNumofdBm++;
 					LocalldBmAverage += pBSSList->ldBmAverage[ii];
 				}
 			}
 			if (uNumofdBm > 0) {
 				LocalldBmAverage = LocalldBmAverage/uNumofdBm;
-				for (ii=0;ii<BB_VGA_LEVEL;ii++) {
+				for (ii = 0; ii < BB_VGA_LEVEL; ii++) {
 					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LocalldBmAverage:%ld, %ld %02x\n", LocalldBmAverage, pDevice->ldBmThreshold[ii], pDevice->abyBBVGA[ii]);
 					if (LocalldBmAverage < pDevice->ldBmThreshold[ii]) {
 						pDevice->byBBVGANew = pDevice->abyBBVGA[ii];
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 05/13] Staging: vt6656: Correct single space mistakes
  2014-01-04 15:25 [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c Sebastian Rachuj
                   ` (3 preceding siblings ...)
  2014-01-04 15:25 ` [PATCH 04/13] Staging: vt6656: Correct operator coding style Sebastian Rachuj
@ 2014-01-04 15:25 ` Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 06/13] Staging: vt6656: Remove line feeds before else Sebastian Rachuj
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sebastian Rachuj @ 2014-01-04 15:25 UTC (permalink / raw)
  To: sebastian.rachuj
  Cc: linux-kernel, linux, forest, gregkh, more.andres, tvboxspy,
	devel, linux-kernel

From: Simon Schuster <linux@rationality.eu>

Adds missing spaces between an if-statement and its condition as well
as between the condition and the following curly brace. At casts
there is also a space added between the type and the variable.

Spaces that either follow an opening parenthese or the sizeof operator
or that preceed semicolons are removed as well.

Signed-off-by: Sebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: Simon Schuster <linux@rationality.eu>
---
 drivers/staging/vt6656/bssdb.c | 136 ++++++++++++++++++++---------------------
 1 file changed, 68 insertions(+), 68 deletions(-)

diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index 84bac2d..38c267b 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -104,12 +104,12 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
 			"BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID);
 		if ((!is_broadcast_ether_addr(pbyDesireBSSID)) &&
-			(memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)){
+			(memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)) {
 				pbyBSSID = pbyDesireBSSID;
 		}
 	}
 	if (pbyDesireSSID != NULL) {
-		if (((PWLAN_IE_SSID)pbyDesireSSID)->len != 0) {
+		if (((PWLAN_IE_SSID) pbyDesireSSID)->len != 0) {
 			pSSID = (PWLAN_IE_SSID) pbyDesireSSID;
 		}
 	}
@@ -126,8 +126,8 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 				if (ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) {
 					if (pSSID != NULL) {
 						/* compare ssid */
-						if ( !memcmp(pSSID->abySSID,
-							((PWLAN_IE_SSID)pCurrBSS->abySSID)->abySSID,
+						if (!memcmp(pSSID->abySSID,
+							((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
 							pSSID->len)) {
 							if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
 								((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
@@ -164,16 +164,16 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 				if (pSSID != NULL) {
 					/* matched SSID */
 					if (memcmp(pSSID->abySSID,
-						((PWLAN_IE_SSID)pCurrBSS->abySSID)->abySSID,
+						((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
 						pSSID->len) ||
-						(pSSID->len != ((PWLAN_IE_SSID)pCurrBSS->abySSID)->len)) {
+						(pSSID->len != ((PWLAN_IE_SSID) pCurrBSS->abySSID)->len)) {
 						/* SSID not match skip this BSS */
 						continue;
 					  }
 				}
 				if (((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) ||
 					((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))
-					){
+					) {
 					/* Type not match skip this BSS */
 					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSS type mismatch.... Config[%d] BSS[0x%04x]\n", pMgmt->eConfigMode, pCurrBSS->wCapInfo);
 					continue;
@@ -211,7 +211,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 			pSelect->bSelected = true;
 			if (pDevice->bRoaming == false)  {
 				/* Einsn Add @20070907 */
-				memcpy(pbyDesireSSID, pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1) ;
+				memcpy(pbyDesireSSID, pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
 			}
 
 			return pSelect;
@@ -276,9 +276,9 @@ PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice,
 		pBSSList = &(pMgmt->sBSSList[ii]);
 		if (pBSSList->bActive) {
 			if (ether_addr_equal(pBSSList->abyBSSID, abyBSSID)) {
-				if (pSSID->len == ((PWLAN_IE_SSID)pBSSList->abySSID)->len){
+				if (pSSID->len == ((PWLAN_IE_SSID) pBSSList->abySSID)->len) {
 					if (memcmp(pSSID->abySSID,
-						((PWLAN_IE_SSID)pBSSList->abySSID)->abySSID,
+						((PWLAN_IE_SSID) pBSSList->abySSID)->abySSID,
 						pSSID->len) == 0)
 						return pBSSList;
 				}
@@ -316,26 +316,26 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 	struct vnt_rx_mgmt *pRxPacket =
-		(struct vnt_rx_mgmt *)pRxPacketContext;
+		(struct vnt_rx_mgmt *) pRxPacketContext;
 	PKnownBSS pBSSList = NULL;
 	unsigned int ii;
 	bool bParsingQuiet = false;
 
-	pBSSList = (PKnownBSS)&(pMgmt->sBSSList[0]);
+	pBSSList = (PKnownBSS) &(pMgmt->sBSSList[0]);
 
 	for (ii = 0; ii < MAX_BSS_NUM; ii++) {
-		pBSSList = (PKnownBSS)&(pMgmt->sBSSList[ii]);
+		pBSSList = (PKnownBSS) &(pMgmt->sBSSList[ii]);
 		if (!pBSSList->bActive)
 			break;
 	}
 
-	if (ii == MAX_BSS_NUM){
+	if (ii == MAX_BSS_NUM) {
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get free KnowBSS node failed.\n");
 		return false;
 	}
 	/* save the BSS info */
 	pBSSList->bActive = true;
-	memcpy( pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN);
+	memcpy(pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN);
 	pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp);
 	pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
 	pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
@@ -343,13 +343,13 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 
 	if (pSSID->len > WLAN_SSID_MAXLEN)
 		pSSID->len = WLAN_SSID_MAXLEN;
-	memcpy( pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
+	memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
 
 	pBSSList->uChannel = byCurrChannel;
 
 	if (pSuppRates->len > WLAN_RATES_MAXLEN)
 		pSuppRates->len = WLAN_RATES_MAXLEN;
-	memcpy( pBSSList->abySuppRates, pSuppRates, pSuppRates->len + WLAN_IEHDR_LEN);
+	memcpy(pBSSList->abySuppRates, pSuppRates, pSuppRates->len + WLAN_IEHDR_LEN);
 
 	if (pExtSuppRates != NULL) {
 		if (pExtSuppRates->len > WLAN_RATES_MAXLEN)
@@ -424,8 +424,8 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 				break;
 			}
 		}
-		if ((bIs802_1x == true) && (pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len) &&
-			( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID, pSSID->len))) {
+		if ((bIs802_1x == true) && (pSSID->len == ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->len) &&
+			(!memcmp(pSSID->abySSID, ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->abySSID, pSSID->len))) {
 
 			bAdd_PMKID_Candidate((void *) pDevice,
 					 pBSSList->abyBSSID,
@@ -446,7 +446,7 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 	if (pDevice->bUpdateBBVGA) {
 		/* Monitor if RSSI is too strong. */
 		pBSSList->byRSSIStatCnt = 0;
-		RFvRSSITodBm(pDevice, (u8)(pRxPacket->uRSSI), &pBSSList->ldBmMAX);
+		RFvRSSITodBm(pDevice, (u8) (pRxPacket->uRSSI), &pBSSList->ldBmMAX);
 		pBSSList->ldBmAverage[0] = pBSSList->ldBmMAX;
 		pBSSList->ldBmAverRange = pBSSList->ldBmMAX;
 		for (ii = 1; ii < RSSI_STAT_COUNT; ii++)
@@ -490,7 +490,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 {
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 	struct vnt_rx_mgmt *pRxPacket =
-		(struct vnt_rx_mgmt *)pRxPacketContext;
+		(struct vnt_rx_mgmt *) pRxPacketContext;
 	int ii, jj;
 	signed long ldBm, ldBmSum;
 	bool bParsingQuiet = false;
@@ -533,7 +533,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 
 	pBSSList->byRxRate = pRxPacket->byRxRate;
 	pBSSList->qwLocalTSF = pRxPacket->qwLocalTSF;
-	if(bChannelHit)
+	if (bChannelHit)
 		pBSSList->uRSSI = pRxPacket->uRSSI;
 	pBSSList->bySQ = pRxPacket->bySQ;
 
@@ -570,7 +570,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 	}
 
 	if (pRxPacket->uRSSI != 0) {
-		RFvRSSITodBm(pDevice, (u8)(pRxPacket->uRSSI), &ldBm);
+		RFvRSSITodBm(pDevice, (u8) (pRxPacket->uRSSI), &ldBm);
 		/* Monitor if RSSI is too strong. */
 		pBSSList->byRSSIStatCnt++;
 		pBSSList->byRSSIStatCnt %= RSSI_STAT_COUNT;
@@ -656,7 +656,7 @@ void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex)
 	}
 
 	/* if not found replace uInActiveCount with the largest one. */
-	if ( ii == (MAX_NODE_NUM + 1)) {
+	if (ii == (MAX_NODE_NUM + 1)) {
 		*puNodeIndex = SelectIndex;
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Replace inactive node = %d\n", SelectIndex);
 		/* clear ps buffer */
@@ -723,15 +723,15 @@ void BSSvUpdateAPNode(struct vnt_private *pDevice,
 	if (pDevice->byBBType == BB_TYPE_11B) {
 		uRateLen = WLAN_RATES_MAXLEN_11B;
 	}
-	pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pSuppRates,
-						(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
+	pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES) pSuppRates,
+						(PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates,
 						uRateLen);
-	pMgmt->abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pExtSuppRates,
-						(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates,
+	pMgmt->abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES) pExtSuppRates,
+						(PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates,
 						uRateLen);
 	RATEvParseMaxRate((void *) pDevice,
-			  (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
-			  (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates,
+			  (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates,
+			  (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates,
 			  true,
 			  &(pMgmt->sNodeDBTable[0].wMaxBasicRate),
 			  &(pMgmt->sNodeDBTable[0].wMaxSuppRate),
@@ -767,8 +767,8 @@ void BSSvAddMulticastNode(struct vnt_private *pDevice)
 	pMgmt->sNodeDBTable[0].bPSEnable = false;
 	skb_queue_head_init(&pMgmt->sNodeDBTable[0].sTxPSQueue);
 	RATEvParseMaxRate((void *) pDevice,
-			  (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
-			  (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates,
+			  (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates,
+			  (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates,
 			  true,
 			  &(pMgmt->sNodeDBTable[0].wMaxBasicRate),
 			  &(pMgmt->sNodeDBTable[0].wMaxSuppRate),
@@ -809,9 +809,9 @@ void BSSvSecondCallBack(struct work_struct *work)
 	pDevice->uAssocCount = 0;
 
 	/* Power Saving Mode Tx Burst */
-	if ( pDevice->bEnablePSMode == true ) {
+	if (pDevice->bEnablePSMode == true) {
 		pDevice->ulPSModeWaitTx++;
-		if ( pDevice->ulPSModeWaitTx >= 2 ) {
+		if (pDevice->ulPSModeWaitTx >= 2) {
 			pDevice->ulPSModeWaitTx = 0;
 			pDevice->bPSModeTxBurst = false;
 		}
@@ -828,25 +828,25 @@ void BSSvSecondCallBack(struct work_struct *work)
 		pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1));
 	}
 
-	if(pDevice->byReAssocCount > 0) {
+	if (pDevice->byReAssocCount > 0) {
 		pDevice->byReAssocCount++;
-		if((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) {  /* 10 sec timeout */
+		if ((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) {  /* 10 sec timeout */
 			printk("Re-association timeout!!!\n");
 			pDevice->byReAssocCount = 0;
-			/* if(pDevice->bWPASuppWextEnabled == true) */
+			/* if (pDevice->bWPASuppWextEnabled == true) */
 			{
 				union iwreq_data  wrqu;
-				memset(&wrqu, 0, sizeof (wrqu));
+				memset(&wrqu, 0, sizeof(wrqu));
 				wrqu.ap_addr.sa_family = ARPHRD_ETHER;
 				PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
 				wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
 			}
 		}
-		else if(pDevice->bLinkPass == true)
+		else if (pDevice->bLinkPass == true)
 			pDevice->byReAssocCount = 0;
 	}
 
-	pMgmt->eLastState = pMgmt->eCurrState ;
+	pMgmt->eLastState = pMgmt->eCurrState;
 
 	s_uCalculateLinkQual(pDevice);
 
@@ -893,13 +893,13 @@ void BSSvSecondCallBack(struct work_struct *work)
 			if (!pDevice->bFixRate) {
 				if (ii > 0) {
 					/* ii = 0 for multicast node (AP & Adhoc) */
-					RATEvTxRateFallBack((void *)pDevice,
+					RATEvTxRateFallBack((void *) pDevice,
 						&(pMgmt->sNodeDBTable[ii]));
 				}
 				else {
 					/* ii = 0 reserved for unicast AP node (Infra STA) */
 					if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)
-						RATEvTxRateFallBack((void *)pDevice,
+						RATEvTxRateFallBack((void *) pDevice,
 							&(pMgmt->sNodeDBTable[ii]));
 				}
 
@@ -940,14 +940,14 @@ void BSSvSecondCallBack(struct work_struct *work)
 			if (pDevice->bShortSlotTime) {
 				pDevice->bShortSlotTime = false;
 				BBvSetShortSlotTime(pDevice);
-				vUpdateIFS((void *)pDevice);
+				vUpdateIFS((void *) pDevice);
 			}
 		}
 		else {
 			if (!pDevice->bShortSlotTime) {
 				pDevice->bShortSlotTime = true;
 				BBvSetShortSlotTime(pDevice);
-				vUpdateIFS((void *)pDevice);
+				vUpdateIFS((void *) pDevice);
 			}
 		}
 
@@ -976,8 +976,8 @@ void BSSvSecondCallBack(struct work_struct *work)
 			pMgmt->sNodeDBTable[0].bPSEnable = false;
 	}
 
-	pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
-	pCurrSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
+	pItemSSID = (PWLAN_IE_SSID) pMgmt->abyDesireSSID;
+	pCurrSSID = (PWLAN_IE_SSID) pMgmt->abyCurrSSID;
 
 	if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) ||
 		(pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) {
@@ -990,7 +990,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 			}
 
 			if ((pMgmt->sNodeDBTable[0].uInActiveCount >= (LOST_BEACON_COUNT/2)) &&
-				(pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) ) {
+				(pDevice->byBBVGACurrent != pDevice->abyBBVGA[0])) {
 				pDevice->byBBVGANew = pDevice->abyBBVGA[0];
 				bScheduleCommand((void *) pDevice,
 					WLAN_CMD_CHANGE_BBSENSITIVITY,
@@ -1011,7 +1011,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 				/* let wpa supplicant know AP may disconnect */
 				{
 					union iwreq_data  wrqu;
-					memset(&wrqu, 0, sizeof (wrqu));
+					memset(&wrqu, 0, sizeof(wrqu));
 						wrqu.ap_addr.sa_family = ARPHRD_ETHER;
 					PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
 					wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
@@ -1021,9 +1021,9 @@ void BSSvSecondCallBack(struct work_struct *work)
 		else if (pItemSSID->len != 0) {
 			/* Davidwang */
 			if ((pDevice->bEnableRoaming == true)&&(!(pMgmt->Cisco_cckm))) {
-				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bRoaming %d, !\n", pDevice->bRoaming );
-				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bIsRoaming %d, !\n", pDevice->bIsRoaming );
-				if ((pDevice->bRoaming == true) && (pDevice->bIsRoaming == true)){
+				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bRoaming %d, !\n", pDevice->bRoaming);
+				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bIsRoaming %d, !\n", pDevice->bIsRoaming);
+				if ((pDevice->bRoaming == true) && (pDevice->bIsRoaming == true)) {
 					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fast   Roaming ...\n");
 					BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass);
 					bScheduleCommand((void *) pDevice,
@@ -1046,12 +1046,12 @@ void BSSvSecondCallBack(struct work_struct *work)
 				if (pDevice->uAutoReConnectTime < 10) {
 					pDevice->uAutoReConnectTime++;
 					/* network manager support need not do Roaming scan??? */
-					if(pDevice->bWPASuppWextEnabled == true)
+					if (pDevice->bWPASuppWextEnabled == true)
 						pDevice->uAutoReConnectTime = 0;
 				}
 				else {
 					/* mike use old encryption status for wpa reauthen */
-					if(pDevice->bWPADEVUp)
+					if (pDevice->bWPADEVUp)
 						pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus;
 
 					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Roaming ...\n");
@@ -1164,11 +1164,11 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 	if (wFIFOCtl & FIFOCTL_NEEDACK) {
 		if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
 			pMgmt->sNodeDBTable[0].uTxAttempts += 1;
-			if ( !(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
+			if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
 				/* transmit success, TxAttempts at least plus one */
 				pMgmt->sNodeDBTable[0].uTxOk[MAX_RATE]++;
-				if ( (byFallBack == AUTO_FB_NONE) ||
-					 (wRate < RATE_18M) ) {
+				if ((byFallBack == AUTO_FB_NONE) ||
+					 (wRate < RATE_18M)) {
 					wFallBackRate = wRate;
 				} else if (byFallBack == AUTO_FB_0) {
 					if (byTxRetry < 5)
@@ -1188,8 +1188,8 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 			pMgmt->sNodeDBTable[0].uTxRetry += byTxRetry;
 			if (byTxRetry != 0) {
 				pMgmt->sNodeDBTable[0].uTxFail[MAX_RATE] += byTxRetry;
-				if ( (byFallBack == AUTO_FB_NONE) ||
-					(wRate < RATE_18M) ) {
+				if ((byFallBack == AUTO_FB_NONE) ||
+					(wRate < RATE_18M)) {
 					pMgmt->sNodeDBTable[0].uTxFail[wRate] += byTxRetry;
 				} else if (byFallBack == AUTO_FB_0) {
 					for (ii = 0; ii < byTxRetry; ii++) {
@@ -1222,11 +1222,11 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 						  pbyDestAddr,
 						  &uNodeIndex)) {
 				pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1;
-				if ( !(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
+				if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
 					/* transmit success, TxAttempts at least plus one */
 					pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++;
-					if ( (byFallBack == AUTO_FB_NONE) ||
-						(wRate < RATE_18M) ) {
+					if ((byFallBack == AUTO_FB_NONE) ||
+						(wRate < RATE_18M)) {
 						wFallBackRate = wRate;
 					} else if (byFallBack == AUTO_FB_0) {
 						if (byTxRetry < 5)
@@ -1246,8 +1246,8 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 				pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += byTxRetry;
 				if (byTxRetry != 0) {
 					pMgmt->sNodeDBTable[uNodeIndex].uTxFail[MAX_RATE] += byTxRetry;
-					if ( (byFallBack == AUTO_FB_NONE) ||
-						(wRate < RATE_18M) ) {
+					if ((byFallBack == AUTO_FB_NONE) ||
+						(wRate < RATE_18M)) {
 						pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wRate] += byTxRetry;
 					} else if (byFallBack == AUTO_FB_0) {
 						for (ii = 0; ii < byTxRetry; ii++) {
@@ -1299,7 +1299,7 @@ void BSSvClearNodeDBTable(struct vnt_private *pDevice, u32 uStartIndex)
 		if (pMgmt->sNodeDBTable[ii].bActive) {
 			/* check if sTxPSQueue has been initial */
 			if (pMgmt->sNodeDBTable[ii].sTxPSQueue.next != NULL) {
-				while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL){
+				while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) {
 					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS skb != NULL %d\n", ii);
 					dev_kfree_skb(skb);
 				}
@@ -1317,7 +1317,7 @@ static void s_vCheckSensitivity(struct vnt_private *pDevice)
 
 	if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
 		((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) {
-		pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID);
+		pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID) pMgmt->abyCurrSSID);
 		if (pBSSList != NULL) {
 			/* Update BB register if RSSI is too strong */
 			signed long    LocalldBmAverage = 0;
@@ -1373,7 +1373,7 @@ static void s_uCalculateLinkQual(struct vnt_private *pDevice)
 	if (pDevice->bLinkPass != true) {
 		pDevice->wstats.qual.qual = 0;
 	} else {
-		RFvRSSITodBm(pDevice, (u8)(pDevice->uCurrRSSI), &ldBm);
+		RFvRSSITodBm(pDevice, (u8) (pDevice->uCurrRSSI), &ldBm);
 		if (-ldBm < 50)
 			RssiRatio = 4000;
 		else if (-ldBm > 90)
@@ -1383,7 +1383,7 @@ static void s_uCalculateLinkQual(struct vnt_private *pDevice)
 
 		qual = (RssiRatio + TxOkRatio + RxOkRatio) / 100;
 		if (qual < 100)
-			pDevice->wstats.qual.qual = (u8)qual;
+			pDevice->wstats.qual.qual = (u8) qual;
 		else
 			pDevice->wstats.qual.qual = 100;
 	}
@@ -1407,7 +1407,7 @@ static void s_vCheckPreEDThreshold(struct vnt_private *pDevice)
 
 	if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
 		((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) {
-		pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID);
+		pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID) pMgmt->abyCurrSSID);
 		if (pBSSList != NULL) {
 			pDevice->byBBPreEDRSSI = (u8) (~(pBSSList->ldBmAverRange) + 1);
 			BBvUpdatePreEDThreshold(pDevice, false);
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 06/13] Staging: vt6656: Remove line feeds before else
  2014-01-04 15:25 [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c Sebastian Rachuj
                   ` (4 preceding siblings ...)
  2014-01-04 15:25 ` [PATCH 05/13] Staging: vt6656: Correct single space mistakes Sebastian Rachuj
@ 2014-01-04 15:25 ` Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 07/13] Staging: vt6656: Remove unnecessary spaces in format strings Sebastian Rachuj
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sebastian Rachuj @ 2014-01-04 15:25 UTC (permalink / raw)
  To: sebastian.rachuj
  Cc: linux-kernel, linux, forest, gregkh, more.andres, tvboxspy,
	devel, linux-kernel

From: Simon Schuster <linux@rationality.eu>

An else belongs in the same line as the closing curly brace of the
previous block. Hence, this patch removes line feeds separating a
curly brace from the corresponding else.

Signed-off-by: Sebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: Simon Schuster <linux@rationality.eu>
---
 drivers/staging/vt6656/bssdb.c | 39 +++++++++++++--------------------------
 1 file changed, 13 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index 38c267b..815324a 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -649,8 +649,7 @@ void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex)
 				BigestCount = pMgmt->sNodeDBTable[ii].uInActiveCount;
 				SelectIndex = ii;
 			}
-		}
-		else {
+		} else {
 			break;
 		}
 	}
@@ -664,8 +663,7 @@ void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex)
 			while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)) != NULL)
 				dev_kfree_skb(skb);
 		}
-	}
-	else {
+	} else {
 		*puNodeIndex = ii;
 	}
 
@@ -822,8 +820,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 
 	if (pDevice->wUseProtectCntDown > 0) {
 		pDevice->wUseProtectCntDown--;
-	}
-	else {
+	} else {
 		/* disable protect mode */
 		pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1));
 	}
@@ -841,8 +838,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 				PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
 				wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
 			}
-		}
-		else if (pDevice->bLinkPass == true)
+		} else if (pDevice->bLinkPass == true)
 			pDevice->byReAssocCount = 0;
 	}
 
@@ -895,8 +891,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 					/* ii = 0 for multicast node (AP & Adhoc) */
 					RATEvTxRateFallBack((void *) pDevice,
 						&(pMgmt->sNodeDBTable[ii]));
-				}
-				else {
+				} else {
 					/* ii = 0 reserved for unicast AP node (Infra STA) */
 					if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)
 						RATEvTxRateFallBack((void *) pDevice,
@@ -927,8 +922,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 				MACvEnableProtectMD(pDevice);
 				pDevice->bProtectMode = true;
 			}
-		}
-		else {
+		} else {
 			if (pDevice->bProtectMode) {
 				MACvDisableProtectMD(pDevice);
 				pDevice->bProtectMode = false;
@@ -942,8 +936,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 				BBvSetShortSlotTime(pDevice);
 				vUpdateIFS((void *) pDevice);
 			}
-		}
-		else {
+		} else {
 			if (!pDevice->bShortSlotTime) {
 				pDevice->bShortSlotTime = true;
 				BBvSetShortSlotTime(pDevice);
@@ -958,8 +951,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 				MACvEnableBarkerPreambleMd(pDevice);
 				pDevice->bBarkerPreambleMd = true;
 			}
-		}
-		else {
+		} else {
 			if (pDevice->bBarkerPreambleMd) {
 				MACvDisableBarkerPreambleMd(pDevice);
 				pDevice->bBarkerPreambleMd = false;
@@ -1017,8 +1009,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 					wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
 				}
 			}
-		}
-		else if (pItemSSID->len != 0) {
+		} else if (pItemSSID->len != 0) {
 			/* Davidwang */
 			if ((pDevice->bEnableRoaming == true)&&(!(pMgmt->Cisco_cckm))) {
 				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bRoaming %d, !\n", pDevice->bRoaming);
@@ -1035,21 +1026,18 @@ void BSSvSecondCallBack(struct work_struct *work)
 					pDevice->uAutoReConnectTime = 0;
 					pDevice->uIsroamingTime = 0;
 					pDevice->bRoaming = false;
-				}
-				else if ((pDevice->bRoaming == false) && (pDevice->bIsRoaming == true)) {
+				} else if ((pDevice->bRoaming == false) && (pDevice->bIsRoaming == true)) {
 					pDevice->uIsroamingTime++;
 					if (pDevice->uIsroamingTime >= 20)
 						pDevice->bIsRoaming = false;
 				}
-			}
-			else {
+			} else {
 				if (pDevice->uAutoReConnectTime < 10) {
 					pDevice->uAutoReConnectTime++;
 					/* network manager support need not do Roaming scan??? */
 					if (pDevice->bWPASuppWextEnabled == true)
 						pDevice->uAutoReConnectTime = 0;
-				}
-				else {
+				} else {
 					/* mike use old encryption status for wpa reauthen */
 					if (pDevice->bWPADEVUp)
 						pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus;
@@ -1074,8 +1062,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 		if ((pMgmt->eCurrState == WMAC_STATE_STARTED) && (pCurrSSID->len == 0)) {
 			if (pDevice->uAutoReConnectTime < 10) {
 				pDevice->uAutoReConnectTime++;
-			}
-			else {
+			} else {
 				DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Adhoc re-scanning ...\n");
 				pMgmt->eScanType = WMAC_SCAN_ACTIVE;
 				bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 07/13] Staging: vt6656: Remove unnecessary spaces in format strings
  2014-01-04 15:25 [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c Sebastian Rachuj
                   ` (5 preceding siblings ...)
  2014-01-04 15:25 ` [PATCH 06/13] Staging: vt6656: Remove line feeds before else Sebastian Rachuj
@ 2014-01-04 15:25 ` Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 08/13] Staging: vt6656: Combine "else { if" to "else if" Sebastian Rachuj
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sebastian Rachuj @ 2014-01-04 15:25 UTC (permalink / raw)
  To: sebastian.rachuj
  Cc: linux-kernel, linux, forest, gregkh, more.andres, tvboxspy,
	devel, linux-kernel

From: Simon Schuster <linux@rationality.eu>

A space in a format string is unnecessary if it is followed by a line
feed. These spaces are removed by this patch.

Signed-off-by: Sebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: Simon Schuster <linux@rationality.eu>
---
 drivers/staging/vt6656/bssdb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index 815324a..bd64d59 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -742,7 +742,7 @@ void BSSvUpdateAPNode(struct vnt_private *pDevice,
 	pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND;
 	/* Auto rate fallback function initiation.
 	 * RATEbInit(pDevice); */
-	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate);
+	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d\n", pMgmt->sNodeDBTable[0].wTxDataRate);
 
 }
 
@@ -902,11 +902,11 @@ void BSSvSecondCallBack(struct work_struct *work)
 
 			/* check if pending PS queue */
 			if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) {
-				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending \n",
+				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending\n",
 						   ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt);
 				if ((ii > 0) && (pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15)) {
 					BSSvRemoveOneNode(pDevice, ii);
-					DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Pending many queues PS STA Index = %d remove \n", ii);
+					DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Pending many queues PS STA Index = %d remove\n", ii);
 					continue;
 				}
 			}
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 08/13] Staging: vt6656: Combine "else { if" to "else if"
  2014-01-04 15:25 [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c Sebastian Rachuj
                   ` (6 preceding siblings ...)
  2014-01-04 15:25 ` [PATCH 07/13] Staging: vt6656: Remove unnecessary spaces in format strings Sebastian Rachuj
@ 2014-01-04 15:25 ` Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 09/13] Staging: vt6656: Correct usage of braces Sebastian Rachuj
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sebastian Rachuj @ 2014-01-04 15:25 UTC (permalink / raw)
  To: sebastian.rachuj
  Cc: linux-kernel, linux, forest, gregkh, more.andres, tvboxspy,
	devel, linux-kernel

From: Simon Schuster <linux@rationality.eu>

This patch combines single ifs within the block of an else to a single
else if statement.

Therefore code that looks like that

else {
	if (cond) {
		statements;
	} else {
		other_statements;
	}
}

is converted to code that looks like that

else if (cond) {
	statements;
} else {
	other_statements;
}

Signed-off-by: Sebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: Simon Schuster <linux@rationality.eu>
---
 drivers/staging/vt6656/bssdb.c | 114 +++++++++++++++++------------------------
 1 file changed, 47 insertions(+), 67 deletions(-)

diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index bd64d59..e281d3c 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -137,14 +137,11 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 								return pCurrBSS;
 							}
 						}
-					} else {
-						if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
-							((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
-							((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))
-							) {
-							pCurrBSS->bSelected = true;
-							return pCurrBSS;
-						}
+					} else if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
+						((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
+						((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))) {
+						pCurrBSS->bSelected = true;
+						return pCurrBSS;
 					}
 				}
 			}
@@ -196,11 +193,9 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 
 				if (pSelect == NULL) {
 					pSelect = pCurrBSS;
-				} else {
-					/* compare RSSI, select the strongest signal */
-					if (pCurrBSS->uRSSI < pSelect->uRSSI) {
-						pSelect = pCurrBSS;
-					}
+				/* compare RSSI, select the strongest signal */
+				} else if (pCurrBSS->uRSSI < pSelect->uRSSI) {
+					pSelect = pCurrBSS;
 				}
 			}
 		}
@@ -364,15 +359,12 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 	pBSSList->sERP.bERPExist = psERP->bERPExist;
 
 	/* Check if BSS is 802.11a/b/g */
-	if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) {
+	if (pBSSList->uChannel > CB_MAX_CHANNEL_24G)
 		pBSSList->eNetworkTypeInUse = PHY_TYPE_11A;
-	} else {
-		if (pBSSList->sERP.bERPExist == true) {
-			pBSSList->eNetworkTypeInUse = PHY_TYPE_11G;
-		} else {
-			pBSSList->eNetworkTypeInUse = PHY_TYPE_11B;
-		}
-	}
+	else if (pBSSList->sERP.bERPExist == true)
+		pBSSList->eNetworkTypeInUse = PHY_TYPE_11G;
+	else
+		pBSSList->eNetworkTypeInUse = PHY_TYPE_11B;
 
 	pBSSList->byRxRate = pRxPacket->byRxRate;
 	pBSSList->qwLocalTSF = pRxPacket->qwLocalTSF;
@@ -521,15 +513,12 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 	pBSSList->sERP.bERPExist = psERP->bERPExist;
 
 	/* Check if BSS is 802.11a/b/g */
-	if (pBSSList->uChannel > CB_MAX_CHANNEL_24G) {
+	if (pBSSList->uChannel > CB_MAX_CHANNEL_24G)
 		pBSSList->eNetworkTypeInUse = PHY_TYPE_11A;
-	} else {
-		if (pBSSList->sERP.bERPExist == true) {
-			pBSSList->eNetworkTypeInUse = PHY_TYPE_11G;
-		} else {
-			pBSSList->eNetworkTypeInUse = PHY_TYPE_11B;
-		}
-	}
+	else if (pBSSList->sERP.bERPExist == true)
+		pBSSList->eNetworkTypeInUse = PHY_TYPE_11G;
+	else
+		pBSSList->eNetworkTypeInUse = PHY_TYPE_11B;
 
 	pBSSList->byRxRate = pRxPacket->byRxRate;
 	pBSSList->qwLocalTSF = pRxPacket->qwLocalTSF;
@@ -891,11 +880,10 @@ void BSSvSecondCallBack(struct work_struct *work)
 					/* ii = 0 for multicast node (AP & Adhoc) */
 					RATEvTxRateFallBack((void *) pDevice,
 						&(pMgmt->sNodeDBTable[ii]));
-				} else {
+				} else if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
 					/* ii = 0 reserved for unicast AP node (Infra STA) */
-					if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)
-						RATEvTxRateFallBack((void *) pDevice,
-							&(pMgmt->sNodeDBTable[ii]));
+					RATEvTxRateFallBack((void *) pDevice,
+						&(pMgmt->sNodeDBTable[ii]));
 				}
 
 			}
@@ -922,11 +910,9 @@ void BSSvSecondCallBack(struct work_struct *work)
 				MACvEnableProtectMD(pDevice);
 				pDevice->bProtectMode = true;
 			}
-		} else {
-			if (pDevice->bProtectMode) {
-				MACvDisableProtectMD(pDevice);
-				pDevice->bProtectMode = false;
-			}
+		} else if (pDevice->bProtectMode) {
+			MACvDisableProtectMD(pDevice);
+			pDevice->bProtectMode = false;
 		}
 		/* on/off short slot time */
 
@@ -936,12 +922,10 @@ void BSSvSecondCallBack(struct work_struct *work)
 				BBvSetShortSlotTime(pDevice);
 				vUpdateIFS((void *) pDevice);
 			}
-		} else {
-			if (!pDevice->bShortSlotTime) {
+		} else if (!pDevice->bShortSlotTime) {
 				pDevice->bShortSlotTime = true;
 				BBvSetShortSlotTime(pDevice);
 				vUpdateIFS((void *) pDevice);
-			}
 		}
 
 		/* on/off barker long preamble mode */
@@ -951,11 +935,9 @@ void BSSvSecondCallBack(struct work_struct *work)
 				MACvEnableBarkerPreambleMd(pDevice);
 				pDevice->bBarkerPreambleMd = true;
 			}
-		} else {
-			if (pDevice->bBarkerPreambleMd) {
+		} else if (pDevice->bBarkerPreambleMd) {
 				MACvDisableBarkerPreambleMd(pDevice);
 				pDevice->bBarkerPreambleMd = false;
-			}
 		}
 
 	}
@@ -1031,28 +1013,26 @@ void BSSvSecondCallBack(struct work_struct *work)
 					if (pDevice->uIsroamingTime >= 20)
 						pDevice->bIsRoaming = false;
 				}
+			} else if (pDevice->uAutoReConnectTime < 10) {
+				pDevice->uAutoReConnectTime++;
+				/* network manager support need not do Roaming scan??? */
+				if (pDevice->bWPASuppWextEnabled == true)
+					pDevice->uAutoReConnectTime = 0;
 			} else {
-				if (pDevice->uAutoReConnectTime < 10) {
-					pDevice->uAutoReConnectTime++;
-					/* network manager support need not do Roaming scan??? */
-					if (pDevice->bWPASuppWextEnabled == true)
-						pDevice->uAutoReConnectTime = 0;
-				} else {
-					/* mike use old encryption status for wpa reauthen */
-					if (pDevice->bWPADEVUp)
-						pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus;
+				/* mike use old encryption status for wpa reauthen */
+				if (pDevice->bWPADEVUp)
+					pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus;
 
-					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Roaming ...\n");
-					BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass);
-					pMgmt->eScanType = WMAC_SCAN_ACTIVE;
-					bScheduleCommand((void *) pDevice,
-							 WLAN_CMD_BSSID_SCAN,
-							 pMgmt->abyDesireSSID);
-					bScheduleCommand((void *) pDevice,
-							 WLAN_CMD_SSID,
-							 pMgmt->abyDesireSSID);
-					pDevice->uAutoReConnectTime = 0;
-				}
+				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Roaming ...\n");
+				BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass);
+				pMgmt->eScanType = WMAC_SCAN_ACTIVE;
+				bScheduleCommand((void *) pDevice,
+						 WLAN_CMD_BSSID_SCAN,
+						 pMgmt->abyDesireSSID);
+				bScheduleCommand((void *) pDevice,
+						 WLAN_CMD_SSID,
+						 pMgmt->abyDesireSSID);
+				pDevice->uAutoReConnectTime = 0;
 			}
 		}
 	}
@@ -1203,11 +1183,11 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 		}
 
 		if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
-			(pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
+		     (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
 
 			if (BSSbIsSTAInNodeDB((void *) pDevice,
-						  pbyDestAddr,
-						  &uNodeIndex)) {
+					      pbyDestAddr,
+					      &uNodeIndex)) {
 				pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1;
 				if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
 					/* transmit success, TxAttempts at least plus one */
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 09/13] Staging: vt6656: Correct usage of braces
  2014-01-04 15:25 [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c Sebastian Rachuj
                   ` (7 preceding siblings ...)
  2014-01-04 15:25 ` [PATCH 08/13] Staging: vt6656: Combine "else { if" to "else if" Sebastian Rachuj
@ 2014-01-04 15:25 ` Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 10/13] Staging: vt6656: Combined nested conditions Sebastian Rachuj
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sebastian Rachuj @ 2014-01-04 15:25 UTC (permalink / raw)
  To: sebastian.rachuj
  Cc: linux-kernel, linux, forest, gregkh, more.andres, tvboxspy,
	devel, linux-kernel

From: Simon Schuster <linux@rationality.eu>

Conforming to the linux coding style guidelines, a single line block
of an if statement does not require curly braces unless another block
of the if cascade requires them. Therefore unnecessary curly braces
are removed by this patch and missing ones are added.

Signed-off-by: Sebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: Simon Schuster <linux@rationality.eu>
---
 drivers/staging/vt6656/bssdb.c | 41 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index e281d3c..1972a5b 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -104,14 +104,12 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
 			"BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID);
 		if ((!is_broadcast_ether_addr(pbyDesireBSSID)) &&
-			(memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)) {
+			(memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0))
 				pbyBSSID = pbyDesireBSSID;
-		}
 	}
 	if (pbyDesireSSID != NULL) {
-		if (((PWLAN_IE_SSID) pbyDesireSSID)->len != 0) {
+		if (((PWLAN_IE_SSID) pbyDesireSSID)->len != 0)
 			pSSID = (PWLAN_IE_SSID) pbyDesireSSID;
-		}
 	}
 
 	if ((pbyBSSID != NULL) && (pDevice->bRoaming == false)) {
@@ -191,12 +189,11 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 					pCurrBSS->abyBSSID);
 				jj++;
 
-				if (pSelect == NULL) {
+				if (pSelect == NULL)
 					pSelect = pCurrBSS;
 				/* compare RSSI, select the strongest signal */
-				} else if (pCurrBSS->uRSSI < pSelect->uRSSI) {
+				else if (pCurrBSS->uRSSI < pSelect->uRSSI)
 					pSelect = pCurrBSS;
-				}
 			}
 		}
 
@@ -204,9 +201,11 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 
 		if (pSelect != NULL) {
 			pSelect->bSelected = true;
-			if (pDevice->bRoaming == false)  {
+			if (pDevice->bRoaming == false) {
 				/* Einsn Add @20070907 */
-				memcpy(pbyDesireSSID, pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
+				memcpy(pbyDesireSSID,
+				       pCurrBSS->abySSID,
+				       WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
 			}
 
 			return pSelect;
@@ -374,9 +373,8 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 	if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
 		(pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
 		/* assoc with BSS */
-		if (pBSSList == pMgmt->pCurrBSS) {
+		if (pBSSList == pMgmt->pCurrBSS)
 			bParsingQuiet = true;
-		}
 	}
 
 	WPA_ClearRSN(pBSSList);
@@ -504,11 +502,10 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 		memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
 	memcpy(pBSSList->abySuppRates, pSuppRates, pSuppRates->len + WLAN_IEHDR_LEN);
 
-	if (pExtSuppRates != NULL) {
+	if (pExtSuppRates != NULL)
 		memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, pExtSuppRates->len + WLAN_IEHDR_LEN);
-	} else {
+	else
 		memset(pBSSList->abyExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
-	}
 	pBSSList->sERP.byERP = psERP->byERP;
 	pBSSList->sERP.bERPExist = psERP->bERPExist;
 
@@ -529,9 +526,8 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 	if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
 		(pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
 		/* assoc with BSS */
-		if (pBSSList == pMgmt->pCurrBSS) {
+		if (pBSSList == pMgmt->pCurrBSS)
 			bParsingQuiet = true;
-		}
 	}
 
 	WPA_ClearRSN(pBSSList); /* mike update */
@@ -707,9 +703,8 @@ void BSSvUpdateAPNode(struct vnt_private *pDevice,
 	memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB));
 
 	pMgmt->sNodeDBTable[0].bActive = true;
-	if (pDevice->byBBType == BB_TYPE_11B) {
+	if (pDevice->byBBType == BB_TYPE_11B)
 		uRateLen = WLAN_RATES_MAXLEN_11B;
-	}
 	pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES) pSuppRates,
 						(PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates,
 						uRateLen);
@@ -827,8 +822,9 @@ void BSSvSecondCallBack(struct work_struct *work)
 				PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
 				wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
 			}
-		} else if (pDevice->bLinkPass == true)
+		} else if (pDevice->bLinkPass == true) {
 			pDevice->byReAssocCount = 0;
+		}
 	}
 
 	pMgmt->eLastState = pMgmt->eCurrState;
@@ -1119,13 +1115,12 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 	wFIFOCtl = pkt_info[byPktNum].fifo_ctl;
 	pbyDestAddr = pkt_info[byPktNum].dest_addr;
 
-	if (wFIFOCtl & FIFOCTL_AUTO_FB_0) {
+	if (wFIFOCtl & FIFOCTL_AUTO_FB_0)
 		byFallBack = AUTO_FB_0;
-	} else if (wFIFOCtl & FIFOCTL_AUTO_FB_1) {
+	else if (wFIFOCtl & FIFOCTL_AUTO_FB_1)
 		byFallBack = AUTO_FB_1;
-	} else {
+	else
 		byFallBack = AUTO_FB_NONE;
-	}
 
 	/* Only Unicast using support rates */
 	if (wFIFOCtl & FIFOCTL_NEEDACK) {
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 10/13] Staging: vt6656: Combined nested conditions
  2014-01-04 15:25 [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c Sebastian Rachuj
                   ` (8 preceding siblings ...)
  2014-01-04 15:25 ` [PATCH 09/13] Staging: vt6656: Correct usage of braces Sebastian Rachuj
@ 2014-01-04 15:25 ` Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 11/13] Staging: vt6656: Remove bogus parentheses in conditions Sebastian Rachuj
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Sebastian Rachuj @ 2014-01-04 15:25 UTC (permalink / raw)
  To: sebastian.rachuj
  Cc: linux-kernel, linux, forest, gregkh, more.andres, tvboxspy,
	devel, linux-kernel

From: Simon Schuster <linux@rationality.eu>

This patch reduces the level of indentation in bssdb.c of the vt6656
driver by transforming nested conditions to a series of logical
conjunctions. E.g.

if (cond1) {
        if (cond2) {
                block();
        }
}

is transformed to

if (cond1 && cond2) {
        block();
}

Signed-off-by: Sebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: Simon Schuster <linux@rationality.eu>
---
 drivers/staging/vt6656/bssdb.c | 281 ++++++++++++++++++++---------------------
 1 file changed, 139 insertions(+), 142 deletions(-)

diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index 1972a5b..c780869 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -107,10 +107,9 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 			(memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0))
 				pbyBSSID = pbyDesireBSSID;
 	}
-	if (pbyDesireSSID != NULL) {
-		if (((PWLAN_IE_SSID) pbyDesireSSID)->len != 0)
-			pSSID = (PWLAN_IE_SSID) pbyDesireSSID;
-	}
+	if ((pbyDesireSSID != NULL) &&
+	    (((PWLAN_IE_SSID) pbyDesireSSID)->len != 0))
+		pSSID = (PWLAN_IE_SSID) pbyDesireSSID;
 
 	if ((pbyBSSID != NULL) && (pDevice->bRoaming == false)) {
 		/* match BSSID first */
@@ -120,27 +119,27 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 			pCurrBSS->bSelected = false;
 
 			if ((pCurrBSS->bActive) &&
-				(pCurrBSS->bSelected == false)) {
-				if (ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) {
-					if (pSSID != NULL) {
-						/* compare ssid */
-						if (!memcmp(pSSID->abySSID,
-							((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
-							pSSID->len)) {
-							if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
-								((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
-								((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))
-								) {
-								pCurrBSS->bSelected = true;
-								return pCurrBSS;
-							}
-						}
-					} else if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
-						((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
-						((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))) {
+			    (pCurrBSS->bSelected == false) &&
+			    (ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID))) {
+				if (pSSID != NULL) {
+					/* compare ssid */
+					if ((!memcmp(pSSID->abySSID,
+						     ((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
+						     pSSID->len)) &&
+					    ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
+					     ((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) &&
+					      WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
+					     ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) &&
+					      WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)))) {
+
 						pCurrBSS->bSelected = true;
 						return pCurrBSS;
 					}
+				} else if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
+					((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
+					((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))) {
+					pCurrBSS->bSelected = true;
+					return pCurrBSS;
 				}
 			}
 		}
@@ -156,16 +155,17 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 			pCurrBSS->bSelected = false;
 			if (pCurrBSS->bActive) {
 
-				if (pSSID != NULL) {
-					/* matched SSID */
-					if (memcmp(pSSID->abySSID,
-						((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
-						pSSID->len) ||
-						(pSSID->len != ((PWLAN_IE_SSID) pCurrBSS->abySSID)->len)) {
-						/* SSID not match skip this BSS */
-						continue;
-					  }
+				if ((pSSID != NULL) &&
+				    /* matched SSID */
+				    (memcmp(pSSID->abySSID,
+					    ((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
+					    pSSID->len) ||
+				     (pSSID->len !=
+					((PWLAN_IE_SSID) pCurrBSS->abySSID)->len))) {
+					/* SSID not match skip this BSS */
+					continue;
 				}
+
 				if (((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) ||
 					((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))
 					) {
@@ -174,13 +174,14 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 					continue;
 				}
 
-				if (ePhyType != PHY_TYPE_AUTO) {
-					if (((ePhyType == PHY_TYPE_11A) && (PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse)) ||
-						((ePhyType != PHY_TYPE_11A) && (PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) {
-						/* PhyType not match skip this BSS */
-						DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse);
-						continue;
-					}
+				if ((ePhyType != PHY_TYPE_AUTO) &&
+				    (((ePhyType == PHY_TYPE_11A) &&
+				     (PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse)) ||
+				    ((ePhyType != PHY_TYPE_11A) &&
+				     (PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse)))) {
+					/* PhyType not match skip this BSS */
+					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse);
+					continue;
 				}
 
 				pMgmt->pSameBSS[jj].uChannel = pCurrBSS->uChannel;
@@ -228,21 +229,20 @@ void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID)
 	int ii;
 
 	for (ii = 0; ii < MAX_BSS_NUM; ii++) {
-		if (bKeepCurrBSSID) {
-			if (pMgmt->sBSSList[ii].bActive &&
-				ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID,
-				pMgmt->abyCurrBSSID)) {
-
-				/* mike mark:
-				 * there are two BSSID's in list. If that AP is
-				 * in hidden ssid mode, one SSID is null, but
-				 * other's might not be obvious, so if it
-				 * associate's with your STA, you must keep the
-				 * two of them!!  bKeepCurrBSSID = false;
-				 */
-
-				continue;
-			}
+		if (bKeepCurrBSSID &&
+		    pMgmt->sBSSList[ii].bActive &&
+		    ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID,
+			             pMgmt->abyCurrBSSID)) {
+
+			/* mike mark:
+			 * there are two BSSID's in list. If that AP is
+			 * in hidden ssid mode, one SSID is null, but
+			 * other's might not be obvious, so if it
+			 * associate's with your STA, you must keep the
+			 * two of them!!  bKeepCurrBSSID = false;
+			 */
+
+			continue;
 		}
 
 		pMgmt->sBSSList[ii].bActive = false;
@@ -268,16 +268,13 @@ PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice,
 
 	for (ii = 0; ii < MAX_BSS_NUM; ii++) {
 		pBSSList = &(pMgmt->sBSSList[ii]);
-		if (pBSSList->bActive) {
-			if (ether_addr_equal(pBSSList->abyBSSID, abyBSSID)) {
-				if (pSSID->len == ((PWLAN_IE_SSID) pBSSList->abySSID)->len) {
-					if (memcmp(pSSID->abySSID,
-						((PWLAN_IE_SSID) pBSSList->abySSID)->abySSID,
-						pSSID->len) == 0)
-						return pBSSList;
-				}
-			}
-		}
+		if ((pBSSList->bActive) &&
+		    (ether_addr_equal(pBSSList->abyBSSID, abyBSSID)) &&
+		    (pSSID->len == ((PWLAN_IE_SSID) pBSSList->abySSID)->len) &&
+		    (memcmp(pSSID->abySSID,
+			    ((PWLAN_IE_SSID) pBSSList->abySSID)->abySSID,
+			    pSSID->len) == 0))
+			return pBSSList;
 	}
 
 	return NULL;
@@ -371,11 +368,10 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 	pBSSList->bySQ = pRxPacket->bySQ;
 
 	if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
-		(pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
-		/* assoc with BSS */
-		if (pBSSList == pMgmt->pCurrBSS)
-			bParsingQuiet = true;
-	}
+	    (pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
+	    /* assoc with BSS */
+	    (pBSSList == pMgmt->pCurrBSS))
+		bParsingQuiet = true;
 
 	WPA_ClearRSN(pBSSList);
 
@@ -421,13 +417,19 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 					 pBSSList->abyBSSID,
 					 &pBSSList->sRSNCapObj);
 
-			if ((pDevice->bLinkPass == true) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
-				if ((KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, PAIRWISE_KEY, &pTransmitKey) == true) ||
-					(KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, GROUP_KEY, &pTransmitKey) == true)) {
-					pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList;
-					pDevice->gsPMKIDCandidate.Version = 1;
+			if ((pDevice->bLinkPass == true) &&
+			    (pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
+			    ((KeybGetTransmitKey(&(pDevice->sKey),
+						 pDevice->abyBSSID,
+						 PAIRWISE_KEY,
+						 &pTransmitKey) == true) ||
+			     (KeybGetTransmitKey(&(pDevice->sKey),
+						 pDevice->abyBSSID,
+						 GROUP_KEY,
+						 &pTransmitKey) == true))) {
+				pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList;
+				pDevice->gsPMKIDCandidate.Version = 1;
 
-				}
 
 			}
 		}
@@ -524,11 +526,10 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 	pBSSList->bySQ = pRxPacket->bySQ;
 
 	if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
-		(pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
-		/* assoc with BSS */
-		if (pBSSList == pMgmt->pCurrBSS)
-			bParsingQuiet = true;
-	}
+	    (pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
+	    /* assoc with BSS */
+	    (pBSSList == pMgmt->pCurrBSS))
+		bParsingQuiet = true;
 
 	WPA_ClearRSN(pBSSList); /* mike update */
 
@@ -597,12 +598,11 @@ int BSSbIsSTAInNodeDB(struct vnt_private *pDevice,
 
 	/* Index = 0 reserved for AP Node */
 	for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
-		if (pMgmt->sNodeDBTable[ii].bActive) {
-			if (ether_addr_equal(abyDstAddr,
-				pMgmt->sNodeDBTable[ii].abyMACAddr)) {
-				*puNodeIndex = ii;
-				return true;
-			}
+		if ((pMgmt->sNodeDBTable[ii].bActive) &&
+		    (ether_addr_equal(abyDstAddr,
+				      pMgmt->sNodeDBTable[ii].abyMACAddr))) {
+			*puNodeIndex = ii;
+			return true;
 		}
 	}
 
@@ -1064,16 +1064,15 @@ void BSSvSecondCallBack(struct work_struct *work)
 	}
 
 	if (pDevice->bLinkPass == true) {
-		if (pMgmt->eAuthenMode < WMAC_AUTH_WPA ||
-			pDevice->fWPA_Authened == true) {
-			if (++pDevice->tx_data_time_out > 40) {
-				pDevice->tx_trigger = true;
+		if ((pMgmt->eAuthenMode < WMAC_AUTH_WPA ||
+		     pDevice->fWPA_Authened == true) &&
+		    (++pDevice->tx_data_time_out > 40)) {
+			pDevice->tx_trigger = true;
 
-				PSbSendNullPacket(pDevice);
+			PSbSendNullPacket(pDevice);
 
-				pDevice->tx_trigger = false;
-				pDevice->tx_data_time_out = 0;
-			}
+			pDevice->tx_trigger = false;
+			pDevice->tx_data_time_out = 0;
 		}
 
 		if (netif_queue_stopped(pDevice->dev))
@@ -1177,58 +1176,56 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 			}
 		}
 
-		if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
-		     (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
-
-			if (BSSbIsSTAInNodeDB((void *) pDevice,
-					      pbyDestAddr,
-					      &uNodeIndex)) {
-				pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1;
-				if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
-					/* transmit success, TxAttempts at least plus one */
-					pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++;
-					if ((byFallBack == AUTO_FB_NONE) ||
-						(wRate < RATE_18M)) {
-						wFallBackRate = wRate;
-					} else if (byFallBack == AUTO_FB_0) {
-						if (byTxRetry < 5)
-							wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry];
+		if (((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
+		     (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) &&
+		    (BSSbIsSTAInNodeDB((void *) pDevice,
+				       pbyDestAddr,
+				       &uNodeIndex))) {
+			pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1;
+			if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
+				/* transmit success, TxAttempts at least plus one */
+				pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++;
+				if ((byFallBack == AUTO_FB_NONE) ||
+					(wRate < RATE_18M)) {
+					wFallBackRate = wRate;
+				} else if (byFallBack == AUTO_FB_0) {
+					if (byTxRetry < 5)
+						wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry];
+					else
+						wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
+				} else if (byFallBack == AUTO_FB_1) {
+					if (byTxRetry < 5)
+						wFallBackRate = awHWRetry1[wRate-RATE_18M][byTxRetry];
+					else
+						wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
+				}
+				pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wFallBackRate]++;
+			} else {
+				pMgmt->sNodeDBTable[uNodeIndex].uTxFailures++;
+			}
+			pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += byTxRetry;
+			if (byTxRetry != 0) {
+				pMgmt->sNodeDBTable[uNodeIndex].uTxFail[MAX_RATE] += byTxRetry;
+				if ((byFallBack == AUTO_FB_NONE) ||
+					(wRate < RATE_18M)) {
+					pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wRate] += byTxRetry;
+				} else if (byFallBack == AUTO_FB_0) {
+					for (ii = 0; ii < byTxRetry; ii++) {
+						if (ii < 5)
+							wFallBackRate =
+								awHWRetry0[wRate-RATE_18M][ii];
 						else
-							wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
-					} else if (byFallBack == AUTO_FB_1) {
-						if (byTxRetry < 5)
-							wFallBackRate = awHWRetry1[wRate-RATE_18M][byTxRetry];
+							wFallBackRate =
+								awHWRetry0[wRate-RATE_18M][4];
+						pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++;
+					}
+				} else if (byFallBack == AUTO_FB_1) {
+					for (ii = 0; ii < byTxRetry; ii++) {
+						if (ii < 5)
+							wFallBackRate = awHWRetry1[wRate-RATE_18M][ii];
 						else
 							wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
-					}
-					pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wFallBackRate]++;
-				} else {
-					pMgmt->sNodeDBTable[uNodeIndex].uTxFailures++;
-				}
-				pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += byTxRetry;
-				if (byTxRetry != 0) {
-					pMgmt->sNodeDBTable[uNodeIndex].uTxFail[MAX_RATE] += byTxRetry;
-					if ((byFallBack == AUTO_FB_NONE) ||
-						(wRate < RATE_18M)) {
-						pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wRate] += byTxRetry;
-					} else if (byFallBack == AUTO_FB_0) {
-						for (ii = 0; ii < byTxRetry; ii++) {
-							if (ii < 5)
-								wFallBackRate =
-									awHWRetry0[wRate-RATE_18M][ii];
-							else
-								wFallBackRate =
-									awHWRetry0[wRate-RATE_18M][4];
-							pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++;
-						}
-					} else if (byFallBack == AUTO_FB_1) {
-						for (ii = 0; ii < byTxRetry; ii++) {
-							if (ii < 5)
-								wFallBackRate = awHWRetry1[wRate-RATE_18M][ii];
-							else
-								wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
-							pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++;
-						}
+						pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++;
 					}
 				}
 			}
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 11/13] Staging: vt6656: Remove bogus parentheses in conditions
  2014-01-04 15:25 [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c Sebastian Rachuj
                   ` (9 preceding siblings ...)
  2014-01-04 15:25 ` [PATCH 10/13] Staging: vt6656: Combined nested conditions Sebastian Rachuj
@ 2014-01-04 15:25 ` Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 12/13] Staging: vt6656: Remove explicit comparisons against NULL Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 13/13] Staging: vt6656: Reduce line length of bssdb.c Sebastian Rachuj
  12 siblings, 0 replies; 14+ messages in thread
From: Sebastian Rachuj @ 2014-01-04 15:25 UTC (permalink / raw)
  To: sebastian.rachuj
  Cc: linux-kernel, linux, forest, gregkh, more.andres, tvboxspy,
	devel, linux-kernel

Removes unrequired parentheses around comparisons in complex
conditions.

Signed-off-by: Sebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: Simon Schuster <linux@rationality.eu>
---
 drivers/staging/vt6656/bssdb.c | 138 ++++++++++++++++++++---------------------
 1 file changed, 69 insertions(+), 69 deletions(-)

diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index c780869..b71bc33 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -103,41 +103,41 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 	if (pbyDesireBSSID != NULL) {
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
 			"BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID);
-		if ((!is_broadcast_ether_addr(pbyDesireBSSID)) &&
-			(memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0))
+		if (!is_broadcast_ether_addr(pbyDesireBSSID) &&
+			memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)
 				pbyBSSID = pbyDesireBSSID;
 	}
-	if ((pbyDesireSSID != NULL) &&
-	    (((PWLAN_IE_SSID) pbyDesireSSID)->len != 0))
+	if (pbyDesireSSID != NULL &&
+	    ((PWLAN_IE_SSID) pbyDesireSSID)->len != 0)
 		pSSID = (PWLAN_IE_SSID) pbyDesireSSID;
 
-	if ((pbyBSSID != NULL) && (pDevice->bRoaming == false)) {
+	if (pbyBSSID != NULL && pDevice->bRoaming == false) {
 		/* match BSSID first */
 		for (ii = 0; ii < MAX_BSS_NUM; ii++) {
 			pCurrBSS = &(pMgmt->sBSSList[ii]);
 
 			pCurrBSS->bSelected = false;
 
-			if ((pCurrBSS->bActive) &&
-			    (pCurrBSS->bSelected == false) &&
-			    (ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID))) {
+			if (pCurrBSS->bActive &&
+			    pCurrBSS->bSelected == false &&
+			    ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) {
 				if (pSSID != NULL) {
 					/* compare ssid */
-					if ((!memcmp(pSSID->abySSID,
+					if (!memcmp(pSSID->abySSID,
 						     ((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
-						     pSSID->len)) &&
-					    ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
-					     ((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) &&
+						     pSSID->len) &&
+					    (pMgmt->eConfigMode == WMAC_CONFIG_AUTO ||
+					     (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA &&
 					      WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
-					     ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) &&
+					     (pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA &&
 					      WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)))) {
 
 						pCurrBSS->bSelected = true;
 						return pCurrBSS;
 					}
-				} else if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
-					((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
-					((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))) {
+				} else if (pMgmt->eConfigMode == WMAC_CONFIG_AUTO ||
+					(pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
+					(pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))) {
 					pCurrBSS->bSelected = true;
 					return pCurrBSS;
 				}
@@ -155,30 +155,30 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 			pCurrBSS->bSelected = false;
 			if (pCurrBSS->bActive) {
 
-				if ((pSSID != NULL) &&
+				if (pSSID != NULL &&
 				    /* matched SSID */
 				    (memcmp(pSSID->abySSID,
 					    ((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
 					    pSSID->len) ||
-				     (pSSID->len !=
-					((PWLAN_IE_SSID) pCurrBSS->abySSID)->len))) {
+				     pSSID->len !=
+					((PWLAN_IE_SSID) pCurrBSS->abySSID)->len)) {
 					/* SSID not match skip this BSS */
 					continue;
 				}
 
-				if (((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) ||
-					((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))
+				if ((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) ||
+					(pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))
 					) {
 					/* Type not match skip this BSS */
 					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSS type mismatch.... Config[%d] BSS[0x%04x]\n", pMgmt->eConfigMode, pCurrBSS->wCapInfo);
 					continue;
 				}
 
-				if ((ePhyType != PHY_TYPE_AUTO) &&
-				    (((ePhyType == PHY_TYPE_11A) &&
-				     (PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse)) ||
-				    ((ePhyType != PHY_TYPE_11A) &&
-				     (PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse)))) {
+				if (ePhyType != PHY_TYPE_AUTO &&
+				    ((ePhyType == PHY_TYPE_11A &&
+				     PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse) ||
+				    (ePhyType != PHY_TYPE_11A &&
+				     PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) {
 					/* PhyType not match skip this BSS */
 					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse);
 					continue;
@@ -268,12 +268,12 @@ PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice,
 
 	for (ii = 0; ii < MAX_BSS_NUM; ii++) {
 		pBSSList = &(pMgmt->sBSSList[ii]);
-		if ((pBSSList->bActive) &&
-		    (ether_addr_equal(pBSSList->abyBSSID, abyBSSID)) &&
-		    (pSSID->len == ((PWLAN_IE_SSID) pBSSList->abySSID)->len) &&
-		    (memcmp(pSSID->abySSID,
+		if (pBSSList->bActive &&
+		    ether_addr_equal(pBSSList->abyBSSID, abyBSSID) &&
+		    pSSID->len == ((PWLAN_IE_SSID) pBSSList->abySSID)->len &&
+		    memcmp(pSSID->abySSID,
 			    ((PWLAN_IE_SSID) pBSSList->abySSID)->abySSID,
-			    pSSID->len) == 0))
+			    pSSID->len) == 0)
 			return pBSSList;
 	}
 
@@ -367,10 +367,10 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 	pBSSList->uRSSI = pRxPacket->uRSSI;
 	pBSSList->bySQ = pRxPacket->bySQ;
 
-	if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
-	    (pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
+	if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA &&
+	    pMgmt->eCurrState == WMAC_STATE_ASSOC &&
 	    /* assoc with BSS */
-	    (pBSSList == pMgmt->pCurrBSS))
+	    pBSSList == pMgmt->pCurrBSS)
 		bParsingQuiet = true;
 
 	WPA_ClearRSN(pBSSList);
@@ -399,7 +399,7 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 		}
 	}
 
-	if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pBSSList->bWPA2Valid == true)) {
+	if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2 || pBSSList->bWPA2Valid == true) {
 
 		PSKeyItem  pTransmitKey = NULL;
 		bool	   bIs802_1x = false;
@@ -410,23 +410,23 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 				break;
 			}
 		}
-		if ((bIs802_1x == true) && (pSSID->len == ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->len) &&
-			(!memcmp(pSSID->abySSID, ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->abySSID, pSSID->len))) {
+		if (bIs802_1x == true && pSSID->len == ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->len &&
+			!memcmp(pSSID->abySSID, ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->abySSID, pSSID->len)) {
 
 			bAdd_PMKID_Candidate((void *) pDevice,
 					 pBSSList->abyBSSID,
 					 &pBSSList->sRSNCapObj);
 
-			if ((pDevice->bLinkPass == true) &&
-			    (pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
-			    ((KeybGetTransmitKey(&(pDevice->sKey),
+			if (pDevice->bLinkPass == true &&
+			    pMgmt->eCurrState == WMAC_STATE_ASSOC &&
+			    (KeybGetTransmitKey(&(pDevice->sKey),
 						 pDevice->abyBSSID,
 						 PAIRWISE_KEY,
-						 &pTransmitKey) == true) ||
-			     (KeybGetTransmitKey(&(pDevice->sKey),
+						 &pTransmitKey) == true ||
+			     KeybGetTransmitKey(&(pDevice->sKey),
 						 pDevice->abyBSSID,
 						 GROUP_KEY,
-						 &pTransmitKey) == true))) {
+						 &pTransmitKey) == true)) {
 				pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList;
 				pDevice->gsPMKIDCandidate.Version = 1;
 
@@ -500,7 +500,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 	if (pSSID->len > WLAN_SSID_MAXLEN)
 		pSSID->len = WLAN_SSID_MAXLEN;
 
-	if ((pSSID->len != 0) && (pSSID->abySSID[0] != 0))
+	if (pSSID->len != 0 && pSSID->abySSID[0] != 0)
 		memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
 	memcpy(pBSSList->abySuppRates, pSuppRates, pSuppRates->len + WLAN_IEHDR_LEN);
 
@@ -525,10 +525,10 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 		pBSSList->uRSSI = pRxPacket->uRSSI;
 	pBSSList->bySQ = pRxPacket->bySQ;
 
-	if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
-	    (pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
+	if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA &&
+	    pMgmt->eCurrState == WMAC_STATE_ASSOC &&
 	    /* assoc with BSS */
-	    (pBSSList == pMgmt->pCurrBSS))
+	    pBSSList == pMgmt->pCurrBSS)
 		bParsingQuiet = true;
 
 	WPA_ClearRSN(pBSSList); /* mike update */
@@ -598,9 +598,9 @@ int BSSbIsSTAInNodeDB(struct vnt_private *pDevice,
 
 	/* Index = 0 reserved for AP Node */
 	for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
-		if ((pMgmt->sNodeDBTable[ii].bActive) &&
-		    (ether_addr_equal(abyDstAddr,
-				      pMgmt->sNodeDBTable[ii].abyMACAddr))) {
+		if (pMgmt->sNodeDBTable[ii].bActive &&
+		    ether_addr_equal(abyDstAddr,
+				     pMgmt->sNodeDBTable[ii].abyMACAddr)) {
 			*puNodeIndex = ii;
 			return true;
 		}
@@ -811,7 +811,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 
 	if (pDevice->byReAssocCount > 0) {
 		pDevice->byReAssocCount++;
-		if ((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) {  /* 10 sec timeout */
+		if (pDevice->byReAssocCount > 10 && pDevice->bLinkPass != true) {  /* 10 sec timeout */
 			printk("Re-association timeout!!!\n");
 			pDevice->byReAssocCount = 0;
 			/* if (pDevice->bWPASuppWextEnabled == true) */
@@ -888,7 +888,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 			if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) {
 				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending\n",
 						   ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt);
-				if ((ii > 0) && (pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15)) {
+				if (ii > 0 && pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15) {
 					BSSvRemoveOneNode(pDevice, ii);
 					DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Pending many queues PS STA Index = %d remove\n", ii);
 					continue;
@@ -898,7 +898,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 
 	}
 
-	if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->byBBType == BB_TYPE_11G)) {
+	if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->byBBType == BB_TYPE_11G) {
 
 		/* on/off protect mode */
 		if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) {
@@ -949,8 +949,8 @@ void BSSvSecondCallBack(struct work_struct *work)
 	pItemSSID = (PWLAN_IE_SSID) pMgmt->abyDesireSSID;
 	pCurrSSID = (PWLAN_IE_SSID) pMgmt->abyCurrSSID;
 
-	if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) ||
-		(pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) {
+	if (pMgmt->eCurrMode == WMAC_MODE_STANDBY ||
+		pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
 
 		if (pMgmt->sNodeDBTable[0].bActive) { /* Assoc with BSS */
 
@@ -959,8 +959,8 @@ void BSSvSecondCallBack(struct work_struct *work)
 				s_vCheckPreEDThreshold(pDevice);
 			}
 
-			if ((pMgmt->sNodeDBTable[0].uInActiveCount >= (LOST_BEACON_COUNT/2)) &&
-				(pDevice->byBBVGACurrent != pDevice->abyBBVGA[0])) {
+			if (pMgmt->sNodeDBTable[0].uInActiveCount >= (LOST_BEACON_COUNT/2) &&
+				pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) {
 				pDevice->byBBVGANew = pDevice->abyBBVGA[0];
 				bScheduleCommand((void *) pDevice,
 					WLAN_CMD_CHANGE_BBSENSITIVITY,
@@ -1004,7 +1004,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 					pDevice->uAutoReConnectTime = 0;
 					pDevice->uIsroamingTime = 0;
 					pDevice->bRoaming = false;
-				} else if ((pDevice->bRoaming == false) && (pDevice->bIsRoaming == true)) {
+				} else if (pDevice->bRoaming == false && pDevice->bIsRoaming == true) {
 					pDevice->uIsroamingTime++;
 					if (pDevice->uIsroamingTime >= 20)
 						pDevice->bIsRoaming = false;
@@ -1035,7 +1035,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 
 	if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
 		/* if adhoc started which essid is NULL string, rescanning. */
-		if ((pMgmt->eCurrState == WMAC_STATE_STARTED) && (pCurrSSID->len == 0)) {
+		if (pMgmt->eCurrState == WMAC_STATE_STARTED && pCurrSSID->len == 0) {
 			if (pDevice->uAutoReConnectTime < 10) {
 				pDevice->uAutoReConnectTime++;
 			} else {
@@ -1149,8 +1149,8 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 			pMgmt->sNodeDBTable[0].uTxRetry += byTxRetry;
 			if (byTxRetry != 0) {
 				pMgmt->sNodeDBTable[0].uTxFail[MAX_RATE] += byTxRetry;
-				if ((byFallBack == AUTO_FB_NONE) ||
-					(wRate < RATE_18M)) {
+				if (byFallBack == AUTO_FB_NONE ||
+					wRate < RATE_18M) {
 					pMgmt->sNodeDBTable[0].uTxFail[wRate] += byTxRetry;
 				} else if (byFallBack == AUTO_FB_0) {
 					for (ii = 0; ii < byTxRetry; ii++) {
@@ -1176,11 +1176,11 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 			}
 		}
 
-		if (((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
-		     (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) &&
-		    (BSSbIsSTAInNodeDB((void *) pDevice,
+		if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA ||
+		     pMgmt->eCurrMode == WMAC_MODE_ESS_AP) &&
+		    BSSbIsSTAInNodeDB((void *) pDevice,
 				       pbyDestAddr,
-				       &uNodeIndex))) {
+				       &uNodeIndex)) {
 			pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1;
 			if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
 				/* transmit success, TxAttempts at least plus one */
@@ -1274,8 +1274,8 @@ static void s_vCheckSensitivity(struct vnt_private *pDevice)
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 	int ii;
 
-	if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
-		((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) {
+	if (pMgmt->eCurrState == WMAC_STATE_ASSOC ||
+		(pMgmt->eCurrMode == WMAC_MODE_IBSS_STA && pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
 		pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID) pMgmt->abyCurrSSID);
 		if (pBSSList != NULL) {
 			/* Update BB register if RSSI is too strong */
@@ -1364,8 +1364,8 @@ static void s_vCheckPreEDThreshold(struct vnt_private *pDevice)
 	PKnownBSS pBSSList = NULL;
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 
-	if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
-		((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) {
+	if (pMgmt->eCurrState == WMAC_STATE_ASSOC ||
+		(pMgmt->eCurrMode == WMAC_MODE_IBSS_STA && pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
 		pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID) pMgmt->abyCurrSSID);
 		if (pBSSList != NULL) {
 			pDevice->byBBPreEDRSSI = (u8) (~(pBSSList->ldBmAverRange) + 1);
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 12/13] Staging: vt6656: Remove explicit comparisons against NULL
  2014-01-04 15:25 [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c Sebastian Rachuj
                   ` (10 preceding siblings ...)
  2014-01-04 15:25 ` [PATCH 11/13] Staging: vt6656: Remove bogus parentheses in conditions Sebastian Rachuj
@ 2014-01-04 15:25 ` Sebastian Rachuj
  2014-01-04 15:25 ` [PATCH 13/13] Staging: vt6656: Reduce line length of bssdb.c Sebastian Rachuj
  12 siblings, 0 replies; 14+ messages in thread
From: Sebastian Rachuj @ 2014-01-04 15:25 UTC (permalink / raw)
  To: sebastian.rachuj
  Cc: linux-kernel, linux, forest, gregkh, more.andres, tvboxspy,
	devel, linux-kernel

Explicit comparisons of pointers agains NULL
(like if (p != NULL) ...) are not as readable as the implicit
comparison (like if (p) ...). This patch converts all these explicit
comparisons to implicit ones.

Signed-off-by: Sebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: Simon Schuster <linux@rationality.eu>
---
 drivers/staging/vt6656/bssdb.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index b71bc33..6662d6e 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -100,18 +100,18 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 	int ii = 0;
 	int jj = 0;
 
-	if (pbyDesireBSSID != NULL) {
+	if (pbyDesireBSSID) {
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
 			"BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID);
 		if (!is_broadcast_ether_addr(pbyDesireBSSID) &&
 			memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)
 				pbyBSSID = pbyDesireBSSID;
 	}
-	if (pbyDesireSSID != NULL &&
+	if (pbyDesireSSID &&
 	    ((PWLAN_IE_SSID) pbyDesireSSID)->len != 0)
 		pSSID = (PWLAN_IE_SSID) pbyDesireSSID;
 
-	if (pbyBSSID != NULL && pDevice->bRoaming == false) {
+	if (pbyBSSID && pDevice->bRoaming == false) {
 		/* match BSSID first */
 		for (ii = 0; ii < MAX_BSS_NUM; ii++) {
 			pCurrBSS = &(pMgmt->sBSSList[ii]);
@@ -121,7 +121,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 			if (pCurrBSS->bActive &&
 			    pCurrBSS->bSelected == false &&
 			    ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) {
-				if (pSSID != NULL) {
+				if (pSSID) {
 					/* compare ssid */
 					if (!memcmp(pSSID->abySSID,
 						     ((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
@@ -155,7 +155,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 			pCurrBSS->bSelected = false;
 			if (pCurrBSS->bActive) {
 
-				if (pSSID != NULL &&
+				if (pSSID &&
 				    /* matched SSID */
 				    (memcmp(pSSID->abySSID,
 					    ((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
@@ -190,7 +190,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 					pCurrBSS->abyBSSID);
 				jj++;
 
-				if (pSelect == NULL)
+				if (!pSelect)
 					pSelect = pCurrBSS;
 				/* compare RSSI, select the strongest signal */
 				else if (pCurrBSS->uRSSI < pSelect->uRSSI)
@@ -200,7 +200,7 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 
 		pDevice->bSameBSSMaxNum = jj;
 
-		if (pSelect != NULL) {
+		if (pSelect) {
 			pSelect->bSelected = true;
 			if (pDevice->bRoaming == false) {
 				/* Einsn Add @20070907 */
@@ -342,7 +342,7 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 		pSuppRates->len = WLAN_RATES_MAXLEN;
 	memcpy(pBSSList->abySuppRates, pSuppRates, pSuppRates->len + WLAN_IEHDR_LEN);
 
-	if (pExtSuppRates != NULL) {
+	if (pExtSuppRates) {
 		if (pExtSuppRates->len > WLAN_RATES_MAXLEN)
 			pExtSuppRates->len = WLAN_RATES_MAXLEN;
 		memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, pExtSuppRates->len + WLAN_IEHDR_LEN);
@@ -375,7 +375,7 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 
 	WPA_ClearRSN(pBSSList);
 
-	if (pRSNWPA != NULL) {
+	if (pRSNWPA) {
 		unsigned int uLen = pRSNWPA->len + 2;
 
 		if (uLen <= (uIELength -
@@ -388,7 +388,7 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 
 	WPA2_ClearRSN(pBSSList);
 
-	if (pRSN != NULL) {
+	if (pRSN) {
 		unsigned int uLen = pRSN->len + 2;
 
 		if (uLen <= (uIELength -
@@ -487,7 +487,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 	signed long ldBm, ldBmSum;
 	bool bParsingQuiet = false;
 
-	if (pBSSList == NULL)
+	if (!pBSSList)
 		return false;
 
 	pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp);
@@ -504,7 +504,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 		memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
 	memcpy(pBSSList->abySuppRates, pSuppRates, pSuppRates->len + WLAN_IEHDR_LEN);
 
-	if (pExtSuppRates != NULL)
+	if (pExtSuppRates)
 		memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, pExtSuppRates->len + WLAN_IEHDR_LEN);
 	else
 		memset(pBSSList->abyExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
@@ -533,7 +533,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 
 	WPA_ClearRSN(pBSSList); /* mike update */
 
-	if (pRSNWPA != NULL) {
+	if (pRSNWPA) {
 		unsigned int uLen = pRSNWPA->len + 2;
 		if (uLen <= (uIELength -
 				(unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) {
@@ -545,7 +545,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 
 	WPA2_ClearRSN(pBSSList); /* mike update */
 
-	if (pRSN != NULL) {
+	if (pRSN) {
 		unsigned int uLen = pRSN->len + 2;
 		if (uLen <= (uIELength -
 				(unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) {
@@ -644,8 +644,8 @@ void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex)
 		*puNodeIndex = SelectIndex;
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Replace inactive node = %d\n", SelectIndex);
 		/* clear ps buffer */
-		if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next != NULL) {
-			while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)) != NULL)
+		if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next) {
+			while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)))
 				dev_kfree_skb(skb);
 		}
 	} else {
@@ -676,7 +676,7 @@ void BSSvRemoveOneNode(struct vnt_private *pDevice, u32 uNodeIndex)
 	u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
 	struct sk_buff *skb;
 
-	while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue)) != NULL)
+	while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue)))
 		dev_kfree_skb(skb);
 	/* clear context */
 	memset(&pMgmt->sNodeDBTable[uNodeIndex], 0, sizeof(KnownNodeDB));
@@ -1257,8 +1257,8 @@ void BSSvClearNodeDBTable(struct vnt_private *pDevice, u32 uStartIndex)
 	for (ii = uStartIndex; ii < (MAX_NODE_NUM + 1); ii++) {
 		if (pMgmt->sNodeDBTable[ii].bActive) {
 			/* check if sTxPSQueue has been initial */
-			if (pMgmt->sNodeDBTable[ii].sTxPSQueue.next != NULL) {
-				while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) {
+			if (pMgmt->sNodeDBTable[ii].sTxPSQueue.next) {
+				while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue))) {
 					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS skb != NULL %d\n", ii);
 					dev_kfree_skb(skb);
 				}
@@ -1277,7 +1277,7 @@ static void s_vCheckSensitivity(struct vnt_private *pDevice)
 	if (pMgmt->eCurrState == WMAC_STATE_ASSOC ||
 		(pMgmt->eCurrMode == WMAC_MODE_IBSS_STA && pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
 		pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID) pMgmt->abyCurrSSID);
-		if (pBSSList != NULL) {
+		if (pBSSList) {
 			/* Update BB register if RSSI is too strong */
 			signed long    LocalldBmAverage = 0;
 			signed long    uNumofdBm = 0;
@@ -1367,7 +1367,7 @@ static void s_vCheckPreEDThreshold(struct vnt_private *pDevice)
 	if (pMgmt->eCurrState == WMAC_STATE_ASSOC ||
 		(pMgmt->eCurrMode == WMAC_MODE_IBSS_STA && pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
 		pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID) pMgmt->abyCurrSSID);
-		if (pBSSList != NULL) {
+		if (pBSSList) {
 			pDevice->byBBPreEDRSSI = (u8) (~(pBSSList->ldBmAverRange) + 1);
 			BBvUpdatePreEDThreshold(pDevice, false);
 		}
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 13/13] Staging: vt6656: Reduce line length of bssdb.c
  2014-01-04 15:25 [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c Sebastian Rachuj
                   ` (11 preceding siblings ...)
  2014-01-04 15:25 ` [PATCH 12/13] Staging: vt6656: Remove explicit comparisons against NULL Sebastian Rachuj
@ 2014-01-04 15:25 ` Sebastian Rachuj
  12 siblings, 0 replies; 14+ messages in thread
From: Sebastian Rachuj @ 2014-01-04 15:25 UTC (permalink / raw)
  To: sebastian.rachuj
  Cc: linux-kernel, linux, forest, gregkh, more.andres, tvboxspy,
	devel, linux-kernel

From: Simon Schuster <linux@rationality.eu>

Long lines are split into multiple ones to reduce the line length.
Additionally some alignment fixes are made that previous patches
missed.

Unfortunately, due to the high indentation levels present in parts of
bssdb.c, this patch leaves some lines which are longer than 80
characters.

Signed-off-by: Sebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: Simon Schuster <linux@rationality.eu>
---
 drivers/staging/vt6656/bssdb.c | 301 +++++++++++++++++++++++++++--------------
 1 file changed, 201 insertions(+), 100 deletions(-)

diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index 6662d6e..9c78dab 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -104,8 +104,8 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
 			"BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID);
 		if (!is_broadcast_ether_addr(pbyDesireBSSID) &&
-			memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)
-				pbyBSSID = pbyDesireBSSID;
+		    memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)
+			pbyBSSID = pbyDesireBSSID;
 	}
 	if (pbyDesireSSID &&
 	    ((PWLAN_IE_SSID) pbyDesireSSID)->len != 0)
@@ -136,8 +136,10 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 						return pCurrBSS;
 					}
 				} else if (pMgmt->eConfigMode == WMAC_CONFIG_AUTO ||
-					(pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
-					(pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))) {
+					   (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA &&
+					    WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
+					   (pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA &&
+					    WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))) {
 					pCurrBSS->bSelected = true;
 					return pCurrBSS;
 				}
@@ -166,11 +168,15 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 					continue;
 				}
 
-				if ((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) ||
-					(pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))
-					) {
+				if ((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA &&
+				     WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) ||
+				    (pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA &&
+				     WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))) {
 					/* Type not match skip this BSS */
-					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSS type mismatch.... Config[%d] BSS[0x%04x]\n", pMgmt->eConfigMode, pCurrBSS->wCapInfo);
+					DBG_PRT(MSG_LEVEL_DEBUG,
+						KERN_INFO "BSS type mismatch.... Config[%d] BSS[0x%04x]\n",
+						pMgmt->eConfigMode,
+						pCurrBSS->wCapInfo);
 					continue;
 				}
 
@@ -180,7 +186,10 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
 				    (ePhyType != PHY_TYPE_11A &&
 				     PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) {
 					/* PhyType not match skip this BSS */
-					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse);
+					DBG_PRT(MSG_LEVEL_DEBUG,
+						KERN_INFO "Physical type mismatch.... ePhyType[%d] BSS[%d]\n",
+						ePhyType,
+						pCurrBSS->eNetworkTypeInUse);
 					continue;
 				}
 
@@ -232,7 +241,7 @@ void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID)
 		if (bKeepCurrBSSID &&
 		    pMgmt->sBSSList[ii].bActive &&
 		    ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID,
-			             pMgmt->abyCurrBSSID)) {
+				     pMgmt->abyCurrBSSID)) {
 
 			/* mike mark:
 			 * there are two BSSID's in list. If that AP is
@@ -321,7 +330,8 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 	}
 
 	if (ii == MAX_BSS_NUM) {
-		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get free KnowBSS node failed.\n");
+		DBG_PRT(MSG_LEVEL_DEBUG,
+			KERN_INFO "Get free KnowBSS node failed.\n");
 		return false;
 	}
 	/* save the BSS info */
@@ -340,16 +350,21 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 
 	if (pSuppRates->len > WLAN_RATES_MAXLEN)
 		pSuppRates->len = WLAN_RATES_MAXLEN;
-	memcpy(pBSSList->abySuppRates, pSuppRates, pSuppRates->len + WLAN_IEHDR_LEN);
+	memcpy(pBSSList->abySuppRates, pSuppRates,
+	       pSuppRates->len + WLAN_IEHDR_LEN);
 
 	if (pExtSuppRates) {
 		if (pExtSuppRates->len > WLAN_RATES_MAXLEN)
 			pExtSuppRates->len = WLAN_RATES_MAXLEN;
-		memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, pExtSuppRates->len + WLAN_IEHDR_LEN);
-		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSbInsertToBSSList: pExtSuppRates->len = %d\n", pExtSuppRates->len);
+		memcpy(pBSSList->abyExtSuppRates, pExtSuppRates,
+		       pExtSuppRates->len + WLAN_IEHDR_LEN);
+		DBG_PRT(MSG_LEVEL_DEBUG,
+			KERN_INFO "BSSbInsertToBSSList: pExtSuppRates->len = %d\n",
+			pExtSuppRates->len);
 
 	} else {
-		memset(pBSSList->abyExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
+		memset(pBSSList->abyExtSuppRates, 0,
+		       WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
 	}
 	pBSSList->sERP.byERP = psERP->byERP;
 	pBSSList->sERP.bERPExist = psERP->bERPExist;
@@ -379,7 +394,7 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 		unsigned int uLen = pRSNWPA->len + 2;
 
 		if (uLen <= (uIELength -
-				(unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) {
+			     (unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) {
 			pBSSList->wWPALen = uLen;
 			memcpy(pBSSList->byWPAIE, pRSNWPA, uLen);
 			WPA_ParseRSN(pBSSList, pRSNWPA);
@@ -392,26 +407,31 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 		unsigned int uLen = pRSN->len + 2;
 
 		if (uLen <= (uIELength -
-				(unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) {
+			     (unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) {
 			pBSSList->wRSNLen = uLen;
 			memcpy(pBSSList->byRSNIE, pRSN, uLen);
 			WPA2vParseRSN(pBSSList, pRSN);
 		}
 	}
 
-	if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2 || pBSSList->bWPA2Valid == true) {
+	if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2 ||
+	    pBSSList->bWPA2Valid == true) {
 
 		PSKeyItem  pTransmitKey = NULL;
 		bool	   bIs802_1x = false;
 
 		for (ii = 0; ii < pBSSList->wAKMSSAuthCount; ii++) {
-			if (pBSSList->abyAKMSSAuthType[ii] == WLAN_11i_AKMSS_802_1X) {
+			if (pBSSList->abyAKMSSAuthType[ii] ==
+					WLAN_11i_AKMSS_802_1X) {
 				bIs802_1x = true;
 				break;
 			}
 		}
-		if (bIs802_1x == true && pSSID->len == ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->len &&
-			!memcmp(pSSID->abySSID, ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->abySSID, pSSID->len)) {
+		if (bIs802_1x == true &&
+		    pSSID->len == ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->len &&
+		    !memcmp(pSSID->abySSID,
+			     ((PWLAN_IE_SSID) pMgmt->abyDesireSSID)->abySSID,
+			     pSSID->len)) {
 
 			bAdd_PMKID_Candidate((void *) pDevice,
 					 pBSSList->abyBSSID,
@@ -427,7 +447,8 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 						 pDevice->abyBSSID,
 						 GROUP_KEY,
 						 &pTransmitKey) == true)) {
-				pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList;
+				pDevice->gsPMKIDCandidate.StatusType =
+					Ndis802_11StatusType_PMKID_CandidateList;
 				pDevice->gsPMKIDCandidate.Version = 1;
 
 
@@ -438,7 +459,8 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
 	if (pDevice->bUpdateBBVGA) {
 		/* Monitor if RSSI is too strong. */
 		pBSSList->byRSSIStatCnt = 0;
-		RFvRSSITodBm(pDevice, (u8) (pRxPacket->uRSSI), &pBSSList->ldBmMAX);
+		RFvRSSITodBm(pDevice, (u8) (pRxPacket->uRSSI),
+			     &pBSSList->ldBmMAX);
 		pBSSList->ldBmAverage[0] = pBSSList->ldBmMAX;
 		pBSSList->ldBmAverRange = pBSSList->ldBmMAX;
 		for (ii = 1; ii < RSSI_STAT_COUNT; ii++)
@@ -502,12 +524,15 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 
 	if (pSSID->len != 0 && pSSID->abySSID[0] != 0)
 		memcpy(pBSSList->abySSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
-	memcpy(pBSSList->abySuppRates, pSuppRates, pSuppRates->len + WLAN_IEHDR_LEN);
+	memcpy(pBSSList->abySuppRates, pSuppRates,
+	       pSuppRates->len + WLAN_IEHDR_LEN);
 
 	if (pExtSuppRates)
-		memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, pExtSuppRates->len + WLAN_IEHDR_LEN);
+		memcpy(pBSSList->abyExtSuppRates, pExtSuppRates,
+		       pExtSuppRates->len + WLAN_IEHDR_LEN);
 	else
-		memset(pBSSList->abyExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
+		memset(pBSSList->abyExtSuppRates, 0,
+		       WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
 	pBSSList->sERP.byERP = psERP->byERP;
 	pBSSList->sERP.bERPExist = psERP->bERPExist;
 
@@ -536,7 +561,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 	if (pRSNWPA) {
 		unsigned int uLen = pRSNWPA->len + 2;
 		if (uLen <= (uIELength -
-				(unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) {
+			     (unsigned int) (u32) ((u8 *) pRSNWPA - pbyIEs))) {
 			pBSSList->wWPALen = uLen;
 			memcpy(pBSSList->byWPAIE, pRSNWPA, uLen);
 			WPA_ParseRSN(pBSSList, pRSNWPA);
@@ -548,7 +573,7 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
 	if (pRSN) {
 		unsigned int uLen = pRSN->len + 2;
 		if (uLen <= (uIELength -
-				(unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) {
+			     (unsigned int) (u32) ((u8 *) pRSN - pbyIEs))) {
 			pBSSList->wRSNLen = uLen;
 			memcpy(pBSSList->byRSNIE, pRSN, uLen);
 			WPA2vParseRSN(pBSSList, pRSN);
@@ -631,7 +656,8 @@ void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex)
 	for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
 		if (pMgmt->sNodeDBTable[ii].bActive) {
 			if (pMgmt->sNodeDBTable[ii].uInActiveCount > BigestCount) {
-				BigestCount = pMgmt->sNodeDBTable[ii].uInActiveCount;
+				BigestCount =
+					pMgmt->sNodeDBTable[ii].uInActiveCount;
 				SelectIndex = ii;
 			}
 		} else {
@@ -642,7 +668,8 @@ void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex)
 	/* if not found replace uInActiveCount with the largest one. */
 	if (ii == (MAX_NODE_NUM + 1)) {
 		*puNodeIndex = SelectIndex;
-		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Replace inactive node = %d\n", SelectIndex);
+		DBG_PRT(MSG_LEVEL_DEBUG,
+			KERN_INFO "Replace inactive node = %d\n", SelectIndex);
 		/* clear ps buffer */
 		if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next) {
 			while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)))
@@ -681,7 +708,8 @@ void BSSvRemoveOneNode(struct vnt_private *pDevice, u32 uNodeIndex)
 	/* clear context */
 	memset(&pMgmt->sNodeDBTable[uNodeIndex], 0, sizeof(KnownNodeDB));
 	/* clear tx bit map */
-	pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[uNodeIndex].wAID >> 3] &=  ~byMask[pMgmt->sNodeDBTable[uNodeIndex].wAID & 7];
+	pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[uNodeIndex].wAID >> 3] &=
+		~byMask[pMgmt->sNodeDBTable[uNodeIndex].wAID & 7];
 }
 
 /*
@@ -709,8 +737,8 @@ void BSSvUpdateAPNode(struct vnt_private *pDevice,
 						(PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates,
 						uRateLen);
 	pMgmt->abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES) pExtSuppRates,
-						(PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates,
-						uRateLen);
+						   (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates,
+						   uRateLen);
 	RATEvParseMaxRate((void *) pDevice,
 			  (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates,
 			  (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates,
@@ -720,13 +748,17 @@ void BSSvUpdateAPNode(struct vnt_private *pDevice,
 			  &(pMgmt->sNodeDBTable[0].wSuppRate),
 			  &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate),
 			  &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate));
-	memcpy(pMgmt->sNodeDBTable[0].abyMACAddr, pMgmt->abyCurrBSSID, WLAN_ADDR_LEN);
+	memcpy(pMgmt->sNodeDBTable[0].abyMACAddr, pMgmt->abyCurrBSSID,
+	       WLAN_ADDR_LEN);
 	pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxSuppRate;
-	pMgmt->sNodeDBTable[0].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(*pwCapInfo);
+	pMgmt->sNodeDBTable[0].bShortPreamble =
+			WLAN_GET_CAP_INFO_SHORTPREAMBLE(*pwCapInfo);
 	pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND;
 	/* Auto rate fallback function initiation.
 	 * RATEbInit(pDevice); */
-	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d\n", pMgmt->sNodeDBTable[0].wTxDataRate);
+	DBG_PRT(MSG_LEVEL_DEBUG,
+		KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d\n",
+		pMgmt->sNodeDBTable[0].wTxDataRate);
 
 }
 
@@ -811,7 +843,8 @@ void BSSvSecondCallBack(struct work_struct *work)
 
 	if (pDevice->byReAssocCount > 0) {
 		pDevice->byReAssocCount++;
-		if (pDevice->byReAssocCount > 10 && pDevice->bLinkPass != true) {  /* 10 sec timeout */
+		if (pDevice->byReAssocCount > 10 &&
+		    pDevice->bLinkPass != true) { /* 10 sec timeout */
 			printk("Re-association timeout!!!\n");
 			pDevice->byReAssocCount = 0;
 			/* if (pDevice->bWPASuppWextEnabled == true) */
@@ -820,7 +853,8 @@ void BSSvSecondCallBack(struct work_struct *work)
 				memset(&wrqu, 0, sizeof(wrqu));
 				wrqu.ap_addr.sa_family = ARPHRD_ETHER;
 				PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
-				wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
+				wireless_send_event(pDevice->dev, SIOCGIWAP,
+						    &wrqu, NULL);
 			}
 		} else if (pDevice->bLinkPass == true) {
 			pDevice->byReAssocCount = 0;
@@ -838,26 +872,33 @@ void BSSvSecondCallBack(struct work_struct *work)
 			pMgmt->sNodeDBTable[ii].uInActiveCount++;
 
 			if (ii > 0) {
-				if (pMgmt->sNodeDBTable[ii].uInActiveCount > MAX_INACTIVE_COUNT) {
+				if (pMgmt->sNodeDBTable[ii].uInActiveCount >
+						MAX_INACTIVE_COUNT) {
 					BSSvRemoveOneNode(pDevice, ii);
 					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
-						"Inactive timeout [%d] sec, STA index = [%d] remove\n", MAX_INACTIVE_COUNT, ii);
+						"Inactive timeout [%d] sec, STA index = [%d] remove\n",
+						MAX_INACTIVE_COUNT, ii);
 					continue;
 				}
 
-				if (pMgmt->sNodeDBTable[ii].eNodeState >= NODE_ASSOC) {
+				if (pMgmt->sNodeDBTable[ii].eNodeState >=
+						NODE_ASSOC) {
 
 					pDevice->uAssocCount++;
 
 					/* check if Non ERP exist */
-					if (pMgmt->sNodeDBTable[ii].uInActiveCount < ERP_RECOVER_COUNT) {
+					if (pMgmt->sNodeDBTable[ii].uInActiveCount <
+							ERP_RECOVER_COUNT) {
 						if (!pMgmt->sNodeDBTable[ii].bShortPreamble) {
-							pDevice->byERPFlag |= WLAN_SET_ERP_BARKER_MODE(1);
+							pDevice->byERPFlag |=
+								WLAN_SET_ERP_BARKER_MODE(1);
 							uLongPreambleSTACnt++;
 						}
 						if (!pMgmt->sNodeDBTable[ii].bERPExist) {
-							pDevice->byERPFlag |= WLAN_SET_ERP_NONERP_PRESENT(1);
-							pDevice->byERPFlag |= WLAN_SET_ERP_USE_PROTECTION(1);
+							pDevice->byERPFlag |=
+								WLAN_SET_ERP_NONERP_PRESENT(1);
+							pDevice->byERPFlag |=
+								WLAN_SET_ERP_USE_PROTECTION(1);
 						}
 						if (!pMgmt->sNodeDBTable[ii].bShortSlotTime)
 							uNonShortSlotSTACnt++;
@@ -886,11 +927,16 @@ void BSSvSecondCallBack(struct work_struct *work)
 
 			/* check if pending PS queue */
 			if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) {
-				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending\n",
-						   ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt);
-				if (ii > 0 && pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15) {
+				DBG_PRT(MSG_LEVEL_DEBUG,
+					KERN_INFO "Index= %d, Queue = %d pending\n",
+					ii,
+					pMgmt->sNodeDBTable[ii].wEnQueueCnt);
+				if (ii > 0 &&
+				    pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15) {
 					BSSvRemoveOneNode(pDevice, ii);
-					DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Pending many queues PS STA Index = %d remove\n", ii);
+					DBG_PRT(MSG_LEVEL_NOTICE,
+						KERN_INFO "Pending many queues PS STA Index = %d remove\n",
+						ii);
 					continue;
 				}
 			}
@@ -898,7 +944,8 @@ void BSSvSecondCallBack(struct work_struct *work)
 
 	}
 
-	if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->byBBType == BB_TYPE_11G) {
+	if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP &&
+	    pDevice->byBBType == BB_TYPE_11G) {
 
 		/* on/off protect mode */
 		if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) {
@@ -950,7 +997,7 @@ void BSSvSecondCallBack(struct work_struct *work)
 	pCurrSSID = (PWLAN_IE_SSID) pMgmt->abyCurrSSID;
 
 	if (pMgmt->eCurrMode == WMAC_MODE_STANDBY ||
-		pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
+	    pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
 
 		if (pMgmt->sNodeDBTable[0].bActive) { /* Assoc with BSS */
 
@@ -959,52 +1006,71 @@ void BSSvSecondCallBack(struct work_struct *work)
 				s_vCheckPreEDThreshold(pDevice);
 			}
 
-			if (pMgmt->sNodeDBTable[0].uInActiveCount >= (LOST_BEACON_COUNT/2) &&
-				pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) {
+			if (pMgmt->sNodeDBTable[0].uInActiveCount >=
+							(LOST_BEACON_COUNT/2) &&
+			    pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) {
 				pDevice->byBBVGANew = pDevice->abyBBVGA[0];
 				bScheduleCommand((void *) pDevice,
-					WLAN_CMD_CHANGE_BBSENSITIVITY,
-					NULL);
+						 WLAN_CMD_CHANGE_BBSENSITIVITY,
+						 NULL);
 			}
 
-			if (pMgmt->sNodeDBTable[0].uInActiveCount >= LOST_BEACON_COUNT) {
+			if (pMgmt->sNodeDBTable[0].uInActiveCount >=
+					LOST_BEACON_COUNT) {
 				pMgmt->sNodeDBTable[0].bActive = false;
 				pMgmt->eCurrMode = WMAC_MODE_STANDBY;
 				pMgmt->eCurrState = WMAC_STATE_IDLE;
 				netif_stop_queue(pDevice->dev);
 				pDevice->bLinkPass = false;
-				ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW);
+				ControlvMaskByte(pDevice,
+						 MESSAGE_REQUEST_MACREG,
+						 MAC_REG_PAPEDELAY, LEDSTS_STS,
+						 LEDSTS_SLOW);
 				pDevice->bRoaming = true;
 				pDevice->bIsRoaming = false;
 
-				DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n", pMgmt->sNodeDBTable[0].uInActiveCount);
+				DBG_PRT(MSG_LEVEL_NOTICE,
+					KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n",
+					pMgmt->sNodeDBTable[0].uInActiveCount);
 				/* let wpa supplicant know AP may disconnect */
 				{
 					union iwreq_data  wrqu;
 					memset(&wrqu, 0, sizeof(wrqu));
 						wrqu.ap_addr.sa_family = ARPHRD_ETHER;
 					PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
-					wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
+					wireless_send_event(pDevice->dev,
+							    SIOCGIWAP,
+							    &wrqu,
+							    NULL);
 				}
 			}
 		} else if (pItemSSID->len != 0) {
 			/* Davidwang */
-			if ((pDevice->bEnableRoaming == true)&&(!(pMgmt->Cisco_cckm))) {
-				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bRoaming %d, !\n", pDevice->bRoaming);
-				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bIsRoaming %d, !\n", pDevice->bIsRoaming);
-				if ((pDevice->bRoaming == true) && (pDevice->bIsRoaming == true)) {
-					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fast   Roaming ...\n");
-					BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass);
+			if ((pDevice->bEnableRoaming == true) &&
+			    (!(pMgmt->Cisco_cckm))) {
+				DBG_PRT(MSG_LEVEL_DEBUG,
+					KERN_INFO "bRoaming %d, !\n",
+					pDevice->bRoaming);
+				DBG_PRT(MSG_LEVEL_DEBUG,
+					KERN_INFO "bIsRoaming %d, !\n",
+					pDevice->bIsRoaming);
+				if ((pDevice->bRoaming == true) &&
+				    (pDevice->bIsRoaming == true)) {
+					DBG_PRT(MSG_LEVEL_DEBUG,
+						KERN_INFO "Fast   Roaming ...\n");
+					BSSvClearBSSList((void *) pDevice,
+							 pDevice->bLinkPass);
 					bScheduleCommand((void *) pDevice,
-						WLAN_CMD_BSSID_SCAN,
-						pMgmt->abyDesireSSID);
+							 WLAN_CMD_BSSID_SCAN,
+							 pMgmt->abyDesireSSID);
 					bScheduleCommand((void *) pDevice,
-						WLAN_CMD_SSID,
-						pMgmt->abyDesireSSID);
+							 WLAN_CMD_SSID,
+							 pMgmt->abyDesireSSID);
 					pDevice->uAutoReConnectTime = 0;
 					pDevice->uIsroamingTime = 0;
 					pDevice->bRoaming = false;
-				} else if (pDevice->bRoaming == false && pDevice->bIsRoaming == true) {
+				} else if (pDevice->bRoaming == false &&
+					   pDevice->bIsRoaming == true) {
 					pDevice->uIsroamingTime++;
 					if (pDevice->uIsroamingTime >= 20)
 						pDevice->bIsRoaming = false;
@@ -1017,10 +1083,13 @@ void BSSvSecondCallBack(struct work_struct *work)
 			} else {
 				/* mike use old encryption status for wpa reauthen */
 				if (pDevice->bWPADEVUp)
-					pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus;
+					pDevice->eEncryptionStatus =
+						pDevice->eOldEncryptionStatus;
 
-				DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Roaming ...\n");
-				BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass);
+				DBG_PRT(MSG_LEVEL_DEBUG,
+					KERN_INFO "Roaming ...\n");
+				BSSvClearBSSList((void *) pDevice,
+						 pDevice->bLinkPass);
 				pMgmt->eScanType = WMAC_SCAN_ACTIVE;
 				bScheduleCommand((void *) pDevice,
 						 WLAN_CMD_BSSID_SCAN,
@@ -1035,14 +1104,18 @@ void BSSvSecondCallBack(struct work_struct *work)
 
 	if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
 		/* if adhoc started which essid is NULL string, rescanning. */
-		if (pMgmt->eCurrState == WMAC_STATE_STARTED && pCurrSSID->len == 0) {
+		if (pMgmt->eCurrState == WMAC_STATE_STARTED &&
+		    pCurrSSID->len == 0) {
 			if (pDevice->uAutoReConnectTime < 10) {
 				pDevice->uAutoReConnectTime++;
 			} else {
-				DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Adhoc re-scanning ...\n");
+				DBG_PRT(MSG_LEVEL_NOTICE,
+					KERN_INFO "Adhoc re-scanning ...\n");
 				pMgmt->eScanType = WMAC_SCAN_ACTIVE;
-				bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
-				bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL);
+				bScheduleCommand((void *) pDevice,
+						 WLAN_CMD_BSSID_SCAN, NULL);
+				bScheduleCommand((void *) pDevice,
+						 WLAN_CMD_SSID, NULL);
 				pDevice->uAutoReConnectTime = 0;
 			}
 		}
@@ -1052,13 +1125,19 @@ void BSSvSecondCallBack(struct work_struct *work)
 				s_vCheckSensitivity(pDevice);
 				s_vCheckPreEDThreshold(pDevice);
 			}
-			if (pMgmt->sNodeDBTable[0].uInActiveCount >= ADHOC_LOST_BEACON_COUNT) {
-				DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost other STA beacon [%d] sec, started !\n", pMgmt->sNodeDBTable[0].uInActiveCount);
+			if (pMgmt->sNodeDBTable[0].uInActiveCount >=
+						ADHOC_LOST_BEACON_COUNT) {
+				DBG_PRT(MSG_LEVEL_NOTICE,
+					KERN_INFO "Lost other STA beacon [%d] sec, started !\n",
+					pMgmt->sNodeDBTable[0].uInActiveCount);
 				pMgmt->sNodeDBTable[0].uInActiveCount = 0;
 				pMgmt->eCurrState = WMAC_STATE_STARTED;
 				netif_stop_queue(pDevice->dev);
 				pDevice->bLinkPass = false;
-				ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW);
+				ControlvMaskByte(pDevice,
+						 MESSAGE_REQUEST_MACREG,
+						 MAC_REG_PAPEDELAY, LEDSTS_STS,
+						 LEDSTS_SLOW);
 			}
 		}
 	}
@@ -1129,16 +1208,19 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 				/* transmit success, TxAttempts at least plus one */
 				pMgmt->sNodeDBTable[0].uTxOk[MAX_RATE]++;
 				if ((byFallBack == AUTO_FB_NONE) ||
-					 (wRate < RATE_18M)) {
+				    (wRate < RATE_18M)) {
 					wFallBackRate = wRate;
 				} else if (byFallBack == AUTO_FB_0) {
 					if (byTxRetry < 5)
-						wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry];
+						wFallBackRate =
+							awHWRetry0[wRate-RATE_18M][byTxRetry];
 					else
-						wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
+						wFallBackRate =
+							awHWRetry0[wRate-RATE_18M][4];
 				} else if (byFallBack == AUTO_FB_1) {
 					if (byTxRetry < 5)
-						wFallBackRate = awHWRetry1[wRate-RATE_18M][byTxRetry];
+						wFallBackRate =
+							awHWRetry1[wRate-RATE_18M][byTxRetry];
 					else
 						wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
 				}
@@ -1150,7 +1232,7 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 			if (byTxRetry != 0) {
 				pMgmt->sNodeDBTable[0].uTxFail[MAX_RATE] += byTxRetry;
 				if (byFallBack == AUTO_FB_NONE ||
-					wRate < RATE_18M) {
+				    wRate < RATE_18M) {
 					pMgmt->sNodeDBTable[0].uTxFail[wRate] += byTxRetry;
 				} else if (byFallBack == AUTO_FB_0) {
 					for (ii = 0; ii < byTxRetry; ii++) {
@@ -1190,14 +1272,18 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 					wFallBackRate = wRate;
 				} else if (byFallBack == AUTO_FB_0) {
 					if (byTxRetry < 5)
-						wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry];
+						wFallBackRate =
+							awHWRetry0[wRate-RATE_18M][byTxRetry];
 					else
-						wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
+						wFallBackRate =
+							awHWRetry0[wRate-RATE_18M][4];
 				} else if (byFallBack == AUTO_FB_1) {
 					if (byTxRetry < 5)
-						wFallBackRate = awHWRetry1[wRate-RATE_18M][byTxRetry];
+						wFallBackRate =
+							awHWRetry1[wRate-RATE_18M][byTxRetry];
 					else
-						wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
+						wFallBackRate =
+							awHWRetry1[wRate-RATE_18M][4];
 				}
 				pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wFallBackRate]++;
 			} else {
@@ -1207,7 +1293,7 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
 			if (byTxRetry != 0) {
 				pMgmt->sNodeDBTable[uNodeIndex].uTxFail[MAX_RATE] += byTxRetry;
 				if ((byFallBack == AUTO_FB_NONE) ||
-					(wRate < RATE_18M)) {
+				    (wRate < RATE_18M)) {
 					pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wRate] += byTxRetry;
 				} else if (byFallBack == AUTO_FB_0) {
 					for (ii = 0; ii < byTxRetry; ii++) {
@@ -1259,7 +1345,9 @@ void BSSvClearNodeDBTable(struct vnt_private *pDevice, u32 uStartIndex)
 			/* check if sTxPSQueue has been initial */
 			if (pMgmt->sNodeDBTable[ii].sTxPSQueue.next) {
 				while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue))) {
-					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS skb != NULL %d\n", ii);
+					DBG_PRT(MSG_LEVEL_DEBUG,
+						KERN_INFO "PS skb != NULL %d\n",
+						ii);
 					dev_kfree_skb(skb);
 				}
 			}
@@ -1275,8 +1363,10 @@ static void s_vCheckSensitivity(struct vnt_private *pDevice)
 	int ii;
 
 	if (pMgmt->eCurrState == WMAC_STATE_ASSOC ||
-		(pMgmt->eCurrMode == WMAC_MODE_IBSS_STA && pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
-		pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID) pMgmt->abyCurrSSID);
+	    (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA &&
+	     pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
+		pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID,
+					       (PWLAN_IE_SSID) pMgmt->abyCurrSSID);
 		if (pBSSList) {
 			/* Update BB register if RSSI is too strong */
 			signed long    LocalldBmAverage = 0;
@@ -1290,15 +1380,22 @@ static void s_vCheckSensitivity(struct vnt_private *pDevice)
 			if (uNumofdBm > 0) {
 				LocalldBmAverage = LocalldBmAverage/uNumofdBm;
 				for (ii = 0; ii < BB_VGA_LEVEL; ii++) {
-					DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LocalldBmAverage:%ld, %ld %02x\n", LocalldBmAverage, pDevice->ldBmThreshold[ii], pDevice->abyBBVGA[ii]);
+					DBG_PRT(MSG_LEVEL_DEBUG,
+						KERN_INFO"LocalldBmAverage:%ld, %ld %02x\n",
+						LocalldBmAverage,
+						pDevice->ldBmThreshold[ii],
+						pDevice->abyBBVGA[ii]);
 					if (LocalldBmAverage < pDevice->ldBmThreshold[ii]) {
-						pDevice->byBBVGANew = pDevice->abyBBVGA[ii];
+						pDevice->byBBVGANew =
+							pDevice->abyBBVGA[ii];
 						break;
 					}
 				}
-				if (pDevice->byBBVGANew != pDevice->byBBVGACurrent) {
+				if (pDevice->byBBVGANew !=
+						pDevice->byBBVGACurrent) {
 					pDevice->uBBVGADiffCount++;
-					if (pDevice->uBBVGADiffCount >= BB_VGA_CHANGE_THRESHOLD)
+					if (pDevice->uBBVGADiffCount >=
+							BB_VGA_CHANGE_THRESHOLD)
 						bScheduleCommand(pDevice,
 							WLAN_CMD_CHANGE_BBSENSITIVITY,
 							NULL);
@@ -1365,10 +1462,14 @@ static void s_vCheckPreEDThreshold(struct vnt_private *pDevice)
 	struct vnt_manager *pMgmt = &pDevice->vnt_mgmt;
 
 	if (pMgmt->eCurrState == WMAC_STATE_ASSOC ||
-		(pMgmt->eCurrMode == WMAC_MODE_IBSS_STA && pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
-		pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID) pMgmt->abyCurrSSID);
+	    (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA &&
+	     pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
+		pBSSList = BSSpAddrIsInBSSList(pDevice,
+					       pMgmt->abyCurrBSSID,
+					       (PWLAN_IE_SSID) pMgmt->abyCurrSSID);
 		if (pBSSList) {
-			pDevice->byBBPreEDRSSI = (u8) (~(pBSSList->ldBmAverRange) + 1);
+			pDevice->byBBPreEDRSSI =
+				(u8) (~(pBSSList->ldBmAverRange) + 1);
 			BBvUpdatePreEDThreshold(pDevice, false);
 		}
 	}
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-01-04 15:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-04 15:25 [PATCHv3 0/13] Staging: vt6656: Cleanup of checkpatch problems in bssdb.c Sebastian Rachuj
2014-01-04 15:25 ` [PATCH 01/13] Staging: vt6656: Fix indentation of bssdb.c Sebastian Rachuj
2014-01-04 15:25 ` [PATCH 02/13] Staging: vt6656: Adjust comments in bssdb.c Sebastian Rachuj
2014-01-04 15:25 ` [PATCH 03/13] Staging: vt6656: Remove unnecessary semicolons Sebastian Rachuj
2014-01-04 15:25 ` [PATCH 04/13] Staging: vt6656: Correct operator coding style Sebastian Rachuj
2014-01-04 15:25 ` [PATCH 05/13] Staging: vt6656: Correct single space mistakes Sebastian Rachuj
2014-01-04 15:25 ` [PATCH 06/13] Staging: vt6656: Remove line feeds before else Sebastian Rachuj
2014-01-04 15:25 ` [PATCH 07/13] Staging: vt6656: Remove unnecessary spaces in format strings Sebastian Rachuj
2014-01-04 15:25 ` [PATCH 08/13] Staging: vt6656: Combine "else { if" to "else if" Sebastian Rachuj
2014-01-04 15:25 ` [PATCH 09/13] Staging: vt6656: Correct usage of braces Sebastian Rachuj
2014-01-04 15:25 ` [PATCH 10/13] Staging: vt6656: Combined nested conditions Sebastian Rachuj
2014-01-04 15:25 ` [PATCH 11/13] Staging: vt6656: Remove bogus parentheses in conditions Sebastian Rachuj
2014-01-04 15:25 ` [PATCH 12/13] Staging: vt6656: Remove explicit comparisons against NULL Sebastian Rachuj
2014-01-04 15:25 ` [PATCH 13/13] Staging: vt6656: Reduce line length of bssdb.c Sebastian Rachuj

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.