Commit 8f284d79 authored by Simon Schuster's avatar Simon Schuster Committed by Greg Kroah-Hartman

Staging: vt6656: Combined nested conditions

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

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

is transformed to

if (cond1 && cond2) {
        block();
}
Signed-off-by: default avatarSebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: default avatarSimon Schuster <linux@rationality.eu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b7fce6ae
...@@ -107,10 +107,9 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, ...@@ -107,10 +107,9 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
(memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)) (memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0))
pbyBSSID = pbyDesireBSSID; pbyBSSID = pbyDesireBSSID;
} }
if (pbyDesireSSID != NULL) { if ((pbyDesireSSID != NULL) &&
if (((PWLAN_IE_SSID) pbyDesireSSID)->len != 0) (((PWLAN_IE_SSID) pbyDesireSSID)->len != 0))
pSSID = (PWLAN_IE_SSID) pbyDesireSSID; pSSID = (PWLAN_IE_SSID) pbyDesireSSID;
}
if ((pbyBSSID != NULL) && (pDevice->bRoaming == false)) { if ((pbyBSSID != NULL) && (pDevice->bRoaming == false)) {
/* match BSSID first */ /* match BSSID first */
...@@ -120,21 +119,22 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, ...@@ -120,21 +119,22 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
pCurrBSS->bSelected = false; pCurrBSS->bSelected = false;
if ((pCurrBSS->bActive) && if ((pCurrBSS->bActive) &&
(pCurrBSS->bSelected == false)) { (pCurrBSS->bSelected == false) &&
if (ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) { (ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID))) {
if (pSSID != NULL) { if (pSSID != NULL) {
/* compare ssid */ /* compare ssid */
if (!memcmp(pSSID->abySSID, if ((!memcmp(pSSID->abySSID,
((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID, ((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
pSSID->len)) { pSSID->len)) &&
if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) || ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) || ((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) &&
((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
) { ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) &&
WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)))) {
pCurrBSS->bSelected = true; pCurrBSS->bSelected = true;
return pCurrBSS; return pCurrBSS;
} }
}
} else if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) || } else if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) || ((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))) { ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))) {
...@@ -143,7 +143,6 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, ...@@ -143,7 +143,6 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
} }
} }
} }
}
} else { } else {
/* ignore BSSID */ /* ignore BSSID */
for (ii = 0; ii < MAX_BSS_NUM; ii++) { for (ii = 0; ii < MAX_BSS_NUM; ii++) {
...@@ -156,16 +155,17 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, ...@@ -156,16 +155,17 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
pCurrBSS->bSelected = false; pCurrBSS->bSelected = false;
if (pCurrBSS->bActive) { if (pCurrBSS->bActive) {
if (pSSID != NULL) { if ((pSSID != NULL) &&
/* matched SSID */ /* matched SSID */
if (memcmp(pSSID->abySSID, (memcmp(pSSID->abySSID,
((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID, ((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
pSSID->len) || pSSID->len) ||
(pSSID->len != ((PWLAN_IE_SSID) pCurrBSS->abySSID)->len)) { (pSSID->len !=
((PWLAN_IE_SSID) pCurrBSS->abySSID)->len))) {
/* SSID not match skip this BSS */ /* SSID not match skip this BSS */
continue; continue;
} }
}
if (((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) || if (((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) ||
((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))
) { ) {
...@@ -174,14 +174,15 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, ...@@ -174,14 +174,15 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
continue; continue;
} }
if (ePhyType != PHY_TYPE_AUTO) { if ((ePhyType != PHY_TYPE_AUTO) &&
if (((ePhyType == PHY_TYPE_11A) && (PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse)) || (((ePhyType == PHY_TYPE_11A) &&
((ePhyType != PHY_TYPE_11A) && (PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) { (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); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse);
continue; continue;
} }
}
pMgmt->pSameBSS[jj].uChannel = pCurrBSS->uChannel; pMgmt->pSameBSS[jj].uChannel = pCurrBSS->uChannel;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
...@@ -228,8 +229,8 @@ void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID) ...@@ -228,8 +229,8 @@ void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID)
int ii; int ii;
for (ii = 0; ii < MAX_BSS_NUM; ii++) { for (ii = 0; ii < MAX_BSS_NUM; ii++) {
if (bKeepCurrBSSID) { if (bKeepCurrBSSID &&
if (pMgmt->sBSSList[ii].bActive && pMgmt->sBSSList[ii].bActive &&
ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID,
pMgmt->abyCurrBSSID)) { pMgmt->abyCurrBSSID)) {
...@@ -243,7 +244,6 @@ void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID) ...@@ -243,7 +244,6 @@ void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID)
continue; continue;
} }
}
pMgmt->sBSSList[ii].bActive = false; pMgmt->sBSSList[ii].bActive = false;
memset(&pMgmt->sBSSList[ii], 0, sizeof(KnownBSS)); memset(&pMgmt->sBSSList[ii], 0, sizeof(KnownBSS));
...@@ -268,17 +268,14 @@ PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice, ...@@ -268,17 +268,14 @@ PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice,
for (ii = 0; ii < MAX_BSS_NUM; ii++) { for (ii = 0; ii < MAX_BSS_NUM; ii++) {
pBSSList = &(pMgmt->sBSSList[ii]); pBSSList = &(pMgmt->sBSSList[ii]);
if (pBSSList->bActive) { if ((pBSSList->bActive) &&
if (ether_addr_equal(pBSSList->abyBSSID, abyBSSID)) { (ether_addr_equal(pBSSList->abyBSSID, abyBSSID)) &&
if (pSSID->len == ((PWLAN_IE_SSID) pBSSList->abySSID)->len) { (pSSID->len == ((PWLAN_IE_SSID) pBSSList->abySSID)->len) &&
if (memcmp(pSSID->abySSID, (memcmp(pSSID->abySSID,
((PWLAN_IE_SSID) pBSSList->abySSID)->abySSID, ((PWLAN_IE_SSID) pBSSList->abySSID)->abySSID,
pSSID->len) == 0) pSSID->len) == 0))
return pBSSList; return pBSSList;
} }
}
}
}
return NULL; return NULL;
} }
...@@ -371,11 +368,10 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice, ...@@ -371,11 +368,10 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
pBSSList->bySQ = pRxPacket->bySQ; pBSSList->bySQ = pRxPacket->bySQ;
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
(pMgmt->eCurrState == WMAC_STATE_ASSOC)) { (pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
/* assoc with BSS */ /* assoc with BSS */
if (pBSSList == pMgmt->pCurrBSS) (pBSSList == pMgmt->pCurrBSS))
bParsingQuiet = true; bParsingQuiet = true;
}
WPA_ClearRSN(pBSSList); WPA_ClearRSN(pBSSList);
...@@ -421,13 +417,19 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice, ...@@ -421,13 +417,19 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
pBSSList->abyBSSID, pBSSList->abyBSSID,
&pBSSList->sRSNCapObj); &pBSSList->sRSNCapObj);
if ((pDevice->bLinkPass == true) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { if ((pDevice->bLinkPass == true) &&
if ((KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, PAIRWISE_KEY, &pTransmitKey) == true) || (pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
(KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, GROUP_KEY, &pTransmitKey) == true)) { ((KeybGetTransmitKey(&(pDevice->sKey),
pDevice->abyBSSID,
PAIRWISE_KEY,
&pTransmitKey) == true) ||
(KeybGetTransmitKey(&(pDevice->sKey),
pDevice->abyBSSID,
GROUP_KEY,
&pTransmitKey) == true))) {
pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList; pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList;
pDevice->gsPMKIDCandidate.Version = 1; pDevice->gsPMKIDCandidate.Version = 1;
}
} }
} }
...@@ -524,11 +526,10 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice, ...@@ -524,11 +526,10 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
pBSSList->bySQ = pRxPacket->bySQ; pBSSList->bySQ = pRxPacket->bySQ;
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
(pMgmt->eCurrState == WMAC_STATE_ASSOC)) { (pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
/* assoc with BSS */ /* assoc with BSS */
if (pBSSList == pMgmt->pCurrBSS) (pBSSList == pMgmt->pCurrBSS))
bParsingQuiet = true; bParsingQuiet = true;
}
WPA_ClearRSN(pBSSList); /* mike update */ WPA_ClearRSN(pBSSList); /* mike update */
...@@ -597,14 +598,13 @@ int BSSbIsSTAInNodeDB(struct vnt_private *pDevice, ...@@ -597,14 +598,13 @@ int BSSbIsSTAInNodeDB(struct vnt_private *pDevice,
/* Index = 0 reserved for AP Node */ /* Index = 0 reserved for AP Node */
for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
if (pMgmt->sNodeDBTable[ii].bActive) { if ((pMgmt->sNodeDBTable[ii].bActive) &&
if (ether_addr_equal(abyDstAddr, (ether_addr_equal(abyDstAddr,
pMgmt->sNodeDBTable[ii].abyMACAddr)) { pMgmt->sNodeDBTable[ii].abyMACAddr))) {
*puNodeIndex = ii; *puNodeIndex = ii;
return true; return true;
} }
} }
}
return false; return false;
}; };
...@@ -1064,9 +1064,9 @@ void BSSvSecondCallBack(struct work_struct *work) ...@@ -1064,9 +1064,9 @@ void BSSvSecondCallBack(struct work_struct *work)
} }
if (pDevice->bLinkPass == true) { if (pDevice->bLinkPass == true) {
if (pMgmt->eAuthenMode < WMAC_AUTH_WPA || if ((pMgmt->eAuthenMode < WMAC_AUTH_WPA ||
pDevice->fWPA_Authened == true) { pDevice->fWPA_Authened == true) &&
if (++pDevice->tx_data_time_out > 40) { (++pDevice->tx_data_time_out > 40)) {
pDevice->tx_trigger = true; pDevice->tx_trigger = true;
PSbSendNullPacket(pDevice); PSbSendNullPacket(pDevice);
...@@ -1074,7 +1074,6 @@ void BSSvSecondCallBack(struct work_struct *work) ...@@ -1074,7 +1074,6 @@ void BSSvSecondCallBack(struct work_struct *work)
pDevice->tx_trigger = false; pDevice->tx_trigger = false;
pDevice->tx_data_time_out = 0; pDevice->tx_data_time_out = 0;
} }
}
if (netif_queue_stopped(pDevice->dev)) if (netif_queue_stopped(pDevice->dev))
netif_wake_queue(pDevice->dev); netif_wake_queue(pDevice->dev);
...@@ -1177,12 +1176,11 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO) ...@@ -1177,12 +1176,11 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
} }
} }
if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) || if (((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
(pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) { (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) &&
(BSSbIsSTAInNodeDB((void *) pDevice,
if (BSSbIsSTAInNodeDB((void *) pDevice,
pbyDestAddr, pbyDestAddr,
&uNodeIndex)) { &uNodeIndex))) {
pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1; pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1;
if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) { if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
/* transmit success, TxAttempts at least plus one */ /* transmit success, TxAttempts at least plus one */
...@@ -1233,7 +1231,6 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO) ...@@ -1233,7 +1231,6 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
} }
} }
} }
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment