]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/staging/vt6655/bssdb.c
Merge tag 'arm64-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas...
[karo-tx-linux.git] / drivers / staging / vt6655 / bssdb.c
index 3bb3e7fa82e8cf58d919bc142c2e1cc7e178f559..f983915168b7883c30a435c4561b8571abb77f75 100644 (file)
 
 /*---------------------  Static Definitions -------------------------*/
 
-
-
-
 /*---------------------  Static Classes  ----------------------------*/
 
 /*---------------------  Static Variables  --------------------------*/
 static int msglevel = MSG_LEVEL_INFO;
 //static int          msglevel                =MSG_LEVEL_DEBUG;
 
-
-
 const unsigned short awHWRetry0[5][5] = {
        {RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
        {RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M},
@@ -86,8 +81,6 @@ const unsigned short awHWRetry1[5][5] = {
        {RATE_54M, RATE_54M, RATE_36M, RATE_18M, RATE_18M}
 };
 
-
-
 /*---------------------  Static Functions  --------------------------*/
 
 void s_vCheckSensitivity(
@@ -100,19 +93,13 @@ void s_uCalculateLinkQual(
 );
 #endif
 
-
 void s_vCheckPreEDThreshold(
        void *hDeviceContext
 );
 /*---------------------  Export Variables  --------------------------*/
 
-
 /*---------------------  Export Functions  --------------------------*/
 
-
-
-
-
 /*+
  *
  * Routine Description:
@@ -172,7 +159,7 @@ BSSpSearchBSSList(
                                                            ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))
 ) {
                                                                pCurrBSS->bSelected = true;
-                                                               return(pCurrBSS);
+                                                               return pCurrBSS;
                                                        }
                                                }
                                        } else {
@@ -181,7 +168,7 @@ BSSpSearchBSSList(
                                                    ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))
 ) {
                                                        pCurrBSS->bSelected = true;
-                                                       return(pCurrBSS);
+                                                       return pCurrBSS;
                                                }
                                        }
                                }
@@ -194,7 +181,6 @@ BSSpSearchBSSList(
                        //2007-0721-01<Add>by MikeLiu
                        pCurrBSS->bSelected = false;
                        if (pCurrBSS->bActive) {
-
                                if (pSSID != NULL) {
                                        // matched SSID
                                        if (!!memcmp(pSSID->abySSID,
@@ -260,14 +246,12 @@ BSSpSearchBSSList(
   memcpy(pbyDesireSSID,pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
   }*/
 
-                       return(pSelect);
+                       return pSelect;
                }
        }
-       return(NULL);
-
+       return NULL;
 }
 
-
 /*+
  *
  * Routine Description:
@@ -278,7 +262,6 @@ BSSpSearchBSSList(
  *
  -*/
 
-
 void
 BSSvClearBSSList(
        void *hDeviceContext,
@@ -311,8 +294,6 @@ BSSvClearBSSList(
        return;
 }
 
-
-
 /*+
  *
  * Routine Description:
@@ -338,8 +319,6 @@ BSSpAddrIsInBSSList(
                pBSSList = &(pMgmt->sBSSList[ii]);
                if (pBSSList->bActive) {
                        if (!compare_ether_addr(pBSSList->abyBSSID, abyBSSID)) {
-//                if (pSSID == NULL)
-//                    return pBSSList;
                                if (pSSID->len == ((PWLAN_IE_SSID)pBSSList->abySSID)->len) {
                                        if (memcmp(pSSID->abySSID,
                                                   ((PWLAN_IE_SSID)pBSSList->abySSID)->abySSID,
@@ -353,8 +332,6 @@ BSSpAddrIsInBSSList(
        return NULL;
 };
 
-
-
 /*+
  *
  * Routine Description:
@@ -386,7 +363,6 @@ BSSbInsertToBSSList(
        void *pRxPacketContext
 )
 {
-
        PSDevice     pDevice = (PSDevice)hDeviceContext;
        PSMgmtObject    pMgmt = pDevice->pMgmt;
        PSRxMgmtPacket  pRxPacket = (PSRxMgmtPacket)pRxPacketContext;
@@ -395,8 +371,6 @@ BSSbInsertToBSSList(
        bool bParsingQuiet = false;
        PWLAN_IE_QUIET  pQuiet = NULL;
 
-
-
        pBSSList = (PKnownBSS)&(pMgmt->sBSSList[0]);
 
        for (ii = 0; ii < MAX_BSS_NUM; ii++) {
@@ -488,7 +462,6 @@ BSSbInsertToBSSList(
        }
 
        if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pBSSList->bWPA2Valid == true)) {
-
                PSKeyItem  pTransmitKey = NULL;
                bool bIs802_1x = false;
 
@@ -500,7 +473,6 @@ BSSbInsertToBSSList(
                }
                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)) {
@@ -569,7 +541,6 @@ BSSbInsertToBSSList(
        return true;
 }
 
-
 /*+
  *
  * Routine Description:
@@ -611,12 +582,9 @@ BSSbUpdateToBSSList(
        bool bParsingQuiet = false;
        PWLAN_IE_QUIET  pQuiet = NULL;
 
-
-
        if (pBSSList == NULL)
                return false;
 
-
        HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp));
        LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp));
        pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
@@ -745,10 +713,6 @@ BSSbUpdateToBSSList(
        return true;
 }
 
-
-
-
-
 /*+
  *
  * Routine Description:
@@ -779,8 +743,6 @@ BSSDBbIsSTAInNodeDB(void *pMgmtObject, unsigned char *abyDstAddr,
        return false;
 };
 
-
-
 /*+
  *
  * Routine Description:
@@ -794,7 +756,6 @@ BSSDBbIsSTAInNodeDB(void *pMgmtObject, unsigned char *abyDstAddr,
 void
 BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex)
 {
-
        PSDevice     pDevice = (PSDevice)hDeviceContext;
        PSMgmtObject    pMgmt = pDevice->pMgmt;
        unsigned int ii;
@@ -810,8 +771,7 @@ BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex)
                                BigestCount = pMgmt->sNodeDBTable[ii].uInActiveCount;
                                SelectIndex = ii;
                        }
-               }
-               else {
+               } else {
                        break;
                }
        }
@@ -825,8 +785,7 @@ BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex)
                        while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)) != NULL)
                                dev_kfree_skb(skb);
                }
-       }
-       else {
+       } else {
                *puNodeIndex = ii;
        }
 
@@ -841,8 +800,6 @@ BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex)
        return;
 };
 
-
-
 /*+
  *
  * Routine Description:
@@ -859,13 +816,11 @@ BSSvRemoveOneNode(
        unsigned int uNodeIndex
 )
 {
-
        PSDevice        pDevice = (PSDevice)hDeviceContext;
        PSMgmtObject    pMgmt = pDevice->pMgmt;
        unsigned char 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
@@ -930,13 +885,8 @@ BSSvUpdateAPNode(
        // 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:
@@ -948,7 +898,6 @@ BSSvUpdateAPNode(
  *
  -*/
 
-
 void
 BSSvAddMulticastNode(
        void *hDeviceContext
@@ -978,13 +927,8 @@ BSSvAddMulticastNode(
        printk("BSSvAddMultiCastNode:pMgmt->sNodeDBTable[0].wTxDataRate is %d\n", pMgmt->sNodeDBTable[0].wTxDataRate);
 #endif
        pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND;
-
 };
 
-
-
-
-
 /*+
  *
  * Routine Description:
@@ -1027,13 +971,12 @@ BSSvSecondCallBack(
        MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO);
        if (((!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->bHWRadioOff == false)) || ((pDevice->byGPIO & GPIO0_DATA) && (pDevice->bHWRadioOff == true))) && (cc == false)) {
                cc = true;
-       }
-       else if (cc == true) {
-
+       } else if (cc == true) {
                if (pDevice->bHWRadioOff == true) {
                        if (!(pDevice->byGPIO & GPIO0_DATA))
 //||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
-                       { if (status == 1) goto start;
+                       {
+                               if (status == 1) goto start;
                                status = 1;
                                CARDbRadioPowerOff(pDevice);
                                pMgmt->sNodeDBTable[0].bActive = false;
@@ -1045,14 +988,16 @@ BSSvSecondCallBack(
                        }
                        if (pDevice->byGPIO & GPIO0_DATA)
 //||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
-                       {if (status == 2) goto start;
+                       {
+                               if (status == 2) goto start;
                                status = 2;
                                CARDbRadioPowerOn(pDevice);
-                       } }
-               else{
+                       }
+               } else {
                        if (pDevice->byGPIO & GPIO0_DATA)
 //||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
-                       {if (status == 3) goto start;
+                       {
+                               if (status == 3) goto start;
                                status = 3;
                                CARDbRadioPowerOff(pDevice);
                                pMgmt->sNodeDBTable[0].bActive = false;
@@ -1064,19 +1009,19 @@ BSSvSecondCallBack(
                        }
                        if (!(pDevice->byGPIO & GPIO0_DATA))
 //||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
-                       {if (status == 4) goto start;
+                       {
+                               if (status == 4) goto start;
                                status = 4;
                                CARDbRadioPowerOn(pDevice);
-                       } }
+                       }
+               }
        }
 start:
 #endif
 
-
        if (pDevice->wUseProtectCntDown > 0) {
                pDevice->wUseProtectCntDown--;
-       }
-       else {
+       } else {
                // disable protect mode
                pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1));
        }
@@ -1087,7 +1032,6 @@ start:
                        printk("Re-association timeout!!!\n");
                        pDevice->byReAssocCount = 0;
 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
-                       // if (pDevice->bWPASuppWextEnabled == true)
                        {
                                union iwreq_data  wrqu;
                                memset(&wrqu, 0, sizeof(wrqu));
@@ -1096,8 +1040,7 @@ start:
                                wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
                        }
 #endif
-               }
-               else if (pDevice->bLinkPass == true)
+               } else if (pDevice->bLinkPass == true)
                        pDevice->byReAssocCount = 0;
        }
 
@@ -1106,7 +1049,6 @@ start:
 #endif
 
        for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) {
-
                if (pMgmt->sNodeDBTable[ii].bActive) {
                        // Increase in-activity counter
                        pMgmt->sNodeDBTable[ii].uInActiveCount++;
@@ -1120,7 +1062,6 @@ start:
                                }
 
                                if (pMgmt->sNodeDBTable[ii].eNodeState >= NODE_ASSOC) {
-
                                        pDevice->uAssocCount++;
 
                                        // check if Non ERP exist
@@ -1142,7 +1083,6 @@ start:
                                if (pMgmt->sNodeDBTable[ii].bPSEnable)
                                        uSleepySTACnt++;
 
-
                        }
 
                        // Rate fallback check
@@ -1154,8 +1094,7 @@ start:
                                if (ii > 0) {
                                        // 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)
 #ifdef PLICE_DEBUG
@@ -1184,17 +1123,14 @@ start:
 
        }
 
-
        if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->eCurrentPHYType == PHY_TYPE_11G)) {
-
                // on/off protect mode
                if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) {
                        if (!pDevice->bProtectMode) {
                                MACvEnableProtectMD(pDevice->PortOffset);
                                pDevice->bProtectMode = true;
                        }
-               }
-               else {
+               } else {
                        if (pDevice->bProtectMode) {
                                MACvDisableProtectMD(pDevice->PortOffset);
                                pDevice->bProtectMode = false;
@@ -1208,8 +1144,7 @@ start:
                                BBvSetShortSlotTime(pDevice);
                                vUpdateIFS((void *)pDevice);
                        }
-               }
-               else {
+               } else {
                        if (!pDevice->bShortSlotTime) {
                                pDevice->bShortSlotTime = true;
                                BBvSetShortSlotTime(pDevice);
@@ -1224,8 +1159,7 @@ start:
                                MACvEnableBarkerPreambleMd(pDevice->PortOffset);
                                pDevice->bBarkerPreambleMd = true;
                        }
-               }
-               else {
+               } else {
                        if (pDevice->bBarkerPreambleMd) {
                                MACvDisableBarkerPreambleMd(pDevice->PortOffset);
                                pDevice->bBarkerPreambleMd = false;
@@ -1234,7 +1168,6 @@ start:
 
        }
 
-
        // Check if any STA in PS mode, enable DTIM multicast deliver
        if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
                if (uSleepySTACnt > 0)
@@ -1248,13 +1181,7 @@ start:
 
        if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) ||
            (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) {
-
                if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS
-                       // DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Callback inactive Count = [%d]\n", pMgmt->sNodeDBTable[0].uInActiveCount);
-                       //if (pDevice->bUpdateBBVGA) {
-                       //  s_vCheckSensitivity((void *) pDevice);
-                       //}
-
                        if (pDevice->bUpdateBBVGA) {
                                // s_vCheckSensitivity((void *) pDevice);
                                s_vCheckPreEDThreshold((void *)pDevice);
@@ -1289,7 +1216,6 @@ start:
                                        pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
                                }
 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
-                               // if (pDevice->bWPASuppWextEnabled == true)
                                {
                                        union iwreq_data  wrqu;
                                        memset(&wrqu, 0, sizeof(wrqu));
@@ -1299,8 +1225,7 @@ start:
                                }
 #endif
                        }
-               }
-               else if (pItemSSID->len != 0) {
+               } else if (pItemSSID->len != 0) {
                        if (pDevice->uAutoReConnectTime < 10) {
                                pDevice->uAutoReConnectTime++;
 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
@@ -1308,8 +1233,7 @@ start:
                                if (pDevice->bWPASuppWextEnabled == true)
                                        pDevice->uAutoReConnectTime = 0;
 #endif
-                       }
-                       else {
+                       } else {
                                //mike use old encryption status for wpa reauthen
                                if (pDevice->bWPADEVUp)
                                        pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus;
@@ -1329,8 +1253,7 @@ start:
                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);
@@ -1339,7 +1262,6 @@ start:
                        };
                }
                if (pMgmt->eCurrState == WMAC_STATE_JOINTED) {
-
                        if (pDevice->bUpdateBBVGA) {
                                //s_vCheckSensitivity((void *) pDevice);
                                s_vCheckPreEDThreshold((void *)pDevice);
@@ -1361,9 +1283,6 @@ start:
        return;
 }
 
-
-
-
 /*+
  *
  * Routine Description:
@@ -1377,8 +1296,6 @@ start:
  *
  -*/
 
-
-
 void
 BSSvUpdateNodeTxCounter(
        void *hDeviceContext,
@@ -1401,8 +1318,6 @@ BSSvUpdateNodeTxCounter(
 //     unsigned int txRetryTemp;
 //PLICE_DEBUG->
        //txRetryTemp = byTxRetry;
-       //if (txRetryTemp== 8)
-       //txRetryTemp -=3;
 //PLICE_DEBUG <-
        pTxBufHead = (PSTxBufHead) pbyBuffer;
        if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_0) {
@@ -1413,12 +1328,7 @@ BSSvUpdateNodeTxCounter(
                byFallBack = AUTO_FB_NONE;
        }
        wRate = pTxBufHead->wReserved; //?wRate
-       //printk("BSSvUpdateNodeTxCounter:byTxRetry is %d\n",byTxRetry);
 
-//printk("BSSvUpdateNodeTx:wRate is %d,byFallback is %d\n",wRate,byFallBack);
-//#ifdef       PLICE_DEBUG
-       //printk("BSSvUpdateNodeTx: wRate is %d\n",wRate);
-////#endif
        // Only Unicast using support rates
        if (pTxBufHead->wFIFOCtl & FIFOCTL_NEEDACK) {
                DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wRate %04X, byTsr0 %02X, byTsr1 %02X\n", wRate, byTsr0, byTsr1);
@@ -1433,7 +1343,6 @@ BSSvUpdateNodeTxCounter(
                                } else if (byFallBack == AUTO_FB_0) {
 //PLICE_DEBUG
                                        if (byTxRetry < 5)
-                                               //if (txRetryTemp < 5)
                                                wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry];
                                        //wFallBackRate = awHWRetry0[wRate-RATE_12M][byTxRetry];
                                        //wFallBackRate = awHWRetry0[wRate-RATE_18M][txRetryTemp] +1;
@@ -1461,18 +1370,12 @@ BSSvUpdateNodeTxCounter(
                                        for (ii = 0; ii < byTxRetry; ii++)
                                                //for (ii=0;ii<txRetryTemp;ii++)
                                        {
-                                               if (ii < 5)
-                                               {
-
+                                               if (ii < 5) {
 //PLICE_DEBUG
                                                        wFallBackRate = awHWRetry0[wRate-RATE_18M][ii];
-                                                       //printk(" II is %d:BSSvUpdateNodeTx:wFallBackRate is %d\n",ii,wFallBackRate);
                                                        //wFallBackRate = awHWRetry0[wRate-RATE_12M][ii];
-                                               }
-                                               else
-                                               {
+                                               } else {
                                                        wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
-                                                       //printk("ii is %d BSSvUpdateNodeTx:wFallBackRate is %d\n",ii,wFallBackRate);
                                                        //wFallBackRate = awHWRetry0[wRate-RATE_12M][4];
                                                }
                                                pMgmt->sNodeDBTable[0].uTxFail[wFallBackRate]++;
@@ -1491,7 +1394,6 @@ BSSvUpdateNodeTxCounter(
 
                if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
                    (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
-
                        pMACHeader = (PS802_11Header)(pbyBuffer + uFIFOHeaderSize);
 
                        if (BSSDBbIsSTAInNodeDB((void *)pMgmt,  &(pMACHeader->abyAddr1[0]), &uNodeIndex)) {
@@ -1546,13 +1448,8 @@ BSSvUpdateNodeTxCounter(
        }
 
        return;
-
-
 }
 
-
-
-
 /*+
  *
  * Routine Description:
@@ -1571,7 +1468,6 @@ BSSvUpdateNodeTxCounter(
  *
  -*/
 
-
 void
 BSSvClearNodeDBTable(
        void *hDeviceContext,
@@ -1600,7 +1496,6 @@ BSSvClearNodeDBTable(
        return;
 };
 
-
 void s_vCheckSensitivity(
        void *hDeviceContext
 )
@@ -1649,7 +1544,6 @@ void s_vCheckSensitivity(
        }
 }
 
-
 void
 BSSvClearAnyBSSJoinRecord(
        void *hDeviceContext
@@ -1684,22 +1578,16 @@ void s_uCalculateLinkQual(
        TxOkRatio = (TxCnt < 6) ? 4000 : ((pDevice->scStatistic.TxNoRetryOkCount * 4000) / TxCnt);
        RxOkRatio = (RxCnt < 6) ? 2000 : ((pDevice->scStatistic.RxOkCnt * 2000) / RxCnt);
 //decide link quality
-       if (pDevice->bLinkPass != true)
-       {
-               //  printk("s_uCalculateLinkQual-->Link disconnect and Poor quality**\n");
+       if (pDevice->bLinkPass != true) {
                pDevice->scStatistic.LinkQuality = 0;
                pDevice->scStatistic.SignalStren = 0;
-       }
-       else
-       {
+       } else {
                RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm);
                if (-ldBm < 50)  {
                        RssiRatio = 4000;
-               }
-               else if (-ldBm > 90) {
+               } else if (-ldBm > 90) {
                        RssiRatio = 0;
-               }
-               else {
+               } else {
                        RssiRatio = (40-(-ldBm-50))*4000/40;
                }
                pDevice->scStatistic.SignalStren = RssiRatio/40;
@@ -1732,4 +1620,3 @@ void s_vCheckPreEDThreshold(
        }
        return;
 }
-