diff options
author | Kevin McKinney <klmckinney1@gmail.com> | 2012-01-04 20:29:03 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-02-08 20:19:05 -0500 |
commit | cffae184c3146abda6ef1153ac4f844d3ed6e177 (patch) | |
tree | 7a98dcf1d002b0850547a125dd8aaf333b128dad /drivers/staging/bcm | |
parent | 5db125fb5ca2fed67a668c532af576a67a3d3bdc (diff) |
Staging: bcm: Remove assignment from if statement and reverse if logic for readability.
This patch removes an assignment from an if statement,
and it reverses the logic in several if statements to
make them more readable and understandable.
Signed-off-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/bcm')
-rw-r--r-- | drivers/staging/bcm/CmHost.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index cf4146e5639..de38bedce33 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c | |||
@@ -194,7 +194,7 @@ CopyIpAddrToClassifier(S_CLASSIFIER_RULE *pstClassifierEntry, | |||
194 | } | 194 | } |
195 | u8IpAddressLen -= nSizeOfIPAddressInBytes; | 195 | u8IpAddressLen -= nSizeOfIPAddressInBytes; |
196 | } | 196 | } |
197 | if (0 == u8IpAddressLen) | 197 | if (u8IpAddressLen == 0) |
198 | pstClassifierEntry->bDestIpValid = TRUE; | 198 | pstClassifierEntry->bDestIpValid = TRUE; |
199 | 199 | ||
200 | ucLoopIndex++; | 200 | ucLoopIndex++; |
@@ -263,7 +263,7 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter, stConvergenceSL | |||
263 | pstClassifierEntry->ucDestPortRangeLength = psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength / 4; | 263 | pstClassifierEntry->ucDestPortRangeLength = psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength / 4; |
264 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Destination Port Range Length:0x%X ", pstClassifierEntry->ucDestPortRangeLength); | 264 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Destination Port Range Length:0x%X ", pstClassifierEntry->ucDestPortRangeLength); |
265 | 265 | ||
266 | if (MAX_PORT_RANGE >= psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength) { | 266 | if (psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength <= MAX_PORT_RANGE) { |
267 | for (ucLoopIndex = 0; ucLoopIndex < (pstClassifierEntry->ucDestPortRangeLength); ucLoopIndex++) { | 267 | for (ucLoopIndex = 0; ucLoopIndex < (pstClassifierEntry->ucDestPortRangeLength); ucLoopIndex++) { |
268 | pstClassifierEntry->usDestPortRangeLo[ucLoopIndex] = *((PUSHORT)(psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange+ucLoopIndex)); | 268 | pstClassifierEntry->usDestPortRangeLo[ucLoopIndex] = *((PUSHORT)(psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange+ucLoopIndex)); |
269 | pstClassifierEntry->usDestPortRangeHi[ucLoopIndex] = | 269 | pstClassifierEntry->usDestPortRangeHi[ucLoopIndex] = |
@@ -280,7 +280,7 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter, stConvergenceSL | |||
280 | /* Source Port */ | 280 | /* Source Port */ |
281 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Source Port Range Length:0x%X ", | 281 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Source Port Range Length:0x%X ", |
282 | psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength); | 282 | psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength); |
283 | if (MAX_PORT_RANGE >= psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength) { | 283 | if (psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength <= MAX_PORT_RANGE) { |
284 | pstClassifierEntry->ucSrcPortRangeLength = psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength/4; | 284 | pstClassifierEntry->ucSrcPortRangeLength = psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength/4; |
285 | for (ucLoopIndex = 0; ucLoopIndex < (pstClassifierEntry->ucSrcPortRangeLength); ucLoopIndex++) { | 285 | for (ucLoopIndex = 0; ucLoopIndex < (pstClassifierEntry->ucSrcPortRangeLength); ucLoopIndex++) { |
286 | pstClassifierEntry->usSrcPortRangeLo[ucLoopIndex] = | 286 | pstClassifierEntry->usSrcPortRangeLo[ucLoopIndex] = |
@@ -315,7 +315,7 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter, stConvergenceSL | |||
315 | 315 | ||
316 | /* TOS */ | 316 | /* TOS */ |
317 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "TOS Length:0x%X ", psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength); | 317 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "TOS Length:0x%X ", psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength); |
318 | if (3 == psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength) { | 318 | if (psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength == 3) { |
319 | pstClassifierEntry->ucIPTypeOfServiceLength = psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength; | 319 | pstClassifierEntry->ucIPTypeOfServiceLength = psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength; |
320 | pstClassifierEntry->ucTosLow = psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0]; | 320 | pstClassifierEntry->ucTosLow = psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0]; |
321 | pstClassifierEntry->ucTosHigh = psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1]; | 321 | pstClassifierEntry->ucTosHigh = psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1]; |
@@ -1393,7 +1393,7 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter, PVOID pvBuffer, UINT | |||
1393 | /* For DSA_REQ, only up to "psfAuthorizedSet" parameter should be accessed by driver! */ | 1393 | /* For DSA_REQ, only up to "psfAuthorizedSet" parameter should be accessed by driver! */ |
1394 | 1394 | ||
1395 | pstAddIndication = kmalloc(sizeof(*pstAddIndication), GFP_KERNEL); | 1395 | pstAddIndication = kmalloc(sizeof(*pstAddIndication), GFP_KERNEL); |
1396 | if (NULL == pstAddIndication) | 1396 | if (pstAddIndication == NULL) |
1397 | return 0; | 1397 | return 0; |
1398 | 1398 | ||
1399 | /* AUTHORIZED SET */ | 1399 | /* AUTHORIZED SET */ |
@@ -1656,7 +1656,8 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /* <Pointer to the Adap | |||
1656 | * Otherwise the message contains a target address from where we need to | 1656 | * Otherwise the message contains a target address from where we need to |
1657 | * read out the rest of the service flow param structure | 1657 | * read out the rest of the service flow param structure |
1658 | */ | 1658 | */ |
1659 | if ((pstAddIndication = RestoreCmControlResponseMessage(Adapter, pvBuffer)) == NULL) { | 1659 | pstAddIndication = RestoreCmControlResponseMessage(Adapter, pvBuffer); |
1660 | if (pstAddIndication == NULL) { | ||
1660 | ClearTargetDSXBuffer(Adapter, ((stLocalSFAddIndication *)pvBuffer)->u16TID, FALSE); | 1661 | ClearTargetDSXBuffer(Adapter, ((stLocalSFAddIndication *)pvBuffer)->u16TID, FALSE); |
1661 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Error in restoring Service Flow param structure from DSx message"); | 1662 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Error in restoring Service Flow param structure from DSx message"); |
1662 | return FALSE; | 1663 | return FALSE; |
@@ -1721,7 +1722,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /* <Pointer to the Adap | |||
1721 | if (pstAddIndication->sfAdmittedSet.bValid == TRUE) | 1722 | if (pstAddIndication->sfAdmittedSet.bValid == TRUE) |
1722 | Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet = TRUE; | 1723 | Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet = TRUE; |
1723 | 1724 | ||
1724 | if (FALSE == pstAddIndication->sfActiveSet.bValid) { | 1725 | if (pstAddIndication->sfActiveSet.bValid == FALSE) { |
1725 | Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE; | 1726 | Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE; |
1726 | Adapter->PackInfo[uiSearchRuleIndex].bActivateRequestSent = FALSE; | 1727 | Adapter->PackInfo[uiSearchRuleIndex].bActivateRequestSent = FALSE; |
1727 | if (pstAddIndication->sfAdmittedSet.bValid) | 1728 | if (pstAddIndication->sfAdmittedSet.bValid) |
@@ -1825,7 +1826,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /* <Pointer to the Adap | |||
1825 | if (pstChangeIndication->sfAdmittedSet.bValid == TRUE) | 1826 | if (pstChangeIndication->sfAdmittedSet.bValid == TRUE) |
1826 | Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet = TRUE; | 1827 | Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet = TRUE; |
1827 | 1828 | ||
1828 | if (FALSE == pstChangeIndication->sfActiveSet.bValid) { | 1829 | if (pstChangeIndication->sfActiveSet.bValid == FALSE) { |
1829 | Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE; | 1830 | Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE; |
1830 | Adapter->PackInfo[uiSearchRuleIndex].bActivateRequestSent = FALSE; | 1831 | Adapter->PackInfo[uiSearchRuleIndex].bActivateRequestSent = FALSE; |
1831 | 1832 | ||