diff options
Diffstat (limited to 'drivers/staging/vt6655')
25 files changed, 398 insertions, 473 deletions
diff --git a/drivers/staging/vt6655/80211hdr.h b/drivers/staging/vt6655/80211hdr.h index ba533402a9a..ba155cdded2 100644 --- a/drivers/staging/vt6655/80211hdr.h +++ b/drivers/staging/vt6655/80211hdr.h @@ -155,7 +155,7 @@ #ifdef __BIG_ENDIAN /* GET & SET Frame Control bit */ -#define WLAN_GET_FC_PRVER(n) ((((unsigned short)(n) >> 8) & (BIT0 | BIT1)) +#define WLAN_GET_FC_PRVER(n) (((unsigned short)(n) >> 8) & (BIT0 | BIT1)) #define WLAN_GET_FC_FTYPE(n) ((((unsigned short)(n) >> 8) & (BIT2 | BIT3)) >> 2) #define WLAN_GET_FC_FSTYPE(n) ((((unsigned short)(n) >> 8) & (BIT4|BIT5|BIT6|BIT7)) >> 4) #define WLAN_GET_FC_TODS(n) ((((unsigned short)(n) << 8) & (BIT8)) >> 8) diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index 959568a1eb6..fa14659ba43 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c @@ -1865,7 +1865,7 @@ BBvCalculateParameter( break; case RATE_5M: - if (bCCK == false) + if (!bCCK) cbBitCount++; cbUsCount = (cbBitCount * 10) / 55; cbTmp = (cbUsCount * 55) / 10; @@ -1879,7 +1879,7 @@ BBvCalculateParameter( case RATE_11M: - if (bCCK == false) + if (!bCCK) cbBitCount++; cbUsCount = cbBitCount / 11; cbTmp = cbUsCount * 11; diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index a23b591eeac..d7efd0173a9 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c @@ -64,7 +64,6 @@ /*--------------------- 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}, @@ -131,27 +130,26 @@ BSSpSearchBSSList( 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) { - // match BSSID first + /* match BSSID first */ for (ii = 0; ii < MAX_BSS_NUM; ii++) { pCurrBSS = &(pMgmt->sBSSList[ii]); - if (pDevice->bLinkPass == false) pCurrBSS->bSelected = false; + if (!pDevice->bLinkPass) + pCurrBSS->bSelected = false; if ((pCurrBSS->bActive) && - (pCurrBSS->bSelected == false)) { + (!pCurrBSS->bSelected)) { 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)) { @@ -176,26 +174,26 @@ BSSpSearchBSSList( } } } else { - // ignore BSSID + /* ignore BSSID */ for (ii = 0; ii < MAX_BSS_NUM; ii++) { pCurrBSS = &(pMgmt->sBSSList[ii]); - //2007-0721-01<Add>by MikeLiu + /* 2007-0721-01<Add>by MikeLiu */ 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; } @@ -203,50 +201,23 @@ BSSpSearchBSSList( 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; } } -/* - if (pMgmt->eAuthenMode < WMAC_AUTH_WPA) { - if (pCurrBSS->bWPAValid == true) { - // WPA AP will reject connection of station without WPA enable. - continue; - } - } else if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK)) { - if (pCurrBSS->bWPAValid == false) { - // station with WPA enable can't join NonWPA AP. - continue; - } - } else if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { - if (pCurrBSS->bWPA2Valid == false) { - // station with WPA2 enable can't join NonWPA2 AP. - continue; - } - } -*/ + if (pSelect == NULL) { pSelect = pCurrBSS; } else { - // compare RSSI, select signal strong one - if (pCurrBSS->uRSSI < pSelect->uRSSI) { + /* compare RSSI, select signal strong one */ + if (pCurrBSS->uRSSI < pSelect->uRSSI) pSelect = pCurrBSS; - } } } } if (pSelect != NULL) { pSelect->bSelected = true; -/* - if (pDevice->bRoaming == false) { - // Einsn Add @20070907 - memset(pbyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - memcpy(pbyDesireSSID,pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - }*/ - return pSelect; } } @@ -278,7 +249,6 @@ BSSvClearBSSList( if (pMgmt->sBSSList[ii].bActive && ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, pMgmt->abyCurrBSSID)) { - // bKeepCurrBSSID = false; continue; } } @@ -385,7 +355,7 @@ BSSbInsertToBSSList( 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); HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp)); @@ -416,15 +386,14 @@ BSSbInsertToBSSList( 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 { - if (pBSSList->sERP.bERPExist == true) { + if (pBSSList->sERP.bERPExist) pBSSList->eNetworkTypeInUse = PHY_TYPE_11G; - } else { + else pBSSList->eNetworkTypeInUse = PHY_TYPE_11B; - } } pBSSList->byRxRate = pRxPacket->byRxRate; @@ -434,10 +403,9 @@ BSSbInsertToBSSList( if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { - // assoc with BSS - if (pBSSList == pMgmt->pCurrBSS) { + /* assoc with BSS */ + if (pBSSList == pMgmt->pCurrBSS) bParsingQuiet = true; - } } WPA_ClearRSN(pBSSList); @@ -463,7 +431,7 @@ BSSbInsertToBSSList( } } - if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pBSSList->bWPA2Valid == true)) { + if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || pBSSList->bWPA2Valid) { PSKeyItem pTransmitKey = NULL; bool bIs802_1x = false; @@ -473,13 +441,13 @@ BSSbInsertToBSSList( break; } } - if ((bIs802_1x == true) && (pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len) && + if (bIs802_1x && (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)) { + if (pDevice->bLinkPass && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { + if (KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, PAIRWISE_KEY, &pTransmitKey) || + KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, GROUP_KEY, &pTransmitKey)) { pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList; pDevice->gsPMKIDCandidate.Version = 1; @@ -490,7 +458,7 @@ BSSbInsertToBSSList( } if (pDevice->bUpdateBBVGA) { - // Moniter if RSSI is too strong. + /* monitor if RSSI is too strong */ pBSSList->byRSSIStatCnt = 0; RFvRSSITodBm(pDevice, (unsigned char)(pRxPacket->uRSSI), &pBSSList->ldBmMAX); pBSSList->ldBmAverage[0] = pBSSList->ldBmMAX; @@ -498,16 +466,15 @@ BSSbInsertToBSSList( pBSSList->ldBmAverage[ii] = 0; } - if ((pIE_Country != NULL) && - (pMgmt->b11hEnable == true)) { + if ((pIE_Country != NULL) && pMgmt->b11hEnable) { set_country_info(pMgmt->pAdapter, pBSSList->eNetworkTypeInUse, pIE_Country); } - if ((bParsingQuiet == true) && (pIE_Quiet != NULL)) { + if (bParsingQuiet && (pIE_Quiet != NULL)) { if ((((PWLAN_IE_QUIET)pIE_Quiet)->len == 8) && (((PWLAN_IE_QUIET)pIE_Quiet)->byQuietCount != 0)) { - // valid EID + /* valid EID */ if (pQuiet == NULL) { pQuiet = (PWLAN_IE_QUIET)pIE_Quiet; CARDbSetQuiet(pMgmt->pAdapter, @@ -530,8 +497,7 @@ BSSbInsertToBSSList( } } - if ((bParsingQuiet == true) && - (pQuiet != NULL)) { + if (bParsingQuiet && (pQuiet != NULL)) { CARDbStartQuiet(pMgmt->pAdapter); } @@ -552,7 +518,7 @@ BSSbInsertToBSSList( * true if success. * -*/ -// TODO: input structure modify +/* TODO: input structure modify */ bool BSSbUpdateToBSSList( @@ -593,7 +559,6 @@ BSSbUpdateToBSSList( pBSSList->wCapInfo = cpu_to_le16(wCapInfo); pBSSList->uClearCount = 0; pBSSList->uChannel = byCurrChannel; -// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSbUpdateToBSSList: pBSSList->uChannel: %d\n", pBSSList->uChannel); if (pSSID->len > WLAN_SSID_MAXLEN) pSSID->len = WLAN_SSID_MAXLEN; @@ -602,23 +567,21 @@ BSSbUpdateToBSSList( 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; - // 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 { - if (pBSSList->sERP.bERPExist == true) { + if (pBSSList->sERP.bERPExist) pBSSList->eNetworkTypeInUse = PHY_TYPE_11G; - } else { + else pBSSList->eNetworkTypeInUse = PHY_TYPE_11B; - } } pBSSList->byRxRate = pRxPacket->byRxRate; @@ -629,13 +592,12 @@ BSSbUpdateToBSSList( if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { - // assoc with BSS - if (pBSSList == pMgmt->pCurrBSS) { + /* 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; @@ -646,7 +608,7 @@ BSSbUpdateToBSSList( } } - WPA2_ClearRSN(pBSSList); //mike update + WPA2_ClearRSN(pBSSList); /* mike update */ if (pRSN != NULL) { unsigned int uLen = pRSN->len + 2; @@ -659,27 +621,25 @@ BSSbUpdateToBSSList( if (pRxPacket->uRSSI != 0) { RFvRSSITodBm(pDevice, (unsigned char)(pRxPacket->uRSSI), &ldBm); - // Moniter if RSSI is too strong. + /* monitor if RSSI is too strong */ pBSSList->byRSSIStatCnt++; pBSSList->byRSSIStatCnt %= RSSI_STAT_COUNT; pBSSList->ldBmAverage[pBSSList->byRSSIStatCnt] = ldBm; for (ii = 0; ii < RSSI_STAT_COUNT; ii++) { - if (pBSSList->ldBmAverage[ii] != 0) { + if (pBSSList->ldBmAverage[ii] != 0) pBSSList->ldBmMAX = max(pBSSList->ldBmAverage[ii], ldBm); - } } } - if ((pIE_Country != NULL) && - (pMgmt->b11hEnable == true)) { + if ((pIE_Country != NULL) && pMgmt->b11hEnable) { set_country_info(pMgmt->pAdapter, pBSSList->eNetworkTypeInUse, pIE_Country); } - if ((bParsingQuiet == true) && (pIE_Quiet != NULL)) { + if (bParsingQuiet && (pIE_Quiet != NULL)) { if ((((PWLAN_IE_QUIET)pIE_Quiet)->len == 8) && (((PWLAN_IE_QUIET)pIE_Quiet)->byQuietCount != 0)) { - // valid EID + /* valid EID */ if (pQuiet == NULL) { pQuiet = (PWLAN_IE_QUIET)pIE_Quiet; CARDbSetQuiet(pMgmt->pAdapter, @@ -702,8 +662,7 @@ BSSbUpdateToBSSList( } } - if ((bParsingQuiet == true) && - (pQuiet != NULL)) { + if (bParsingQuiet && (pQuiet != NULL)) { CARDbStartQuiet(pMgmt->pAdapter); } @@ -732,7 +691,7 @@ BSSDBbIsSTAInNodeDB(void *pMgmtObject, unsigned char *abyDstAddr, PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject; 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, @@ -765,8 +724,10 @@ BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex) unsigned int BigestCount = 0; unsigned int 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) { @@ -779,11 +740,11 @@ BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex) } } - // if not found replace uInActiveCount is largest one. + /* if not found replace uInActiveCount is largest one */ if (ii == (MAX_NODE_NUM + 1)) { *puNodeIndex = SelectIndex; DBG_PRT(MSG_LEVEL_NOTICE, 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); @@ -795,7 +756,7 @@ BSSvCreateOneNode(void *hDeviceContext, unsigned int *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; @@ -826,9 +787,9 @@ BSSvRemoveOneNode( 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]; return; @@ -859,9 +820,8 @@ BSSvUpdateAPNode( memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB)); pMgmt->sNodeDBTable[0].bActive = true; - if (pDevice->eCurrentPHYType == PHY_TYPE_11B) { + if (pDevice->eCurrentPHYType == PHY_TYPE_11B) uRateLen = WLAN_RATES_MAXLEN_11B; - } pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, uRateLen); @@ -882,12 +842,10 @@ BSSvUpdateAPNode( 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; -#ifdef PLICE_DEBUG - printk("BSSvUpdateAPNode:MaxSuppRate is %d\n", pMgmt->sNodeDBTable[0].wMaxSuppRate); -#endif - // Auto rate fallback function initiation. - // RATEbInit(pDevice); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate); + netdev_dbg(pDevice->dev, "BSSvUpdateAPNode:MaxSuppRate is %d\n", + pMgmt->sNodeDBTable[0].wMaxSuppRate); + /* auto rate fallback function initiation */ + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->sNodeDBTable[0].wTxDataRate = %d\n", pMgmt->sNodeDBTable[0].wTxDataRate); }; /*+ @@ -926,9 +884,9 @@ BSSvAddMulticastNode( &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate) ); pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxBasicRate; -#ifdef PLICE_DEBUG - printk("BSSvAddMultiCastNode:pMgmt->sNodeDBTable[0].wTxDataRate is %d\n", pMgmt->sNodeDBTable[0].wTxDataRate); -#endif + netdev_dbg(pDevice->dev, + "BSSvAddMultiCastNode:pMgmt->sNodeDBTable[0].wTxDataRate is %d\n", + pMgmt->sNodeDBTable[0].wTxDataRate); pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND; }; @@ -944,7 +902,7 @@ BSSvAddMulticastNode( * none. * -*/ -//2008-4-14 <add> by chester for led issue +/* 2008-4-14 <add> by chester for led issue */ #ifdef FOR_LED_ON_NOTEBOOK bool cc = false; unsigned int status; @@ -961,7 +919,7 @@ BSSvSecondCallBack( unsigned int uSleepySTACnt = 0; unsigned int uNonShortSlotSTACnt = 0; unsigned int uLongPreambleSTACnt = 0; - viawget_wpa_header *wpahdr; //DavidWang + viawget_wpa_header *wpahdr; /* DavidWang */ spin_lock_irq(&pDevice->lock); @@ -969,51 +927,47 @@ BSSvSecondCallBack( pDevice->byERPFlag &= ~(WLAN_SET_ERP_BARKER_MODE(1) | WLAN_SET_ERP_NONERP_PRESENT(1)); - //2008-4-14 <add> by chester for led issue + /* 2008-4-14 <add> by chester for led issue */ #ifdef FOR_LED_ON_NOTEBOOK MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO); - if (((!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->bHWRadioOff == false)) || ((pDevice->byGPIO & GPIO0_DATA) && (pDevice->bHWRadioOff == true))) && (cc == false)) { + if (((!(pDevice->byGPIO & GPIO0_DATA) && (!pDevice->bHWRadioOff)) || + ((pDevice->byGPIO & GPIO0_DATA) && pDevice->bHWRadioOff)) && + (!cc)) { 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; + } else if (cc) { + if (pDevice->bHWRadioOff) { + if (!(pDevice->byGPIO & GPIO0_DATA)) { + if (status == 1) + goto start; status = 1; CARDbRadioPowerOff(pDevice); pMgmt->sNodeDBTable[0].bActive = false; pMgmt->eCurrMode = WMAC_MODE_STANDBY; pMgmt->eCurrState = WMAC_STATE_IDLE; - //netif_stop_queue(pDevice->dev); pDevice->bLinkPass = false; } - if (pDevice->byGPIO & GPIO0_DATA) -//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) - { - if (status == 2) goto start; + if (pDevice->byGPIO & GPIO0_DATA) { + if (status == 2) + goto start; status = 2; CARDbRadioPowerOn(pDevice); } } else { - if (pDevice->byGPIO & GPIO0_DATA) -//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) - { - if (status == 3) goto start; + if (pDevice->byGPIO & GPIO0_DATA) { + if (status == 3) + goto start; status = 3; CARDbRadioPowerOff(pDevice); pMgmt->sNodeDBTable[0].bActive = false; pMgmt->eCurrMode = WMAC_MODE_STANDBY; pMgmt->eCurrState = WMAC_STATE_IDLE; - //netif_stop_queue(pDevice->dev); pDevice->bLinkPass = false; } - if (!(pDevice->byGPIO & GPIO0_DATA)) -//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) - { - if (status == 4) goto start; + if (!(pDevice->byGPIO & GPIO0_DATA)) { + if (status == 4) + goto start; status = 4; CARDbRadioPowerOn(pDevice); } @@ -1025,14 +979,15 @@ start: if (pDevice->wUseProtectCntDown > 0) { pDevice->wUseProtectCntDown--; } else { - // disable protect mode + /* disable protect mode */ pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1)); } { pDevice->byReAssocCount++; - if ((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) { //10 sec timeout - printk("Re-association timeout!!!\n"); + /* 10 sec timeout */ + if ((pDevice->byReAssocCount > 10) && (!pDevice->bLinkPass)) { + netdev_info(pDevice->dev, "Re-association timeout!!!\n"); pDevice->byReAssocCount = 0; #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT { @@ -1043,7 +998,7 @@ start: wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); } #endif - } else if (pDevice->bLinkPass == true) + } else if (pDevice->bLinkPass) pDevice->byReAssocCount = 0; } @@ -1053,7 +1008,7 @@ start: 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) { @@ -1067,7 +1022,7 @@ start: if (pMgmt->sNodeDBTable[ii].eNodeState >= NODE_ASSOC) { 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); @@ -1082,43 +1037,39 @@ start: } } - // 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 ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (ii == 0)) - RATEvTxRateFallBack(pDevice, &(pMgmt->sNodeDBTable[ii])); -*/ 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) -#ifdef PLICE_DEBUG - printk("SecondCallback:Before:TxDataRate is %d\n", pMgmt->sNodeDBTable[0].wTxDataRate); -#endif + netdev_dbg(pDevice->dev, + "SecondCallback:Before:TxDataRate is %d\n", + pMgmt->sNodeDBTable[0].wTxDataRate); RATEvTxRateFallBack((void *)pDevice, &(pMgmt->sNodeDBTable[ii])); -#ifdef PLICE_DEBUG - printk("SecondCallback:After:TxDataRate is %d\n", pMgmt->sNodeDBTable[0].wTxDataRate); -#endif + netdev_dbg(pDevice->dev, + "SecondCallback:After:TxDataRate is %d\n", + pMgmt->sNodeDBTable[0].wTxDataRate); } } - // 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", + 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; } } @@ -1127,7 +1078,7 @@ start: } if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->eCurrentPHYType == PHY_TYPE_11G)) { - // on/off protect mode + /* on/off protect mode */ if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) { if (!pDevice->bProtectMode) { MACvEnableProtectMD(pDevice->PortOffset); @@ -1139,7 +1090,7 @@ start: pDevice->bProtectMode = false; } } - // on/off short slot time + /* on/off short slot time */ if (uNonShortSlotSTACnt > 0) { if (pDevice->bShortSlotTime) { @@ -1155,7 +1106,7 @@ start: } } - // on/off barker long preamble mode + /* on/off barker long preamble mode */ if (uLongPreambleSTACnt > 0) { if (!pDevice->bBarkerPreambleMd) { @@ -1171,7 +1122,7 @@ start: } - // 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; @@ -1184,11 +1135,10 @@ start: 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((void *) pDevice); + /* assoc with BSS */ + if (pMgmt->sNodeDBTable[0].bActive) { + if (pDevice->bUpdateBBVGA) s_vCheckPreEDThreshold((void *)pDevice); - } if ((pMgmt->sNodeDBTable[0].uInActiveCount >= (LOST_BEACON_COUNT/2)) && (pDevice->byBBVGACurrent != pDevice->abyBBVGA[0])) { @@ -1232,12 +1182,18 @@ start: if (pDevice->uAutoReConnectTime < 10) { pDevice->uAutoReConnectTime++; #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT - //network manager support need not do Roaming scan??? - if (pDevice->bWPASuppWextEnabled == true) + /* + * network manager support need not do + * Roaming scan??? + */ + if (pDevice->bWPASuppWextEnabled) pDevice->uAutoReConnectTime = 0; #endif } else { - //mike use old encryption status for wpa reauthen + /* + * mike use old encryption status + * for wpa reauthentication + */ if (pDevice->bWPADEVUp) pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus; @@ -1252,7 +1208,7 @@ start: } 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++; @@ -1262,13 +1218,11 @@ start: 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((void *) pDevice); + if (pDevice->bUpdateBBVGA) s_vCheckPreEDThreshold((void *)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; @@ -1318,40 +1272,31 @@ BSSvUpdateNodeTxCounter( unsigned short wFallBackRate = RATE_1M; unsigned char byFallBack; unsigned int ii; -// unsigned int txRetryTemp; -//PLICE_DEBUG-> - //txRetryTemp = byTxRetry; -//PLICE_DEBUG <- pTxBufHead = (PSTxBufHead) pbyBuffer; - if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_0) { + if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_0) byFallBack = AUTO_FB_0; - } else if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_1) { + else if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_1) byFallBack = AUTO_FB_1; - } else { + else byFallBack = AUTO_FB_NONE; - } - wRate = pTxBufHead->wReserved; //?wRate + wRate = pTxBufHead->wReserved; - // Only Unicast using support rates + /* 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); if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) { pMgmt->sNodeDBTable[0].uTxAttempts += 1; if ((byTsr1 & TSR1_TERR) == 0) { - // 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)) { wFallBackRate = wRate; } else if (byFallBack == AUTO_FB_0) { -//PLICE_DEBUG if (byTxRetry < 5) wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry]; - //wFallBackRate = awHWRetry0[wRate-RATE_12M][byTxRetry]; - //wFallBackRate = awHWRetry0[wRate-RATE_18M][txRetryTemp] +1; else wFallBackRate = awHWRetry0[wRate-RATE_18M][4]; - //wFallBackRate = awHWRetry0[wRate-RATE_12M][4]; } else if (byFallBack == AUTO_FB_1) { if (byTxRetry < 5) wFallBackRate = awHWRetry1[wRate-RATE_18M][byTxRetry]; @@ -1369,18 +1314,11 @@ BSSvUpdateNodeTxCounter( (wRate < RATE_18M)) { pMgmt->sNodeDBTable[0].uTxFail[wRate] += byTxRetry; } else if (byFallBack == AUTO_FB_0) { -//PLICE_DEBUG - for (ii = 0; ii < byTxRetry; ii++) - //for (ii=0;ii<txRetryTemp;ii++) - { - if (ii < 5) { -//PLICE_DEBUG + for (ii = 0; ii < byTxRetry; ii++) { + if (ii < 5) wFallBackRate = awHWRetry0[wRate-RATE_18M][ii]; - //wFallBackRate = awHWRetry0[wRate-RATE_12M][ii]; - } else { + else wFallBackRate = awHWRetry0[wRate-RATE_18M][4]; - //wFallBackRate = awHWRetry0[wRate-RATE_12M][4]; - } pMgmt->sNodeDBTable[0].uTxFail[wFallBackRate]++; } } else if (byFallBack == AUTO_FB_1) { @@ -1402,7 +1340,7 @@ BSSvUpdateNodeTxCounter( if (BSSDBbIsSTAInNodeDB((void *)pMgmt, &(pMACHeader->abyAddr1[0]), &uNodeIndex)) { pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1; if ((byTsr1 & TSR1_TERR) == 0) { - // 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)) { @@ -1485,7 +1423,7 @@ BSSvClearNodeDBTable( 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); @@ -1517,7 +1455,7 @@ void s_vCheckSensitivity( ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID); if (pBSSList != NULL) { - // Updata BB Reg if RSSI is too strong. + /* Update BB Reg if RSSI is too strong */ long LocalldBmAverage = 0; long uNumofdBm = 0; for (ii = 0; ii < RSSI_STAT_COUNT; ii++) { @@ -1556,9 +1494,8 @@ BSSvClearAnyBSSJoinRecord( PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int ii; - for (ii = 0; ii < MAX_BSS_NUM; ii++) { + for (ii = 0; ii < MAX_BSS_NUM; ii++) pMgmt->sBSSList[ii].bSelected = false; - } return; } @@ -1580,19 +1517,18 @@ void s_uCalculateLinkQual( pDevice->scStatistic.RxOkCnt; 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) { + /* decide link quality */ + if (!pDevice->bLinkPass) { pDevice->scStatistic.LinkQuality = 0; pDevice->scStatistic.SignalStren = 0; } else { RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm); - if (-ldBm < 50) { + 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; pDevice->scStatistic.LinkQuality = (RssiRatio+TxOkRatio+RxOkRatio)/100; } @@ -1616,10 +1552,8 @@ void s_vCheckPreEDThreshold( 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 != NULL) pDevice->byBBPreEDRSSI = (unsigned char) (~(pBSSList->ldBmAverRange) + 1); - //BBvUpdatePreEDThreshold(pDevice, false); - } } return; } diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c index fbf18e23e78..db38ca05113 100644 --- a/drivers/staging/vt6655/card.c +++ b/drivers/staging/vt6655/card.c @@ -1053,7 +1053,7 @@ CARDbAdd_PMKID_Candidate( for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; if (!memcmp(pCandidateList->BSSID, pbyBSSID, ETH_ALEN)) { - if ((bRSNCapExist == true) && (wRSNCap & BIT0)) { + if (bRSNCapExist && (wRSNCap & BIT0)) { pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; } else { pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); @@ -1064,7 +1064,7 @@ CARDbAdd_PMKID_Candidate( // New Candidate pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[pDevice->gsPMKIDCandidate.NumCandidates]; - if ((bRSNCapExist == true) && (wRSNCap & BIT0)) { + if (bRSNCapExist && (wRSNCap & BIT0)) { pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; } else { pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); @@ -1190,7 +1190,7 @@ CARDbStartMeasure( } } while (pDevice->uNumOfMeasureEIDs != 0); - if (bExpired == false) { + if (!bExpired) { MACvSelectPage1(pDevice->PortOffset); VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART, LODWORD(qwStartTSF)); VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART + 4, HIDWORD(qwStartTSF)); @@ -1280,7 +1280,7 @@ CARDbSetQuiet( PSDevice pDevice = (PSDevice) pDeviceHandler; unsigned int ii = 0; - if (bResetQuiet == true) { + if (bResetQuiet) { MACvRegBitsOff(pDevice->PortOffset, MAC_REG_MSRCTL, (MSRCTL_QUIETTXCHK | MSRCTL_QUIETEN)); for (ii = 0; ii < MAX_QUIET_COUNT; ii++) { pDevice->sQuiet[ii].bEnable = false; @@ -2013,7 +2013,7 @@ QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2) HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2) - 1; } else { HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2); - }; + } return qwTSFOffset; } diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c index ba9481fa654..3198a31e2ed 100644 --- a/drivers/staging/vt6655/channel.c +++ b/drivers/staging/vt6655/channel.c @@ -441,8 +441,8 @@ void init_channel_table(void *pDeviceHandler) break; } - if ((pDevice->dwDiagRefCount != 0) || (pDevice->b11hEnable == true)) { - if (bMultiBand == true) { + if ((pDevice->dwDiagRefCount != 0) || pDevice->b11hEnable) { + if (bMultiBand) { for (ii = 0; ii < CARD_MAX_CHANNEL_TBL; ii++) { sChannelTbl[ii + 1].bValid = true; pDevice->abyRegPwr[ii + 1] = pDevice->abyOFDMDefaultPwr[ii + 1]; @@ -463,7 +463,7 @@ void init_channel_table(void *pDeviceHandler) } } } else if (pDevice->byZoneType <= CCODE_MAX) { - if (bMultiBand == true) { + if (bMultiBand) { for (ii = 0; ii < CARD_MAX_CHANNEL_TBL; ii++) { if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] != 0) { sChannelTbl[ii + 1].bValid = true; @@ -531,7 +531,7 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel) return bResult; } - if (sChannelTbl[uConnectionChannel].bValid == false) { + if (!sChannelTbl[uConnectionChannel].bValid) { return false; } @@ -557,7 +557,7 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel) bResult &= RFbSelectChannel(pDevice->PortOffset, pDevice->byRFType, (unsigned char)uConnectionChannel); // Init Synthesizer Table - if (pDevice->bEnablePSMode == true) + if (pDevice->bEnablePSMode) RFvWriteWakeProgSyn(pDevice->PortOffset, pDevice->byRFType, uConnectionChannel); //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CARDbSetMediaChannel: %d\n", (unsigned char)uConnectionChannel); @@ -766,7 +766,7 @@ unsigned char auto_channel_select(void *pDeviceHandler, CARD_PHY_TYPE ePHYType) if (ePHYType == PHY_TYPE_11A) { for (ii = CB_MAX_CHANNEL_24G + 1; ii <= CB_MAX_CHANNEL; ii++) { - if (sChannelTbl[ii].bValid == true) { + if (sChannelTbl[ii].bValid) { if (byOptionChannel == 0) { byOptionChannel = (unsigned char) ii; } @@ -780,7 +780,7 @@ unsigned char auto_channel_select(void *pDeviceHandler, CARD_PHY_TYPE ePHYType) } else { byOptionChannel = 0; for (ii = 1; ii <= CB_MAX_CHANNEL_24G; ii++) { - if (sChannelTbl[ii].bValid == true) { + if (sChannelTbl[ii].bValid) { if (sChannelTbl[ii].byMAP == 0) { aiWeight[ii] += 100; } else if (sChannelTbl[ii].byMAP & 0x01) { @@ -807,7 +807,7 @@ unsigned char auto_channel_select(void *pDeviceHandler, CARD_PHY_TYPE ePHYType) } } for (ii = 1; ii <= CB_MAX_CHANNEL_24G; ii++) { - if ((sChannelTbl[ii].bValid == true) && + if (sChannelTbl[ii].bValid && (aiWeight[ii] > aiWeight[byOptionChannel])) { byOptionChannel = (unsigned char) ii; } diff --git a/drivers/staging/vt6655/datarate.c b/drivers/staging/vt6655/datarate.c index e7b6bc7de4a..c9a89cd7633 100644 --- a/drivers/staging/vt6655/datarate.c +++ b/drivers/staging/vt6655/datarate.c @@ -218,8 +218,7 @@ RATEvParseMaxRate( for (ii = 0; ii < uRateLen; ii++) { byRate = (unsigned char)(pItemRates->abyRates[ii]); - if (WLAN_MGMT_IS_BASICRATE(byRate) && - (bUpdateBasicRate == true)) { + if (WLAN_MGMT_IS_BASICRATE(byRate) && bUpdateBasicRate) { // Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate CARDbAddBasicRate((void *)pDevice, wGetRateIdx(byRate)); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ParseMaxRate AddBasicRate: %d\n", wGetRateIdx(byRate)); @@ -329,7 +328,7 @@ RATEvTxRateFallBack( for (ii = 0; ii < MAX_RATE; ii++) { if (psNodeDBTable->wSuppRate & (0x0001<<ii)) { - if (bAutoRate[ii] == true) { + if (bAutoRate[ii]) { wIdxUpRate = (unsigned short) ii; } } else { @@ -354,8 +353,7 @@ RATEvTxRateFallBack( wIdxDownRate = psNodeDBTable->wTxDataRate; for (ii = psNodeDBTable->wTxDataRate; ii > 0;) { ii--; - if ((dwThroughputTbl[ii] > dwThroughput) && - (bAutoRate[ii] == true)) { + if ((dwThroughputTbl[ii] > dwThroughput) && bAutoRate[ii]) { dwThroughput = dwThroughputTbl[ii]; wIdxDownRate = (unsigned short) ii; } diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h index ca1b8578cf7..062c3a374b9 100644 --- a/drivers/staging/vt6655/device.h +++ b/drivers/staging/vt6655/device.h @@ -31,7 +31,6 @@ #include <linux/module.h> #include <linux/types.h> -#include <linux/init.h> #include <linux/mm.h> #include <linux/errno.h> #include <linux/ioport.h> diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index e93fdc88d84..a952df1bf9d 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -267,7 +267,7 @@ static CHIP_INFO chip_info_table[] = { {0, NULL} }; -DEFINE_PCI_DEVICE_TABLE(vt6655_pci_id_table) = { +const struct pci_device_id vt6655_pci_id_table[] = { { PCI_VDEVICE(VIA, 0x3253), (kernel_ulong_t)chip_info_table}, { 0, } }; @@ -561,7 +561,7 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) pDevice->byTxAntennaMode = ANT_B; pDevice->dwTxAntennaSel = 1; pDevice->dwRxAntennaSel = 1; - if (pDevice->bTxRxAntInv == true) + if (pDevice->bTxRxAntInv) pDevice->byRxAntennaMode = ANT_A; else pDevice->byRxAntennaMode = ANT_B; @@ -578,13 +578,13 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) pDevice->dwRxAntennaSel = 0; if (byValue & EEP_ANTENNA_AUX) { pDevice->byTxAntennaMode = ANT_A; - if (pDevice->bTxRxAntInv == true) + if (pDevice->bTxRxAntInv) pDevice->byRxAntennaMode = ANT_B; else pDevice->byRxAntennaMode = ANT_A; } else { pDevice->byTxAntennaMode = ANT_B; - if (pDevice->bTxRxAntInv == true) + if (pDevice->bTxRxAntInv) pDevice->byRxAntennaMode = ANT_A; else pDevice->byRxAntennaMode = ANT_B; @@ -635,7 +635,7 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) pDevice->byRFType &= RF_MASK; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRFType = %x\n", pDevice->byRFType); - if (pDevice->bZoneRegExist == false) { + if (!pDevice->bZoneRegExist) { pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE]; } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byZoneType = %x\n", pDevice->byZoneType); @@ -742,7 +742,7 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) if (!(pDevice->byGPIO & GPIO0_DATA)) { pDevice->bHWRadioOff = false; } } - if ((pDevice->bRadioControlOff == true)) { + if (pDevice->bRadioControlOff) { CARDbRadioPowerOff(pDevice); } else CARDbRadioPowerOn(pDevice); #else @@ -751,7 +751,7 @@ static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) pDevice->bHWRadioOff = true; } } - if ((pDevice->bHWRadioOff == true) || (pDevice->bRadioControlOff == true)) { + if (pDevice->bHWRadioOff || pDevice->bRadioControlOff) { CARDbRadioPowerOff(pDevice); } @@ -809,7 +809,7 @@ static bool device_release_WPADEV(PSDevice pDevice) int ii = 0; // wait_queue_head_t Set_wait; //send device close to wpa_supplicnat layer - if (pDevice->bWPADEVUp == true) { + if (pDevice->bWPADEVUp) { wpahdr = (viawget_wpa_header *)pDevice->skb->data; wpahdr->type = VIAWGET_DEVICECLOSE_MSG; wpahdr->resp_ie_len = 0; @@ -826,7 +826,7 @@ static bool device_release_WPADEV(PSDevice pDevice) //wait release WPADEV // init_waitqueue_head(&Set_wait); // wait_event_timeout(Set_wait, ((pDevice->wpadev==NULL)&&(pDevice->skb == NULL)),5*HZ); //1s wait - while ((pDevice->bWPADEVUp == true)) { + while (pDevice->bWPADEVUp) { set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(HZ / 20); //wait 50ms ii++; @@ -892,7 +892,7 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) #ifdef DEBUG printk("Before get pci_info memaddr is %x\n", pDevice->memaddr); #endif - if (device_get_pci_info(pDevice, pcid) == false) { + if (!device_get_pci_info(pDevice, pcid)) { printk(KERN_ERR DEVICE_NAME ": Failed to find PCI device.\n"); device_free_info(pDevice); return -ENODEV; @@ -1633,7 +1633,7 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx) { bFull = true; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " AC0DMA is Full = %d\n", pDevice->iTDUsed[uIdx]); } - if (netif_queue_stopped(pDevice->dev) && (bFull == false)) { + if (netif_queue_stopped(pDevice->dev) && !bFull) { netif_wake_queue(pDevice->dev); } } @@ -1798,7 +1798,7 @@ static int device_open(struct net_device *dev) { pDevice->byReAssocCount = 0; pDevice->bWPADEVUp = false; // Patch: if WEP key already set by iwconfig but device not yet open - if ((pDevice->bEncryptionEnable == true) && (pDevice->bTransmitKey == true)) { + if (pDevice->bEncryptionEnable && pDevice->bTransmitKey) { KeybSetDefaultKey(&(pDevice->sKey), (unsigned long)(pDevice->byKeyIndex | (1 << 31)), pDevice->uKeyLength, @@ -1895,7 +1895,7 @@ static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) { return 0; } - if (pDevice->bStopTx0Pkt == true) { + if (pDevice->bStopTx0Pkt) { dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); return 0; @@ -1924,7 +1924,7 @@ bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeI SKeyItem STempKey; // unsigned char byKeyIndex = 0; - if (pDevice->bStopTx0Pkt == true) { + if (pDevice->bStopTx0Pkt) { dev_kfree_skb_irq(skb); return false; } @@ -1993,14 +1993,14 @@ bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeI } else if (pDevice->eCurrentPHYType == PHY_TYPE_11A) { byPktType = PK_TYPE_11A; } else { - if (pDevice->bProtectMode == true) { + if (pDevice->bProtectMode) { byPktType = PK_TYPE_11GB; } else { byPktType = PK_TYPE_11GA; } } - if (pDevice->bEncryptionEnable == true) + if (pDevice->bEncryptionEnable) bNeedEncryption = true; if (pDevice->bEnableHostWEP) { @@ -2076,7 +2076,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { bool bNodeExist = false; spin_lock_irq(&pDevice->lock); - if (pDevice->bLinkPass == false) { + if (!pDevice->bLinkPass) { dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); return 0; @@ -2130,7 +2130,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { } } - if (bNodeExist == false) { + if (!bNodeExist) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Unknown STA not found in node DB \n"); dev_kfree_skb_irq(skb); spin_unlock_irq(&pDevice->lock); @@ -2149,7 +2149,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { cbFrameBodySize += 8; } - if (pDevice->bEncryptionEnable == true) { + if (pDevice->bEncryptionEnable) { bNeedEncryption = true; // get Transmit key do { @@ -2196,7 +2196,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { if (pDevice->bEnableHostWEP) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "acdma0: STA index %d\n", uNodeIndex); - if (pDevice->bEncryptionEnable == true) { + if (pDevice->bEncryptionEnable) { pTransmitKey = &STempKey; pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite; pTransmitKey->dwKeyIndex = pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex; @@ -2286,7 +2286,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { } else if (pDevice->eCurrentPHYType == PHY_TYPE_11A) { byPktType = PK_TYPE_11A; } else { - if (pDevice->bProtectMode == true) { + if (pDevice->bProtectMode) { byPktType = PK_TYPE_11GB; } else { byPktType = PK_TYPE_11GA; @@ -2297,7 +2297,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { // printk("FIX RATE:CurrentRate is %d"); //#endif - if (bNeedEncryption == true) { + if (bNeedEncryption) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ntohs Pkt Type=%04x\n", ntohs(pDevice->sTxEthHeader.wType)); if ((pDevice->sTxEthHeader.wType) == TYPE_PKT_802_1x) { bNeedEncryption = false; @@ -2306,7 +2306,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) { if (pTransmitKey == NULL) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Don't Find TX KEY\n"); } else { - if (bTKIP_UseGTK == true) { + if (bTKIP_UseGTK) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "error: KEY is GTK!!~~\n"); } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Find PTK [%lX]\n", pTransmitKey->dwKeyIndex); @@ -2493,7 +2493,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { MACvSelectPage0(pDevice->PortOffset); //xxxx // WCMDbFlushCommandQueue(pDevice->pMgmt, true); - if (set_channel(pDevice, pDevice->pCurrMeasureEID->sReq.byChannel) == true) { + if (set_channel(pDevice, pDevice->pCurrMeasureEID->sReq.byChannel)) { pDevice->bMeasureInProgress = true; MACvSelectPage1(pDevice->PortOffset); MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_READY); @@ -2544,12 +2544,12 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { if (pDevice->dwIsr & ISR_QUIETSTART) { do { ; - } while (CARDbStartQuiet(pDevice) == false); + } while (!CARDbStartQuiet(pDevice)); } } if (pDevice->dwIsr & ISR_TBTT) { - if (pDevice->bEnableFirstQuiet == true) { + if (pDevice->bEnableFirstQuiet) { pDevice->byQuietStartCount--; if (pDevice->byQuietStartCount == 0) { pDevice->bEnableFirstQuiet = false; @@ -2558,7 +2558,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { MACvSelectPage0(pDevice->PortOffset); } } - if ((pDevice->bChannelSwitch == true) && + if (pDevice->bChannelSwitch && (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE)) { pDevice->byChannelSwitchCount--; if (pDevice->byChannelSwitchCount == 0) { @@ -2575,7 +2575,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { if (pDevice->eOPMode == OP_MODE_ADHOC) { //pDevice->bBeaconSent = false; } else { - if ((pDevice->bUpdateBBVGA) && (pDevice->bLinkPass == true) && (pDevice->uCurrRSSI != 0)) { + if ((pDevice->bUpdateBBVGA) && pDevice->bLinkPass && (pDevice->uCurrRSSI != 0)) { long ldBm; RFvRSSITodBm(pDevice, (unsigned char) pDevice->uCurrRSSI, &ldBm); @@ -2642,7 +2642,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { } pDevice->bBeaconSent = true; - if (pDevice->bChannelSwitch == true) { + if (pDevice->bChannelSwitch) { pDevice->byChannelSwitchCount--; if (pDevice->byChannelSwitchCount == 0) { pDevice->bChannelSwitch = false; @@ -3237,7 +3237,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { netif_stop_queue(pDevice->dev); #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT pMgmt->eScanType = WMAC_SCAN_ACTIVE; - if (pDevice->bWPASuppWextEnabled != true) + if (!pDevice->bWPASuppWextEnabled) #endif bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL); @@ -3373,7 +3373,7 @@ viawget_resume(struct pci_dev *pcid) spin_lock_irq(&pDevice->lock); MACvRestoreContext(pDevice->PortOffset, pDevice->abyMacContext); device_init_registers(pDevice, DEVICE_INIT_DXPL); - if (pMgmt->sNodeDBTable[0].bActive == true) { // Assoc with BSS + if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS pMgmt->sNodeDBTable[0].bActive = false; pDevice->bLinkPass = false; if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c index 0ff51cb4a20..0a29c901541 100644 --- a/drivers/staging/vt6655/dpc.c +++ b/drivers/staging/vt6655/dpc.c @@ -169,7 +169,7 @@ s_vProcessRxMACHeader(PSDevice pDevice, unsigned char *pbyRxBufferAddr, } } else { cbHeaderSize += WLAN_HDR_ADDR3_LEN; - }; + } pbyRxBuffer = (unsigned char *)(pbyRxBufferAddr + cbHeaderSize); if (ether_addr_equal(pbyRxBuffer, pDevice->abySNAP_Bridgetunnel)) { @@ -263,7 +263,7 @@ s_vGetDASA(unsigned char *pbyRxBufferAddr, unsigned int *pcbHeaderSize, psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr2[ii]; } } - }; + } *pcbHeaderSize = cbHeaderSize; } @@ -379,7 +379,7 @@ device_receive_frame( pMACHeader = (PS802_11Header)((unsigned char *)(skb->data) + 8); //PLICE_DEBUG<- - if (pDevice->bMeasureInProgress == true) { + if (pDevice->bMeasureInProgress) { if ((*pbyRsr & RSR_CRCOK) != 0) { pDevice->byBasicMap |= 0x01; } @@ -436,7 +436,7 @@ device_receive_frame( } if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - if (s_bAPModeRxCtl(pDevice, pbyFrame, iSANodeIndex) == true) { + if (s_bAPModeRxCtl(pDevice, pbyFrame, iSANodeIndex)) { return false; } } @@ -592,7 +592,7 @@ device_receive_frame( } } else { // Control Frame - }; + } return false; } else { if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { @@ -608,8 +608,7 @@ device_receive_frame( } } else { // discard DATA packet while not associate || BSSID error - if ((pDevice->bLinkPass == false) || - !(*pbyRsr & RSR_BSSIDOK)) { + if (!pDevice->bLinkPass || !(*pbyRsr & RSR_BSSIDOK)) { if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n", @@ -658,7 +657,7 @@ device_receive_frame( // Now it only supports 802.11g Infrastructure Mode, and support rate must up to 54 Mbps if (pDevice->bDiversityEnable && (FrameSize > 50) && (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) && - (pDevice->bLinkPass == true)) { + pDevice->bLinkPass) { BBvAntennaDiversity(pDevice, s_byGetRateIdx(*pbyRxRate), 0); } @@ -683,7 +682,7 @@ device_receive_frame( // ----------------------------------------------- - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnable8021x == true)) { + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && pDevice->bEnable8021x) { unsigned char abyMacHdr[24]; // Only 802.1x packet incoming allowed @@ -698,7 +697,7 @@ device_receive_frame( if (wEtherType == ETH_P_PAE) { skb->dev = pDevice->apdev; - if (bIsWEP == true) { + if (bIsWEP) { // strip IV header(8) memcpy(&abyMacHdr[0], (skb->data + 4), 24); memcpy((skb->data + 4 + cbIVOffset), &abyMacHdr[0], 24); @@ -770,8 +769,9 @@ device_receive_frame( //DBG_PRN_GRP12(("LocalL: %lx, LocalR: %lx\n", dwLocalMIC_L, dwLocalMIC_R)); //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dwMICKey0= %lx,dwMICKey1= %lx \n", dwMICKey0, dwMICKey1); - if ((cpu_to_le32(*pdwMIC_L) != dwLocalMIC_L) || (cpu_to_le32(*pdwMIC_R) != dwLocalMIC_R) || - (pDevice->bRxMICFail == true)) { + if ((cpu_to_le32(*pdwMIC_L) != dwLocalMIC_L) || + (cpu_to_le32(*pdwMIC_R) != dwLocalMIC_R) || + pDevice->bRxMICFail) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIC comparison is fail!\n"); pDevice->bRxMICFail = false; //pDevice->s802_11Counter.TKIPLocalMICFailures.QuadPart++; @@ -894,13 +894,13 @@ device_receive_frame( return false; if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { - if (s_bAPModeRxData(pDevice, + if (!s_bAPModeRxData(pDevice, skb, FrameSize, cbHeaderOffset, iSANodeIndex, iDANodeIndex -) == false) { +)) { if (bDeFragRx) { if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) { DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n", @@ -1123,7 +1123,7 @@ static bool s_bHandleRxEncryption( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey == NULL\n"); if (byDecMode == KEY_CTL_WEP) { // pDevice->s802_11Counter.WEPUndecryptableCount.QuadPart++; - } else if (pDevice->bLinkPass == true) { + } else if (pDevice->bLinkPass) { // pDevice->s802_11Counter.DecryptFailureCount.QuadPart++; } return false; @@ -1131,7 +1131,7 @@ static bool s_bHandleRxEncryption( if (byDecMode != pKey->byCipherSuite) { if (byDecMode == KEY_CTL_WEP) { // pDevice->s802_11Counter.WEPUndecryptableCount.QuadPart++; - } else if (pDevice->bLinkPass == true) { + } else if (pDevice->bLinkPass) { // pDevice->s802_11Counter.DecryptFailureCount.QuadPart++; } *pKeyOut = NULL; @@ -1234,7 +1234,7 @@ static bool s_bHostWepRxEncryption( if (byDecMode != pKey->byCipherSuite) { if (byDecMode == KEY_CTL_WEP) { // pDevice->s802_11Counter.WEPUndecryptableCount.QuadPart++; - } else if (pDevice->bLinkPass == true) { + } else if (pDevice->bLinkPass) { // pDevice->s802_11Counter.DecryptFailureCount.QuadPart++; } return false; @@ -1245,7 +1245,7 @@ static bool s_bHostWepRxEncryption( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "byDecMode == KEY_CTL_WEP \n"); if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == true) || - (bOnFly == false)) { + !bOnFly) { // Software WEP // 1. 3253A // 2. WEP 256 @@ -1277,7 +1277,7 @@ static bool s_bHostWepRxEncryption( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "TSC0_15: %x\n", *pwRxTSC15_0); if (byDecMode == KEY_CTL_TKIP) { - if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || (bOnFly == false)) { + if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || !bOnFly) { // Software TKIP // 1. 3253 A // 2. NotOnFly @@ -1297,7 +1297,7 @@ static bool s_bHostWepRxEncryption( } if (byDecMode == KEY_CTL_CCMP) { - if (bOnFly == false) { + if (!bOnFly) { // Software CCMP // NotOnFly DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "soft KEY_CTL_CCMP\n"); diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c index ab8b2ba6eed..6eecd535891 100644 --- a/drivers/staging/vt6655/hostap.c +++ b/drivers/staging/vt6655/hostap.c @@ -454,7 +454,7 @@ static int hostap_set_encryption(PSDevice pDevice, unsigned long dwKeyIndex = 0; unsigned char abyKey[MAX_KEY_LEN]; unsigned char abySeq[MAX_KEY_LEN]; - NDIS_802_11_KEY_RSC KeyRSC; + unsigned long long KeyRSC; unsigned char byKeyDecMode = KEY_CTL_WEP; int ret = 0; int iNodeIndex = -1; @@ -495,11 +495,11 @@ static int hostap_set_encryption(PSDevice pDevice, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: alg %d \n", param->u.crypt.alg); if (param->u.crypt.alg == WPA_ALG_NONE) { - if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly == true) { - if (KeybRemoveKey(&(pDevice->sKey), + if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly) { + if (!KeybRemoveKey(&(pDevice->sKey), param->sta_addr, pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex, - pDevice->PortOffset) == false) { + pDevice->PortOffset)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybRemoveKey fail \n"); } pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false; @@ -557,7 +557,7 @@ static int hostap_set_encryption(PSDevice pDevice, (unsigned char *)abyKey, KEY_CTL_WEP, pDevice->PortOffset, - pDevice->byLocalID) == true) { + pDevice->byLocalID)) { pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; } else { @@ -624,7 +624,7 @@ static int hostap_set_encryption(PSDevice pDevice, (unsigned char *)abyKey, byKeyDecMode, pDevice->PortOffset, - pDevice->byLocalID) == true) { + pDevice->byLocalID)) { pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; } else { @@ -636,7 +636,7 @@ static int hostap_set_encryption(PSDevice pDevice, } - if (bKeyTableFull == true) { + if (bKeyTableFull) { wKeyCtl &= 0x7F00; // clear all key control filed wKeyCtl |= (byKeyDecMode << 4); wKeyCtl |= (byKeyDecMode); diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c index 4bff8aa96be..ac3fc16704c 100644 --- a/drivers/staging/vt6655/iwctl.c +++ b/drivers/staging/vt6655/iwctl.c @@ -1632,7 +1632,7 @@ int iwctl_giwsens(struct net_device *dev, wrq->value = ldBm; } else { wrq->value = 0; - }; + } wrq->disabled = (wrq->value == 0); wrq->fixed = 1; @@ -1827,7 +1827,7 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; struct viawget_wpa_param *param = NULL; //original member - wpa_alg alg_name; + enum wpa_alg alg_name; u8 addr[6]; int key_idx, set_tx = 0; u8 seq[IW_ENCODE_SEQ_MAX_SIZE]; diff --git a/drivers/staging/vt6655/key.c b/drivers/staging/vt6655/key.c index 04c1304d16e..eab3b41f9e3 100644 --- a/drivers/staging/vt6655/key.c +++ b/drivers/staging/vt6655/key.c @@ -64,13 +64,12 @@ s_vCheckKeyTableValid(PSKeyManagement pTable, unsigned long dwIoBase) int i; for (i = 0; i < MAX_KEY_TABLE; i++) { - if ((pTable->KeyTable[i].bInUse == true) && - (pTable->KeyTable[i].PairwiseKey.bKeyValid == false) && - (pTable->KeyTable[i].GroupKey[0].bKeyValid == false) && - (pTable->KeyTable[i].GroupKey[1].bKeyValid == false) && - (pTable->KeyTable[i].GroupKey[2].bKeyValid == false) && - (pTable->KeyTable[i].GroupKey[3].bKeyValid == false) -) { + if (pTable->KeyTable[i].bInUse && + !pTable->KeyTable[i].PairwiseKey.bKeyValid && + !pTable->KeyTable[i].GroupKey[0].bKeyValid && + !pTable->KeyTable[i].GroupKey[1].bKeyValid && + !pTable->KeyTable[i].GroupKey[2].bKeyValid && + !pTable->KeyTable[i].GroupKey[3].bKeyValid) { pTable->KeyTable[i].bInUse = false; pTable->KeyTable[i].wKeyCtl = 0; pTable->KeyTable[i].bSoftWEP = false; @@ -140,17 +139,17 @@ bool KeybGetKey( *pKey = NULL; for (i = 0; i < MAX_KEY_TABLE; i++) { - if ((pTable->KeyTable[i].bInUse == true) && + if (pTable->KeyTable[i].bInUse && ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { if (dwKeyIndex == 0xFFFFFFFF) { - if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) { + if (pTable->KeyTable[i].PairwiseKey.bKeyValid) { *pKey = &(pTable->KeyTable[i].PairwiseKey); return true; } else { return false; } } else if (dwKeyIndex < MAX_GROUP_KEY) { - if (pTable->KeyTable[i].GroupKey[dwKeyIndex].bKeyValid == true) { + if (pTable->KeyTable[i].GroupKey[dwKeyIndex].bKeyValid) { *pKey = &(pTable->KeyTable[i].GroupKey[dwKeyIndex]); return true; } else { @@ -202,12 +201,11 @@ bool KeybSetKey( j = (MAX_KEY_TABLE-1); for (i = 0; i < (MAX_KEY_TABLE - 1); i++) { - if ((pTable->KeyTable[i].bInUse == false) && - (j == (MAX_KEY_TABLE-1))) { + if (!pTable->KeyTable[i].bInUse && (j == (MAX_KEY_TABLE-1))) { // found empty table j = i; } - if ((pTable->KeyTable[i].bInUse == true) && + if (pTable->KeyTable[i].bInUse && ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { // found table already exist if ((dwKeyIndex & PAIRWISE_KEY) != 0) { @@ -384,7 +382,7 @@ bool KeybRemoveKey( } for (i = 0; i < MAX_KEY_TABLE; i++) { - if ((pTable->KeyTable[i].bInUse == true) && + if (pTable->KeyTable[i].bInUse && ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { if ((dwKeyIndex & PAIRWISE_KEY) != 0) { pTable->KeyTable[i].PairwiseKey.bKeyValid = false; @@ -428,7 +426,7 @@ bool KeybRemoveAllKey( int i, u; for (i = 0; i < MAX_KEY_TABLE; i++) { - if ((pTable->KeyTable[i].bInUse == true) && + if (pTable->KeyTable[i].bInUse && ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { pTable->KeyTable[i].PairwiseKey.bKeyValid = false; for (u = 0; u < MAX_GROUP_KEY; u++) { @@ -461,7 +459,7 @@ void KeyvRemoveWEPKey( ) { if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) { - if (pTable->KeyTable[MAX_KEY_TABLE-1].bInUse == true) { + if (pTable->KeyTable[MAX_KEY_TABLE-1].bInUse) { if (pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].byCipherSuite == KEY_CTL_WEP) { pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false; if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex & 0x7FFFFFFF)) { @@ -511,10 +509,10 @@ bool KeybGetTransmitKey( *pKey = NULL; for (i = 0; i < MAX_KEY_TABLE; i++) { - if ((pTable->KeyTable[i].bInUse == true) && + if (pTable->KeyTable[i].bInUse && ether_addr_equal(pTable->KeyTable[i].abyBSSID, pbyBSSID)) { if (dwKeyType == PAIRWISE_KEY) { - if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) { + if (pTable->KeyTable[i].PairwiseKey.bKeyValid) { *pKey = &(pTable->KeyTable[i].PairwiseKey); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybGetTransmitKey:"); @@ -535,7 +533,7 @@ bool KeybGetTransmitKey( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ERROR: dwGTKeyIndex == 0 !!!\n"); return false; } - if (pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)].bKeyValid == true) { + if (pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)].bKeyValid) { *pKey = &(pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)]); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybGetTransmitKey:"); @@ -583,8 +581,8 @@ bool KeybCheckPairewiseKey( *pKey = NULL; for (i = 0; i < MAX_KEY_TABLE; i++) { - if ((pTable->KeyTable[i].bInUse == true) && - (pTable->KeyTable[i].PairwiseKey.bKeyValid == true)) { + if (pTable->KeyTable[i].bInUse && + pTable->KeyTable[i].PairwiseKey.bKeyValid) { *pKey = &(pTable->KeyTable[i].PairwiseKey); return true; } @@ -657,7 +655,7 @@ bool KeybSetDefaultKey( pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= 0x4000; // disable on-fly disable address match pTable->KeyTable[MAX_KEY_TABLE-1].bSoftWEP = true; } else { - if (pTable->KeyTable[MAX_KEY_TABLE-1].bSoftWEP == false) + if (!pTable->KeyTable[MAX_KEY_TABLE-1].bSoftWEP) pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl |= 0xC000; // enable on-fly disable address match } @@ -740,7 +738,7 @@ bool KeybSetAllGroupKey( } for (i = 0; i < MAX_KEY_TABLE - 1; i++) { - if (pTable->KeyTable[i].bInUse == true) { + if (pTable->KeyTable[i].bInUse) { // found table already exist // Group key pKey = &(pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF]); diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c index 001d15c0fa4..21bd8a1126d 100644 --- a/drivers/staging/vt6655/mac.c +++ b/drivers/staging/vt6655/mac.c @@ -957,13 +957,13 @@ bool MACbSafeStop(unsigned long dwIoBase) { MACvRegBitsOff(dwIoBase, MAC_REG_TCR, TCR_AUTOBCNTX); - if (MACbSafeRxOff(dwIoBase) == false) { + if (!MACbSafeRxOff(dwIoBase)) { DBG_PORT80(0xA1); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " MACbSafeRxOff == false)\n"); MACbSafeSoftwareReset(dwIoBase); return false; } - if (MACbSafeTxOff(dwIoBase) == false) { + if (!MACbSafeTxOff(dwIoBase)) { DBG_PORT80(0xA2); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " MACbSafeTxOff == false)\n"); MACbSafeSoftwareReset(dwIoBase); diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c index 2340d2f0399..4bd1ccb7951 100644 --- a/drivers/staging/vt6655/power.c +++ b/drivers/staging/vt6655/power.c @@ -260,7 +260,7 @@ PSvSendPSPOLL( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet failed..\n"); } else { // DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet success..\n"); - }; + } return; } @@ -284,16 +284,15 @@ PSbSendNullPacket( PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int uIdx; - if (pDevice->bLinkPass == false) { + if (!pDevice->bLinkPass) { return false; } #ifdef TxInSleep - if ((pDevice->bEnablePSMode == false) && - (pDevice->fTxDataInSleep == false)) { + if (!pDevice->bEnablePSMode && !pDevice->fTxDataInSleep) { return false; } #else - if (pDevice->bEnablePSMode == false) { + if (!pDevice->bEnablePSMode) { return false; } #endif diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c index ce173cc16c1..edb1b2768b1 100644 --- a/drivers/staging/vt6655/rf.c +++ b/drivers/staging/vt6655/rf.c @@ -976,7 +976,7 @@ bool RFbSetPower( } bResult = RFbRawSetPower(pDevice, byPwr, uRATE); - if (bResult == true) { + if (bResult) { pDevice->byCurPwr = byPwr; } return bResult; diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 3a2661e2b27..6affd6edac0 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -435,7 +435,7 @@ s_uGetDataDuration( switch (byDurType) { case DATADUR_B: //DATADUR_B - if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag + if (((uMACfragNum == 1)) || bLastFrag) {//Non Frag or Last Frag if (bNeedAck) { uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate); return pDevice->uSIFS + uAckTime; @@ -458,7 +458,7 @@ s_uGetDataDuration( break; case DATADUR_A: //DATADUR_A - if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag + if (((uMACfragNum == 1)) || bLastFrag) {//Non Frag or Last Frag if (bNeedAck) { uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); return pDevice->uSIFS + uAckTime; @@ -481,7 +481,7 @@ s_uGetDataDuration( break; case DATADUR_A_F0: //DATADUR_A_F0 - if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag + if (((uMACfragNum == 1)) || bLastFrag) {//Non Frag or Last Frag if (bNeedAck) { uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); return pDevice->uSIFS + uAckTime; @@ -523,7 +523,7 @@ s_uGetDataDuration( break; case DATADUR_A_F1: //DATADUR_A_F1 - if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag + if (((uMACfragNum == 1)) || bLastFrag) {//Non Frag or Last Frag if (bNeedAck) { uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate); return pDevice->uSIFS + uAckTime; @@ -2212,7 +2212,7 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) { else { bNeedACK = true; pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK; - }; + } if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) { @@ -2686,7 +2686,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un } bNeedACK = true; pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK; - }; + } if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) { diff --git a/drivers/staging/vt6655/vntwifi.c b/drivers/staging/vt6655/vntwifi.c index d2bdb71fe62..e78aedf9907 100644 --- a/drivers/staging/vt6655/vntwifi.c +++ b/drivers/staging/vt6655/vntwifi.c @@ -494,7 +494,7 @@ VNTWIFIvUpdateNodeTxCounter( } } pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts++; - if (bTxOk == true) { + if (bTxOk) { // transmit success, TxAttempts at least plus one pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++; pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wRate]++; @@ -584,7 +584,7 @@ VNTWIFIbyGetKeyCypher( { PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; - if (bGroupKey == true) { + if (bGroupKey) { return pMgmt->byCSSGK; } else { return pMgmt->byCSSPK; @@ -731,7 +731,7 @@ VNTWIFIbMeasureReport( pMgmt->uLengthOfRepEIDs += (2 + pMgmt->pCurrMeasureEIDRep->len); pMgmt->pCurrMeasureEIDRep = (PWLAN_IE_MEASURE_REP) pbyCurrentEID; } - if (bEndOfReport == true) { + if (bEndOfReport) { IEEE11hbMSRRepTx(pMgmt); } //spin_unlock_irq(&pDevice->lock); diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c index 9c57eefe78f..72caaa203dd 100644 --- a/drivers/staging/vt6655/wcmd.c +++ b/drivers/staging/vt6655/wcmd.c @@ -317,7 +317,7 @@ vCommandTimer( if (pDevice->dwDiagRefCount != 0) return; - if (pDevice->bCmdRunning != true) + if (!pDevice->bCmdRunning) return; spin_lock_irq(&pDevice->lock); @@ -326,7 +326,7 @@ vCommandTimer( case WLAN_CMD_SCAN_START: pDevice->byReAssocCount = 0; - if (pDevice->bRadioOff == true) { + if (pDevice->bRadioOff) { s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); return; @@ -393,7 +393,7 @@ vCommandTimer( vAdHocBeaconStop(pDevice); - if (set_channel(pMgmt->pAdapter, pMgmt->uScanChannel) == true) { + if (set_channel(pMgmt->pAdapter, pMgmt->uScanChannel)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SCAN Channel: %d\n", pMgmt->uScanChannel); } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SET SCAN Channel Fail: %d\n", pMgmt->uScanChannel); @@ -408,7 +408,7 @@ vCommandTimer( } - if ((pMgmt->b11hEnable == false) || + if (!pMgmt->b11hEnable || (pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) { s_vProbeChannel(pDevice); spin_unlock_irq(&pDevice->lock); @@ -498,7 +498,7 @@ vCommandTimer( case WLAN_CMD_SSID_START: pDevice->byReAssocCount = 0; - if (pDevice->bRadioOff == true) { + if (pDevice->bRadioOff) { s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); return; @@ -659,7 +659,7 @@ vCommandTimer( netif_wake_queue(pDevice->dev); } #ifdef TxInSleep - if (pDevice->IsTxDataTrigger != false) { //TxDataTimer is not triggered at the first time + if (pDevice->IsTxDataTrigger) { //TxDataTimer is not triggered at the first time del_timer(&pDevice->sTimerTxData); init_timer(&pDevice->sTimerTxData); pDevice->sTimerTxData.data = (unsigned long) pDevice; @@ -694,7 +694,7 @@ vCommandTimer( pMgmt->eCurrState = WMAC_STATE_IDLE; pMgmt->eCurrMode = WMAC_MODE_STANDBY; pDevice->bLinkPass = false; - if (pDevice->bEnableHostWEP == true) + if (pDevice->bEnableHostWEP) BSSvClearNodeDBTable(pDevice, 1); else BSSvClearNodeDBTable(pDevice, 0); @@ -776,7 +776,7 @@ vCommandTimer( case WLAN_CMD_RADIO_START: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_CMD_RADIO_START\n"); - if (pDevice->bRadioCmd == true) + if (pDevice->bRadioCmd) CARDbRadioPowerOn(pDevice); else CARDbRadioPowerOff(pDevice); @@ -948,7 +948,7 @@ bool bScheduleCommand( ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE); pDevice->cbFreeCmdQueue--; - if (pDevice->bCmdRunning == false) { + if (!pDevice->bCmdRunning) { s_bCommandComplete(pDevice); } else { } @@ -1031,8 +1031,8 @@ BSSvSecondTxData( spin_lock_irq(&pDevice->lock); #if 1 - if (((pDevice->bLinkPass == true) && (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking - (pDevice->fWPA_Authened == true)) { //wpa linking + if ((pDevice->bLinkPass && (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking + pDevice->fWPA_Authened) { //wpa linking #else if (pDevice->bLinkPass == true) { #endif diff --git a/drivers/staging/vt6655/wctl.c b/drivers/staging/vt6655/wctl.c index f05f9f55398..950039f6d12 100644 --- a/drivers/staging/vt6655/wctl.c +++ b/drivers/staging/vt6655/wctl.c @@ -110,7 +110,7 @@ unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader) unsigned int ii; for (ii = 0; ii < pDevice->cbDFCB; ii++) { - if ((pDevice->sRxDFCB[ii].bInUse == true) && + if (pDevice->sRxDFCB[ii].bInUse && ether_addr_equal(pDevice->sRxDFCB[ii].abyAddr2, pMACHeader->abyAddr2)) { // @@ -141,7 +141,7 @@ unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader) if (pDevice->cbFreeDFCB == 0) return pDevice->cbDFCB; for (ii = 0; ii < pDevice->cbDFCB; ii++) { - if (pDevice->sRxDFCB[ii].bInUse == false) { + if (!pDevice->sRxDFCB[ii].bInUse) { pDevice->cbFreeDFCB--; pDevice->sRxDFCB[ii].uLifetime = pDevice->dwMaxReceiveLifetime; pDevice->sRxDFCB[ii].bInUse = true; @@ -174,7 +174,7 @@ bool WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, unsigned i { unsigned int uHeaderSize; - if (bWEP == true) { + if (bWEP) { uHeaderSize = 28; if (bExtIV) // ExtIV diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c index ed4b32b6d9c..5200a2a0ecc 100644 --- a/drivers/staging/vt6655/wmgr.c +++ b/drivers/staging/vt6655/wmgr.c @@ -468,15 +468,15 @@ vMgrAssocBeginSta( // ERP Phy (802.11g) should support short preamble. if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); - if (CARDbIsShorSlotTime(pMgmt->pAdapter) == true) { + if (CARDbIsShorSlotTime(pMgmt->pAdapter)) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1); } } else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) { - if (CARDbIsShortPreamble(pMgmt->pAdapter) == true) { + if (CARDbIsShortPreamble(pMgmt->pAdapter)) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); } } - if (pMgmt->b11hEnable == true) + if (pMgmt->b11hEnable) pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1); /* build an assocreq frame and send it */ @@ -539,15 +539,15 @@ vMgrReAssocBeginSta( // ERP Phy (802.11g) should support short preamble. if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); - if (CARDbIsShorSlotTime(pMgmt->pAdapter) == true) { + if (CARDbIsShorSlotTime(pMgmt->pAdapter)) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1); } } else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) { - if (CARDbIsShortPreamble(pMgmt->pAdapter) == true) { + if (CARDbIsShortPreamble(pMgmt->pAdapter)) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); } } - if (pMgmt->b11hEnable == true) + if (pMgmt->b11hEnable) pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1); pTxPacket = s_MgrMakeReAssocRequest @@ -736,7 +736,7 @@ s_vMgrRxAssocRequest( pDevice->bProtectMode = true; pDevice->bNonERPPresent = true; } - if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble == false) { + if (!pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) { pDevice->bBarkerPreambleMd = true; } @@ -891,7 +891,7 @@ s_vMgrRxReAssocRequest( pDevice->bProtectMode = true; pDevice->bNonERPPresent = true; } - if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble == false) { + if (!pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) { pDevice->bBarkerPreambleMd = true; } @@ -1719,7 +1719,7 @@ s_vMgrRxDeauthentication( } /* else, ignore it. TODO: IBSS authentication service would be implemented here */ - }; + } return; } @@ -1837,7 +1837,7 @@ s_vMgrRxBeacon( bChannelHit = true; } //2008-0730-01<Add>by MikeLiu - if (ChannelExceedZoneType(pDevice, byCurrChannel) == true) + if (ChannelExceedZoneType(pDevice, byCurrChannel)) return; if (sFrame.pERP != NULL) { @@ -1957,9 +1957,9 @@ s_vMgrRxBeacon( } } - if ((WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo) == true) && - (bIsBSSIDEqual == true) && - (bIsSSIDEqual == true) && + if (WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo) && + bIsBSSIDEqual && + bIsSSIDEqual && (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { // add state check to prevent reconnect fail since we'll receive Beacon @@ -2001,7 +2001,7 @@ s_vMgrRxBeacon( &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate), &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate) ); - if (bUpdatePhyParameter == true) { + if (bUpdatePhyParameter) { CARDbSetPhyParameter(pMgmt->pAdapter, pMgmt->eCurrentPHYMode, pMgmt->wCurrCapInfo, @@ -2023,7 +2023,7 @@ s_vMgrRxBeacon( sFrame.pIE_CHSW->byCount ); - } else if (bIsChannelEqual == false) { + } else if (!bIsChannelEqual) { set_channel(pMgmt->pAdapter, pBSSList->uChannel); } } @@ -2067,12 +2067,12 @@ s_vMgrRxBeacon( } // if infra mode - if (bIsAPBeacon == true) { + if (bIsAPBeacon) { // Infra mode: Local TSF always follow AP's TSF if Difference huge. if (bTSFLargeDiff) bUpdateTSF = true; - if ((pDevice->bEnablePSMode == true) && (sFrame.pTIM != 0)) { + if (pDevice->bEnablePSMode && (sFrame.pTIM != 0)) { // deal with DTIM, analysis TIM pMgmt->bMulticastTIM = WLAN_MGMT_IS_MULTICAST_TIM(sFrame.pTIM->byBitMapCtl) ? true : false; pMgmt->byDTIMCount = sFrame.pTIM->byDTIMCount; @@ -2092,10 +2092,10 @@ s_vMgrRxBeacon( pMgmt->bInTIM = sFrame.pTIM->byVirtBitMap[uLocateByteIndex] & byTIMBitOn ? true : false; } else { pMgmt->bInTIM = false; - }; + } } else { pMgmt->bInTIM = false; - }; + } if (pMgmt->bInTIM || (pMgmt->bMulticastTIM && (pMgmt->byDTIMCount == 0))) { @@ -2110,7 +2110,7 @@ s_vMgrRxBeacon( } else { pMgmt->bInTIMWake = false; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Not In TIM..\n"); - if (pDevice->bPWBitOn == false) { + if (!pDevice->bPWBitOn) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Send Null Packet\n"); if (PSbSendNullPacket(pDevice)) pDevice->bPWBitOn = true; @@ -2332,10 +2332,10 @@ vMgrCreateOwnIBSS( } // Disable Protect Mode - pDevice->bProtectMode = 0; + pDevice->bProtectMode = false; MACvDisableProtectMD(pDevice->PortOffset); - pDevice->bBarkerPreambleMd = 0; + pDevice->bBarkerPreambleMd = false; MACvDisableBarkerPreambleMd(pDevice->PortOffset); // Kyle Test 2003.11.04 @@ -2480,7 +2480,7 @@ vMgrCreateOwnIBSS( pMgmt->wCurrCapInfo &= (~WLAN_SET_CAP_INFO_SHORTPREAMBLE(1)); } - if ((pMgmt->b11hEnable == true) && + if (pMgmt->b11hEnable && (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1); } else { @@ -2530,7 +2530,7 @@ vMgrJoinBSSBegin( unsigned char byTopOFDMBasicRate = RATE_1M; for (ii = 0; ii < MAX_BSS_NUM; ii++) { - if (pMgmt->sBSSList[ii].bActive == true) + if (pMgmt->sBSSList[ii].bActive) break; } @@ -2656,7 +2656,7 @@ vMgrJoinBSSBegin( if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) { bool bResult = bAdd_PMKID_Candidate((void *)pDevice, pMgmt->abyCurrBSSID, &pCurr->sRSNCapObj); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bAdd_PMKID_Candidate: 1(%d)\n", bResult); - if (bResult == false) { + if (!bResult) { vFlush_PMKID_Candidate((void *)pDevice); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vFlush_PMKID_Candidate: 4\n"); bAdd_PMKID_Candidate((void *)pDevice, pMgmt->abyCurrBSSID, &pCurr->sRSNCapObj); @@ -2671,19 +2671,19 @@ vMgrJoinBSSBegin( DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "End of Join AP -- A/B/G Action\n"); } else { pMgmt->eCurrState = WMAC_STATE_IDLE; - }; + } } else { // ad-hoc mode BSS if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) { - if (WPA_SearchRSN(0, WPA_TKIP, pCurr) == false) { + if (!WPA_SearchRSN(0, WPA_TKIP, pCurr)) { // encryption mode error pMgmt->eCurrState = WMAC_STATE_IDLE; return; } } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) { - if (WPA_SearchRSN(0, WPA_AESCCMP, pCurr) == false) { + if (!WPA_SearchRSN(0, WPA_AESCCMP, pCurr)) { // encryption mode error pMgmt->eCurrState = WMAC_STATE_IDLE; return; @@ -2740,8 +2740,8 @@ vMgrJoinBSSBegin( bMgrPrepareBeaconToSend((void *)pDevice, pMgmt); } else { pMgmt->eCurrState = WMAC_STATE_IDLE; - }; - }; + } + } return; } @@ -2776,10 +2776,10 @@ s_vMgrSynchBSS( *pStatus = CMD_STATUS_FAILURE; - if (s_bCipherMatch(pCurr, + if (!s_bCipherMatch(pCurr, pDevice->eEncryptionStatus, &(pMgmt->byCSSPK), - &(pMgmt->byCSSGK)) == false) { + &(pMgmt->byCSSGK))) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "s_bCipherMatch Fail .......\n"); return; } @@ -2869,18 +2869,17 @@ s_vMgrSynchBSS( CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, OP_MODE_ADHOC); } - if (CARDbSetPhyParameter(pMgmt->pAdapter, + if (!CARDbSetPhyParameter(pMgmt->pAdapter, ePhyType, pCurr->wCapInfo, pCurr->sERP.byERP, pMgmt->abyCurrSuppRates, - pMgmt->abyCurrExtSuppRates - ) != true) { + pMgmt->abyCurrExtSuppRates)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Phy Mode Fail [%d]\n", ePhyType); return; } // set channel and clear NAV - if (set_channel(pMgmt->pAdapter, pCurr->uChannel) == false) { + if (!set_channel(pMgmt->pAdapter, pCurr->uChannel)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Channel [%d]\n", pCurr->uChannel); return; } @@ -2924,7 +2923,7 @@ static void Encyption_Rebuild( if ((pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || //networkmanager 0.7.0 does not give the pairwise-key selection, (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { // so we need re-select it according to real pairwise-key info. - if (pCurr->bWPAValid == true) { //WPA-PSK + if (pCurr->bWPAValid) { //WPA-PSK pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; if (pCurr->abyPKType[0] == WPA_TKIP) { pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP @@ -2933,7 +2932,7 @@ static void Encyption_Rebuild( pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; //AES PRINT_K("Encyption_Rebuild--->ssid reset config to [WPAPSK-AES]\n"); } - } else if (pCurr->bWPA2Valid == true) { //WPA2-PSK + } else if (pCurr->bWPA2Valid) { //WPA2-PSK pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK; if (pCurr->abyCSSPK[0] == WLAN_11i_CSS_TKIP) { pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP @@ -3150,8 +3149,7 @@ s_MgrMakeBeacon( } } - if ((pMgmt->b11hEnable == true) && - (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) { + if (pMgmt->b11hEnable && (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) { // Country IE pbyBuffer = (unsigned char *)(sFrame.pBuf + sFrame.len); set_country_IE(pMgmt->pAdapter, pbyBuffer); @@ -3164,7 +3162,7 @@ s_MgrMakeBeacon( ((PWLAN_IE_PW_CONST) pbyBuffer)->byPower = 0; pbyBuffer += (1) + WLAN_IEHDR_LEN; uLength += (1) + WLAN_IEHDR_LEN; - if (pMgmt->bSwitchChannel == true) { + if (pMgmt->bSwitchChannel) { // Channel Switch IE ((PWLAN_IE_CH_SW) pbyBuffer)->byElementID = WLAN_EID_CH_SWITCH; ((PWLAN_IE_CH_SW) pbyBuffer)->len = 3; @@ -3193,7 +3191,7 @@ s_MgrMakeBeacon( pbyBuffer += (7) + WLAN_IEHDR_LEN; uLength += (7) + WLAN_IEHDR_LEN; for (ii = CB_MAX_CHANNEL_24G+1; ii <= CB_MAX_CHANNEL; ii++) { - if (get_channel_map_info(pMgmt->pAdapter, ii, pbyBuffer, pbyBuffer+1) == true) { + if (get_channel_map_info(pMgmt->pAdapter, ii, pbyBuffer, pbyBuffer+1)) { pbyBuffer += 2; uLength += 2; pIBSSDFS->len += 2; @@ -3209,11 +3207,11 @@ s_MgrMakeBeacon( sFrame.pERP->byElementID = WLAN_EID_ERP; sFrame.pERP->len = 1; sFrame.pERP->byContext = 0; - if (pDevice->bProtectMode == true) + if (pDevice->bProtectMode) sFrame.pERP->byContext |= WLAN_EID_ERP_USE_PROTECTION; - if (pDevice->bNonERPPresent == true) + if (pDevice->bNonERPPresent) sFrame.pERP->byContext |= WLAN_EID_ERP_NONERP_PRESENT; - if (pDevice->bBarkerPreambleMd == true) + if (pDevice->bBarkerPreambleMd) sFrame.pERP->byContext |= WLAN_EID_ERP_BARKER_MODE; } if (((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len != 0) { @@ -3225,7 +3223,7 @@ s_MgrMakeBeacon( ); } // hostapd wpa/wpa2 IE - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnableHostapd == true)) { + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && pDevice->bEnableHostapd) { if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { if (pMgmt->wWPAIELen != 0) { sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); @@ -3338,16 +3336,15 @@ s_MgrMakeProbeResponse( sFrame.pERP->byElementID = WLAN_EID_ERP; sFrame.pERP->len = 1; sFrame.pERP->byContext = 0; - if (pDevice->bProtectMode == true) + if (pDevice->bProtectMode) sFrame.pERP->byContext |= WLAN_EID_ERP_USE_PROTECTION; - if (pDevice->bNonERPPresent == true) + if (pDevice->bNonERPPresent) sFrame.pERP->byContext |= WLAN_EID_ERP_NONERP_PRESENT; - if (pDevice->bBarkerPreambleMd == true) + if (pDevice->bBarkerPreambleMd) sFrame.pERP->byContext |= WLAN_EID_ERP_BARKER_MODE; } - if ((pMgmt->b11hEnable == true) && - (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) { + if (pMgmt->b11hEnable && (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) { // Country IE pbyBuffer = (unsigned char *)(sFrame.pBuf + sFrame.len); set_country_IE(pMgmt->pAdapter, pbyBuffer); @@ -3360,7 +3357,7 @@ s_MgrMakeProbeResponse( ((PWLAN_IE_PW_CONST) pbyBuffer)->byPower = 0; pbyBuffer += (1) + WLAN_IEHDR_LEN; uLength += (1) + WLAN_IEHDR_LEN; - if (pMgmt->bSwitchChannel == true) { + if (pMgmt->bSwitchChannel) { // Channel Switch IE ((PWLAN_IE_CH_SW) pbyBuffer)->byElementID = WLAN_EID_CH_SWITCH; ((PWLAN_IE_CH_SW) pbyBuffer)->len = 3; @@ -3389,7 +3386,7 @@ s_MgrMakeProbeResponse( pbyBuffer += (7) + WLAN_IEHDR_LEN; uLength += (7) + WLAN_IEHDR_LEN; for (ii = CB_MAX_CHANNEL_24G + 1; ii <= CB_MAX_CHANNEL; ii++) { - if (get_channel_map_info(pMgmt->pAdapter, ii, pbyBuffer, pbyBuffer+1) == true) { + if (get_channel_map_info(pMgmt->pAdapter, ii, pbyBuffer, pbyBuffer+1)) { pbyBuffer += 2; uLength += 2; pIBSSDFS->len += 2; @@ -3409,7 +3406,7 @@ s_MgrMakeProbeResponse( } // hostapd wpa/wpa2 IE - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnableHostapd == true)) { + if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && pDevice->bEnableHostapd) { if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) { if (pMgmt->wWPAIELen != 0) { sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len); @@ -3507,7 +3504,7 @@ s_MgrMakeAssocRequest( pbyIEs += pCurrRates->len + WLAN_IEHDR_LEN; // for 802.11h - if (pMgmt->b11hEnable == true) { + if (pMgmt->b11hEnable) { if (sFrame.pCurrPowerCap == NULL) { sFrame.pCurrPowerCap = (PWLAN_IE_PW_CAP)(sFrame.pBuf + sFrame.len); sFrame.len += (2 + WLAN_IEHDR_LEN); @@ -3650,7 +3647,7 @@ s_MgrMakeAssocRequest( sFrame.pRSN->len += 6; // RSN Capabilities - if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) { + if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist) { memcpy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); } else { sFrame.pRSN->abyRSN[16] = 0; @@ -3658,7 +3655,7 @@ s_MgrMakeAssocRequest( } sFrame.pRSN->len += 2; - if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && (pDevice->bRoaming == true) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { + if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && pDevice->bRoaming && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { // RSN PMKID pbyRSN = &sFrame.pRSN->abyRSN[18]; pwPMKID = (unsigned short *)pbyRSN; // Point to PMKID count @@ -3896,7 +3893,7 @@ s_MgrMakeReAssocRequest( sFrame.pRSN->len += 6; // RSN Capabilities - if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) { + if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist) { memcpy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); } else { sFrame.pRSN->abyRSN[16] = 0; @@ -3904,7 +3901,7 @@ s_MgrMakeReAssocRequest( } sFrame.pRSN->len += 2; - if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && (pDevice->bRoaming == true) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { + if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && pDevice->bRoaming && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { // RSN PMKID pbyRSN = &sFrame.pRSN->abyRSN[18]; pwPMKID = (unsigned short *)pbyRSN; // Point to PMKID count @@ -4141,7 +4138,7 @@ s_vMgrRxProbeResponse( } //2008-0730-01<Add>by MikeLiu - if (ChannelExceedZoneType(pDevice, byCurrChannel) == true) + if (ChannelExceedZoneType(pDevice, byCurrChannel)) return; if (sFrame.pERP != NULL) { @@ -4578,7 +4575,7 @@ bAdd_PMKID_Candidate( for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; if (!memcmp(pCandidateList->BSSID, pbyBSSID, ETH_ALEN)) { - if ((psRSNCapObj->bRSNCapExist == true) && (psRSNCapObj->wRSNCap & BIT0)) { + if (psRSNCapObj->bRSNCapExist && (psRSNCapObj->wRSNCap & BIT0)) { pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; } else { pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); @@ -4589,7 +4586,7 @@ bAdd_PMKID_Candidate( // New Candidate pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[pDevice->gsPMKIDCandidate.NumCandidates]; - if ((psRSNCapObj->bRSNCapExist == true) && (psRSNCapObj->wRSNCap & BIT0)) { + if (psRSNCapObj->bRSNCapExist && (psRSNCapObj->wRSNCap & BIT0)) { pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; } else { pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); @@ -4650,7 +4647,7 @@ s_bCipherMatch( } if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && - (pBSSNode->bWPA2Valid == true) && + pBSSNode->bWPA2Valid && //20080123-01,<Add> by Einsn Liu ((EncStatus == Ndis802_11Encryption3Enabled) || (EncStatus == Ndis802_11Encryption2Enabled))) { //WPA2 @@ -4684,7 +4681,7 @@ s_bCipherMatch( } } else if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) && - (pBSSNode->bWPAValid == true) && + pBSSNode->bWPAValid && ((EncStatus == Ndis802_11Encryption3Enabled) || (EncStatus == Ndis802_11Encryption2Enabled))) { //WPA // check Group Key Cipher diff --git a/drivers/staging/vt6655/wpa.c b/drivers/staging/vt6655/wpa.c index b697fa6c3b1..990ea0f9e9f 100644 --- a/drivers/staging/vt6655/wpa.c +++ b/drivers/staging/vt6655/wpa.c @@ -241,7 +241,7 @@ WPA_SearchRSN( int ii; unsigned char byPKType = WPA_NONE; - if (pBSSList->bWPAValid == false) + if (!pBSSList->bWPAValid) return false; switch (byCmd) { diff --git a/drivers/staging/vt6655/wpa2.c b/drivers/staging/vt6655/wpa2.c index 089788dfba6..2013122e92b 100644 --- a/drivers/staging/vt6655/wpa2.c +++ b/drivers/staging/vt6655/wpa2.c @@ -42,14 +42,14 @@ static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Variables --------------------------*/ -const unsigned char abyOUIGK[4] = { 0x00, 0x0F, 0xAC, 0x00 }; -const unsigned char abyOUIWEP40[4] = { 0x00, 0x0F, 0xAC, 0x01 }; -const unsigned char abyOUIWEP104[4] = { 0x00, 0x0F, 0xAC, 0x05 }; -const unsigned char abyOUITKIP[4] = { 0x00, 0x0F, 0xAC, 0x02 }; -const unsigned char abyOUICCMP[4] = { 0x00, 0x0F, 0xAC, 0x04 }; +static const unsigned char abyOUIGK[4] = { 0x00, 0x0F, 0xAC, 0x00 }; +static const unsigned char abyOUIWEP40[4] = { 0x00, 0x0F, 0xAC, 0x01 }; +static const unsigned char abyOUIWEP104[4] = { 0x00, 0x0F, 0xAC, 0x05 }; +static const unsigned char abyOUITKIP[4] = { 0x00, 0x0F, 0xAC, 0x02 }; +static const unsigned char abyOUICCMP[4] = { 0x00, 0x0F, 0xAC, 0x04 }; -const unsigned char abyOUI8021X[4] = { 0x00, 0x0F, 0xAC, 0x01 }; -const unsigned char abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 }; +static const unsigned char abyOUI8021X[4] = { 0x00, 0x0F, 0xAC, 0x01 }; +static const unsigned char abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 }; /*--------------------- Static Functions --------------------------*/ @@ -192,7 +192,7 @@ WPA2vParseRSN( break; } //for - if (bUseGK == true) { + if (bUseGK) { if (j != 1) { // invalid CSS, This should be only PK CSS. return; @@ -335,7 +335,7 @@ WPA2uSetIEs( pRSNIEs->len += 2; if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) && - (pMgmt->bRoaming == true) && + pMgmt->bRoaming && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { // RSN PMKID pwPMKID = (unsigned short *)(&pRSNIEs->abyRSN[18]); // Point to PMKID count diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c index 044368a46c5..d17224f39b4 100644 --- a/drivers/staging/vt6655/wpactl.c +++ b/drivers/staging/vt6655/wpactl.c @@ -202,11 +202,11 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel) int uu, ii; if (param->u.wpa_key.alg_name > WPA_ALG_CCMP || - param->u.wpa_key.key_len >= MAX_KEY_LEN || - param->u.wpa_key.seq_len >= MAX_KEY_LEN) + param->u.wpa_key.key_len > MAX_KEY_LEN || + param->u.wpa_key.seq_len > MAX_KEY_LEN) return -EINVAL; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "param->u.wpa_key.alg_name = %d \n", param->u.wpa_key.alg_name); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "param->u.wpa_key.alg_name = %d\n", param->u.wpa_key.alg_name); if (param->u.wpa_key.alg_name == WPA_ALG_NONE) { pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; pDevice->bEncryptionEnable = false; @@ -341,22 +341,22 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel) // If is_broadcast_ether_addr, set the key as every key entry's group key. DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Groupe Key Assign.\n"); - if ((KeybSetAllGroupKey(&(pDevice->sKey), + if (KeybSetAllGroupKey(&(pDevice->sKey), dwKeyIndex, param->u.wpa_key.key_len, (PQWORD) &(KeyRSC), (unsigned char *)abyKey, byKeyDecMode, pDevice->PortOffset, - pDevice->byLocalID) == true) && - (KeybSetDefaultKey(&(pDevice->sKey), + pDevice->byLocalID) && + KeybSetDefaultKey(&(pDevice->sKey), dwKeyIndex, param->u.wpa_key.key_len, (PQWORD) &(KeyRSC), (unsigned char *)abyKey, byKeyDecMode, pDevice->PortOffset, - pDevice->byLocalID) == true)) { + pDevice->byLocalID)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GROUP Key Assign.\n"); } else { @@ -389,7 +389,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel) (unsigned char *)abyKey, byKeyDecMode, pDevice->PortOffset, - pDevice->byLocalID) == true) { + pDevice->byLocalID)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Set\n"); } else { @@ -415,7 +415,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel) //spin_unlock_irq(&pDevice->lock); /* - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx \n", + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx\n", pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][0], pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][1], pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][2], @@ -596,7 +596,7 @@ static int wpa_get_scan(PSDevice pDevice, ptempBSS = kmalloc(sizeof(KnownBSS), (int)GFP_ATOMIC); if (ptempBSS == NULL) { - printk("bubble sort kmalloc memory fail@@@\n"); + printk(KERN_ERR "bubble sort kmalloc memory fail@@@\n"); ret = -ENOMEM; @@ -804,7 +804,7 @@ static int wpa_set_associate(PSDevice pDevice, else pDevice->bEncryptionEnable = false; if (!((pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) || - ((pMgmt->eAuthenMode == WMAC_AUTH_OPEN) && (bWepEnabled == true)))) //DavidWang //20080717-06,<Modify> by chester//Not to initial WEP + ((pMgmt->eAuthenMode == WMAC_AUTH_OPEN) && bWepEnabled))) //DavidWang //20080717-06,<Modify> by chester//Not to initial WEP KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); spin_lock_irq(&pDevice->lock); pDevice->bLinkPass = false; @@ -869,18 +869,18 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p) switch (param->cmd) { case VIAWGET_SET_WPA: ret = wpa_set_wpa(pDevice, param); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_WPA \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_WPA\n"); break; case VIAWGET_SET_KEY: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_KEY \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_KEY\n"); spin_lock_irq(&pDevice->lock); ret = wpa_set_keys(pDevice, param, false); spin_unlock_irq(&pDevice->lock); break; case VIAWGET_SET_SCAN: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_SCAN \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_SCAN\n"); ret = wpa_set_scan(pDevice, param); break; @@ -891,40 +891,40 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p) break; case VIAWGET_GET_SSID: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SSID \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SSID\n"); ret = wpa_get_ssid(pDevice, param); wpa_ioctl = 1; break; case VIAWGET_GET_BSSID: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_BSSID \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_BSSID\n"); ret = wpa_get_bssid(pDevice, param); wpa_ioctl = 1; break; case VIAWGET_SET_ASSOCIATE: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_ASSOCIATE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_ASSOCIATE\n"); ret = wpa_set_associate(pDevice, param); break; case VIAWGET_SET_DISASSOCIATE: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DISASSOCIATE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DISASSOCIATE\n"); ret = wpa_set_disassociate(pDevice, param); break; case VIAWGET_SET_DROP_UNENCRYPT: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DROP_UNENCRYPT \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DROP_UNENCRYPT\n"); break; case VIAWGET_SET_DEAUTHENTICATE: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DEAUTHENTICATE \n"); + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DEAUTHENTICATE\n"); break; default: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ioctl: unknown cmd=%d\n", param->cmd); - return -EOPNOTSUPP; - break; + ret = -EOPNOTSUPP; + goto out; } if ((ret == 0) && wpa_ioctl) { diff --git a/drivers/staging/vt6655/wpactl.h b/drivers/staging/vt6655/wpactl.h index b9e2ab231f1..f7638baf340 100644 --- a/drivers/staging/vt6655/wpactl.h +++ b/drivers/staging/vt6655/wpactl.h @@ -38,11 +38,11 @@ //WPA related -typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg; -typedef enum { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP, - CIPHER_WEP104 } wpa_cipher; -typedef enum { KEY_MGMT_802_1X, KEY_MGMT_CCKM, KEY_MGMT_PSK, KEY_MGMT_NONE, - KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE } wpa_key_mgmt; +enum wpa_alg { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP }; +enum wpa_cipher { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP, + CIPHER_WEP104 }; +enum wpa_key_mgmt { KEY_MGMT_802_1X, KEY_MGMT_CCKM, KEY_MGMT_PSK, KEY_MGMT_NONE, + KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE }; #define AUTH_ALG_OPEN_SYSTEM 0x01 #define AUTH_ALG_SHARED_KEY 0x02 @@ -51,8 +51,6 @@ typedef enum { KEY_MGMT_802_1X, KEY_MGMT_CCKM, KEY_MGMT_PSK, KEY_MGMT_NONE, #define GENERIC_INFO_ELEM 0xdd #define RSN_INFO_ELEM 0x30 -typedef unsigned long long NDIS_802_11_KEY_RSC; - /*--------------------- Export Classes ----------------------------*/ /*--------------------- Export Variables --------------------------*/ diff --git a/drivers/staging/vt6655/wroute.c b/drivers/staging/vt6655/wroute.c index 85302c5e2ba..c39d5ed59de 100644 --- a/drivers/staging/vt6655/wroute.c +++ b/drivers/staging/vt6655/wroute.c @@ -63,7 +63,8 @@ static int msglevel = MSG_LEVEL_INFO; * Return Value: true if packet duplicate; otherwise false * */ -bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uDataLen, unsigned int uNodeIndex) +bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, + unsigned int uDataLen, unsigned int uNodeIndex) { PSMgmtObject pMgmt = pDevice->pMgmt; PSTxDesc pHeadTD, pLastTD; @@ -78,7 +79,8 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uData unsigned char *pbyBSSID; if (AVAIL_TD(pDevice, TYPE_AC0DMA) <= 0) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Relay can't allocate TD1..\n"); + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_INFO "Relay can't allocate TD1..\n"); return false; } @@ -86,22 +88,24 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uData pHeadTD->m_td1TD1.byTCR = (TCR_EDP | TCR_STP); - memcpy(pDevice->sTxEthHeader.abyDstAddr, (unsigned char *)pbySkbData, ETH_HLEN); + memcpy(pDevice->sTxEthHeader.abyDstAddr, pbySkbData, ETH_HLEN); cbFrameBodySize = uDataLen - ETH_HLEN; - if (ntohs(pDevice->sTxEthHeader.wType) > ETH_DATA_LEN) { + if (ntohs(pDevice->sTxEthHeader.wType) > ETH_DATA_LEN) cbFrameBodySize += 8; - } if (pDevice->bEncryptionEnable == true) { bNeedEncryption = true; // get group key pbyBSSID = pDevice->abyBroadcastAddr; - if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) { + if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, + GROUP_KEY, &pTransmitKey) == false) { pTransmitKey = NULL; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode); + DBG_PRT(MSG_LEVEL_DEBUG, + KERN_DEBUG "KEY is NULL. [%d]\n", + pDevice->pMgmt->eCurrMode); } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Get GTK.\n"); } @@ -117,25 +121,24 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uData pTransmitKey->wTSC15_0 = pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0; memcpy(pTransmitKey->abyKey, &pMgmt->sNodeDBTable[uNodeIndex].abyWepKey[0], - pTransmitKey->uKeyLength -); + pTransmitKey->uKeyLength); } } - uMACfragNum = cbGetFragCount(pDevice, pTransmitKey, cbFrameBodySize, &pDevice->sTxEthHeader); + uMACfragNum = cbGetFragCount(pDevice, pTransmitKey, + cbFrameBodySize, &pDevice->sTxEthHeader); - if (uMACfragNum > AVAIL_TD(pDevice, TYPE_AC0DMA)) { + if (uMACfragNum > AVAIL_TD(pDevice, TYPE_AC0DMA)) return false; - } - byPktType = (unsigned char)pDevice->byPacketType; + + byPktType = pDevice->byPacketType; if (pDevice->bFixRate) { if (pDevice->eCurrentPHYType == PHY_TYPE_11B) { - if (pDevice->uConnectionRate >= RATE_11M) { + if (pDevice->uConnectionRate >= RATE_11M) pDevice->wCurrentRate = RATE_11M; - } else { - pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate; - } + else + pDevice->wCurrentRate = pDevice->uConnectionRate; } else { if ((pDevice->eCurrentPHYType == PHY_TYPE_11A) && (pDevice->uConnectionRate <= RATE_6M)) { @@ -144,7 +147,7 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uData if (pDevice->uConnectionRate >= RATE_54M) pDevice->wCurrentRate = RATE_54M; else - pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate; + pDevice->wCurrentRate = pDevice->uConnectionRate; } } } else { @@ -154,12 +157,11 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uData if (pDevice->wCurrentRate <= RATE_11M) byPktType = PK_TYPE_11B; - vGenerateFIFOHeader(pDevice, byPktType, pDevice->pbyTmpBuff, bNeedEncryption, - cbFrameBodySize, TYPE_AC0DMA, pHeadTD, - &pDevice->sTxEthHeader, pbySkbData, pTransmitKey, uNodeIndex, - &uMACfragNum, - &cbHeaderSize -); + vGenerateFIFOHeader(pDevice, byPktType, pDevice->pbyTmpBuff, + bNeedEncryption, cbFrameBodySize, TYPE_AC0DMA, + pHeadTD, &pDevice->sTxEthHeader, pbySkbData, + pTransmitKey, uNodeIndex, &uMACfragNum, + &cbHeaderSize); if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) { // Disable PS |