Just codeign style changes. git diff -w shows no change. Signed-off-by: Joe Perches <joe@xxxxxxxxxxx> --- drivers/staging/bcm/CmHost.c | 308 ++++++------ drivers/staging/bcm/DDRInit.c | 78 ++-- drivers/staging/bcm/IPv6Protocol.c | 68 ++-- drivers/staging/bcm/InterfaceDld.c | 2 +- drivers/staging/bcm/InterfaceIdleMode.c | 48 +- drivers/staging/bcm/InterfaceIsr.c | 20 +- drivers/staging/bcm/InterfaceRx.c | 40 +- drivers/staging/bcm/InterfaceTx.c | 30 +- drivers/staging/bcm/LeakyBucket.c | 68 ++-- drivers/staging/bcm/PHSModule.c | 290 ++++++------ drivers/staging/bcm/Qos.c | 190 ++++---- drivers/staging/bcm/Queue.h | 6 +- drivers/staging/bcm/Transmit.c | 40 +- drivers/staging/bcm/led_control.h | 4 +- drivers/staging/bcm/nvm.c | 820 +++++++++++++++--------------- 15 files changed, 1006 insertions(+), 1006 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index c382ff9..8f09439 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -33,8 +33,8 @@ static ULONG GetNextTargetBufferLocation(PMINI_ADAPTER Adapter,B_UINT16 tid); INT SearchSfid(PMINI_ADAPTER Adapter,UINT uiSfid) { INT iIndex=0; - for(iIndex=(NO_OF_QUEUES-1); iIndex>=0; iIndex--) - if(Adapter->PackInfo[iIndex].ulSFID==uiSfid) + for (iIndex=(NO_OF_QUEUES-1); iIndex>=0; iIndex--) + if (Adapter->PackInfo[iIndex].ulSFID==uiSfid) return iIndex; return NO_OF_QUEUES+1; } @@ -53,8 +53,8 @@ static INT SearchFreeSfid(PMINI_ADAPTER Adapter) { UINT uiIndex=0; - for(uiIndex=0; uiIndex < (NO_OF_QUEUES-1); uiIndex++) - if(Adapter->PackInfo[uiIndex].ulSFID==0) + for (uiIndex=0; uiIndex < (NO_OF_QUEUES-1); uiIndex++) + if (Adapter->PackInfo[uiIndex].ulSFID==0) return uiIndex; return NO_OF_QUEUES+1; } @@ -71,8 +71,8 @@ static INT SearchFreeSfid(PMINI_ADAPTER Adapter) static int SearchClsid(PMINI_ADAPTER Adapter,ULONG ulSFID,B_UINT16 uiClassifierID) { unsigned int uiClassifierIndex = 0; - for(uiClassifierIndex=0;uiClassifierIndex<MAX_CLASSIFIERS;uiClassifierIndex++) { - if((Adapter->astClassifierTable[uiClassifierIndex].bUsed) && + for (uiClassifierIndex=0;uiClassifierIndex<MAX_CLASSIFIERS;uiClassifierIndex++) { + if ((Adapter->astClassifierTable[uiClassifierIndex].bUsed) && (Adapter->astClassifierTable[uiClassifierIndex].uiClassifierRuleIndex == uiClassifierID)&& (Adapter->astClassifierTable[uiClassifierIndex].ulSFID == ulSFID)) return uiClassifierIndex; @@ -89,8 +89,8 @@ static int SearchFreeClsid(PMINI_ADAPTER Adapter /**Adapter Context*/ ) { unsigned int uiClassifierIndex = 0; - for(uiClassifierIndex=0;uiClassifierIndex<MAX_CLASSIFIERS;uiClassifierIndex++) { - if(!Adapter->astClassifierTable[uiClassifierIndex].bUsed) + for (uiClassifierIndex=0;uiClassifierIndex<MAX_CLASSIFIERS;uiClassifierIndex++) { + if (!Adapter->astClassifierTable[uiClassifierIndex].bUsed) return uiClassifierIndex; } return MAX_CLASSIFIERS+1; @@ -119,23 +119,23 @@ CopyIpAddrToClassifier(S_CLASSIFIER_RULE *pstClassifierEntry , UCHAR *ptrClassifierIpMask = NULL; PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - if(bIpVersion6) { + if (bIpVersion6) { nSizeOfIPAddressInBytes = IPV6_ADDRESS_SIZEINBYTES; } //Destination Ip Address bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Ip Address Range Length:0x%X\n", u8IpAddressLen); - if((bIpVersion6?(IPV6_ADDRESS_SIZEINBYTES * MAX_IP_RANGE_LENGTH * 2): + if ((bIpVersion6?(IPV6_ADDRESS_SIZEINBYTES * MAX_IP_RANGE_LENGTH * 2): (TOTAL_MASKED_ADDRESS_IN_BYTES)) >= u8IpAddressLen) { /* //checking both the mask and address togethor in Classification. //So length will be : TotalLengthInBytes/nSizeOfIPAddressInBytes * 2 //(nSizeOfIPAddressInBytes for address and nSizeOfIPAddressInBytes for mask) */ - if(eIpAddrContext == eDestIpAddress) { + if (eIpAddrContext == eDestIpAddress) { pstClassifierEntry->ucIPDestinationAddressLength = u8IpAddressLen/(nSizeOfIPAddressInBytes * 2); - if(bIpVersion6) { + if (bIpVersion6) { ptrClassifierIpAddress = pstClassifierEntry->stDestIpAddress.ucIpv6Address; ptrClassifierIpMask = @@ -146,10 +146,10 @@ CopyIpAddrToClassifier(S_CLASSIFIER_RULE *pstClassifierEntry , ptrClassifierIpMask = pstClassifierEntry->stDestIpAddress.ucIpv4Mask; } - } else if(eIpAddrContext == eSrcIpAddress) { + } else if (eIpAddrContext == eSrcIpAddress) { pstClassifierEntry->ucIPSourceAddressLength = u8IpAddressLen/(nSizeOfIPAddressInBytes * 2); - if(bIpVersion6) { + if (bIpVersion6) { ptrClassifierIpAddress = pstClassifierEntry->stSrcIpAddress.ucIpv6Address; ptrClassifierIpMask = @@ -163,21 +163,21 @@ CopyIpAddrToClassifier(S_CLASSIFIER_RULE *pstClassifierEntry , } bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Address Length:0x%X\n", pstClassifierEntry->ucIPDestinationAddressLength); - while((u8IpAddressLen>= nSizeOfIPAddressInBytes) && + while ((u8IpAddressLen>= nSizeOfIPAddressInBytes) && (ucLoopIndex < MAX_IP_RANGE_LENGTH)) { memcpy(ptrClassifierIpAddress + (ucLoopIndex * nSizeOfIPAddressInBytes), (pu8IpAddressMaskSrc+(ucLoopIndex*nSizeOfIPAddressInBytes*2)), nSizeOfIPAddressInBytes); - if(!bIpVersion6) { - if(eIpAddrContext == eSrcIpAddress) { + if (!bIpVersion6) { + if (eIpAddrContext == eSrcIpAddress) { pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[ucLoopIndex]= ntohl(pstClassifierEntry->stSrcIpAddress. ulIpv4Addr[ucLoopIndex]); bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Src Ip Address:0x%luX\n", pstClassifierEntry->stSrcIpAddress.ulIpv4Addr[ucLoopIndex]); - } else if(eIpAddrContext == eDestIpAddress) { + } else if (eIpAddrContext == eDestIpAddress) { pstClassifierEntry->stDestIpAddress.ulIpv4Addr[ucLoopIndex]= ntohl(pstClassifierEntry->stDestIpAddress. ulIpv4Addr[ucLoopIndex]); bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, @@ -186,14 +186,14 @@ CopyIpAddrToClassifier(S_CLASSIFIER_RULE *pstClassifierEntry , } } u8IpAddressLen-=nSizeOfIPAddressInBytes; - if(u8IpAddressLen >= nSizeOfIPAddressInBytes) { + if (u8IpAddressLen >= nSizeOfIPAddressInBytes) { memcpy(ptrClassifierIpMask + (ucLoopIndex * nSizeOfIPAddressInBytes), (pu8IpAddressMaskSrc+nSizeOfIPAddressInBytes + (ucLoopIndex*nSizeOfIPAddressInBytes*2)), nSizeOfIPAddressInBytes); - if(!bIpVersion6) { - if(eIpAddrContext == eSrcIpAddress) { + if (!bIpVersion6) { + if (eIpAddrContext == eSrcIpAddress) { pstClassifierEntry->stSrcIpAddress. ulIpv4Mask[ucLoopIndex]= ntohl(pstClassifierEntry->stSrcIpAddress. @@ -201,7 +201,7 @@ CopyIpAddrToClassifier(S_CLASSIFIER_RULE *pstClassifierEntry , bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Src Ip Mask Address:0x%luX\n", pstClassifierEntry->stSrcIpAddress.ulIpv4Mask[ucLoopIndex]); - } else if(eIpAddrContext == eDestIpAddress) { + } else if (eIpAddrContext == eDestIpAddress) { pstClassifierEntry->stDestIpAddress. ulIpv4Mask[ucLoopIndex] = ntohl(pstClassifierEntry->stDestIpAddress. @@ -213,22 +213,22 @@ CopyIpAddrToClassifier(S_CLASSIFIER_RULE *pstClassifierEntry , } u8IpAddressLen-=nSizeOfIPAddressInBytes; } - if(0==u8IpAddressLen) { + if (0==u8IpAddressLen) { pstClassifierEntry->bDestIpValid=TRUE; } ucLoopIndex++; } - if(bIpVersion6) { + if (bIpVersion6) { //Restore EndianNess of Struct - for(ucLoopIndex =0 ; ucLoopIndex < MAX_IP_RANGE_LENGTH * 4 ; + for (ucLoopIndex =0 ; ucLoopIndex < MAX_IP_RANGE_LENGTH * 4 ; ucLoopIndex++) { - if(eIpAddrContext == eSrcIpAddress) { + if (eIpAddrContext == eSrcIpAddress) { pstClassifierEntry->stSrcIpAddress.ulIpv6Addr[ucLoopIndex]= ntohl(pstClassifierEntry->stSrcIpAddress. ulIpv6Addr[ucLoopIndex]); pstClassifierEntry->stSrcIpAddress.ulIpv6Mask[ucLoopIndex]= ntohl(pstClassifierEntry->stSrcIpAddress. ulIpv6Mask[ucLoopIndex]); - } else if(eIpAddrContext == eDestIpAddress) { + } else if (eIpAddrContext == eDestIpAddress) { pstClassifierEntry->stDestIpAddress.ulIpv6Addr[ucLoopIndex]= ntohl(pstClassifierEntry->stDestIpAddress. ulIpv6Addr[ucLoopIndex]); pstClassifierEntry->stDestIpAddress.ulIpv6Mask[ucLoopIndex]= ntohl(pstClassifierEntry->stDestIpAddress. @@ -243,8 +243,8 @@ CopyIpAddrToClassifier(S_CLASSIFIER_RULE *pstClassifierEntry , void ClearTargetDSXBuffer(PMINI_ADAPTER Adapter,B_UINT16 TID,BOOLEAN bFreeAll) { ULONG ulIndex; - for(ulIndex=0; ulIndex < Adapter->ulTotalTargetBuffersAvailable; ulIndex++) { - if(Adapter->astTargetDsxBuffer[ulIndex].valid) + for (ulIndex=0; ulIndex < Adapter->ulTotalTargetBuffersAvailable; ulIndex++) { + if (Adapter->astTargetDsxBuffer[ulIndex].valid) continue; if ((bFreeAll) || (Adapter->astTargetDsxBuffer[ulIndex].tid == TID)){ pr_info("ClearTargetDSXBuffer: found tid %d buffer cleared %lx\n", @@ -269,7 +269,7 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter,stConvergenceSLT //ULONG ulPhsStatus; - if(Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value == 0 || + if (Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value == 0 || nClassifierIndex > (MAX_CLASSIFIERS-1)) return; @@ -278,11 +278,11 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter,stConvergenceSLT "Storing Classifier Rule Index : %X\n", ntohs(psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex)); - if(nClassifierIndex > MAX_CLASSIFIERS-1) + if (nClassifierIndex > MAX_CLASSIFIERS-1) return; pstClassifierEntry = &Adapter->astClassifierTable[nClassifierIndex]; - if(pstClassifierEntry) { + if (pstClassifierEntry) { //Store if Ipv6 pstClassifierEntry->bIpv6Protocol = (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6)?TRUE:FALSE; @@ -292,8 +292,8 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter,stConvergenceSLT bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Destination Port Range Length:0x%X\n", pstClassifierEntry->ucDestPortRangeLength); - if( MAX_PORT_RANGE >= psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength) { - for(ucLoopIndex=0;ucLoopIndex<(pstClassifierEntry->ucDestPortRangeLength);ucLoopIndex++) { + if ( MAX_PORT_RANGE >= psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRangeLength) { + for (ucLoopIndex=0;ucLoopIndex<(pstClassifierEntry->ucDestPortRangeLength);ucLoopIndex++) { pstClassifierEntry->usDestPortRangeLo[ucLoopIndex] = *((PUSHORT)(psfCSType->cCPacketClassificationRule.u8ProtocolDestPortRange+ucLoopIndex)); pstClassifierEntry->usDestPortRangeHi[ucLoopIndex] = @@ -311,12 +311,12 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter,stConvergenceSLT bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Source Port Range Length:0x%X\n", psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength); - if(MAX_PORT_RANGE >= + if (MAX_PORT_RANGE >= psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength) { pstClassifierEntry->ucSrcPortRangeLength = psfCSType->cCPacketClassificationRule. u8ProtocolSourcePortRangeLength/4; - for(ucLoopIndex = 0; ucLoopIndex < + for (ucLoopIndex = 0; ucLoopIndex < (pstClassifierEntry->ucSrcPortRangeLength); ucLoopIndex++) { pstClassifierEntry->usSrcPortRangeLo[ucLoopIndex] = *((PUSHORT)(psfCSType->cCPacketClassificationRule. @@ -355,7 +355,7 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter,stConvergenceSLT //TOS bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "TOS Length:0x%X\n", psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength); - if(3 == psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength) { + if (3 == psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength) { pstClassifierEntry->ucIPTypeOfServiceLength = psfCSType->cCPacketClassificationRule.u8IPTypeOfServiceLength; pstClassifierEntry->ucTosLow = @@ -366,7 +366,7 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter,stConvergenceSLT psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]; pstClassifierEntry->bTOSValid = TRUE; } - if(psfCSType->cCPacketClassificationRule.u8Protocol == 0) { + if (psfCSType->cCPacketClassificationRule.u8Protocol == 0) { //we didn't get protocol field filled in by the BS pstClassifierEntry->ucProtocolLength=0; } else { @@ -394,7 +394,7 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter,stConvergenceSLT pstClassifierEntry->uiClassifierRuleIndex, pstClassifierEntry->usVCID_Value); - if(psfCSType->cCPacketClassificationRule.u8AssociatedPHSI) { + if (psfCSType->cCPacketClassificationRule.u8AssociatedPHSI) { pstClassifierEntry->u8AssociatedPHSI = psfCSType->cCPacketClassificationRule.u8AssociatedPHSI; } @@ -429,17 +429,17 @@ static inline VOID DeleteClassifierRuleFromSF(PMINI_ADAPTER Adapter,UINT uiSearc usVCID = Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value; - if(nClassifierIndex > MAX_CLASSIFIERS-1) + if (nClassifierIndex > MAX_CLASSIFIERS-1) return; - if(usVCID == 0) + if (usVCID == 0) return; u16PacketClassificationRuleIndex = Adapter->astClassifierTable[nClassifierIndex].uiClassifierRuleIndex; pstClassifierEntry = &Adapter->astClassifierTable[nClassifierIndex]; - if(pstClassifierEntry) { + if (pstClassifierEntry) { pstClassifierEntry->bUsed = FALSE; pstClassifierEntry->uiClassifierRuleIndex = 0; memset(pstClassifierEntry,0,sizeof(S_CLASSIFIER_RULE)); @@ -466,14 +466,14 @@ VOID DeleteAllClassifiersForSF(PMINI_ADAPTER Adapter,UINT uiSearchRuleIndex) ulVCID = Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value; - if(ulVCID == 0) + if (ulVCID == 0) return; - for(nClassifierIndex =0 ; nClassifierIndex < MAX_CLASSIFIERS ; nClassifierIndex++) { - if(Adapter->astClassifierTable[nClassifierIndex].usVCID_Value == ulVCID) { + for (nClassifierIndex =0 ; nClassifierIndex < MAX_CLASSIFIERS ; nClassifierIndex++) { + if (Adapter->astClassifierTable[nClassifierIndex].usVCID_Value == ulVCID) { pstClassifierEntry = &Adapter->astClassifierTable[nClassifierIndex]; - if(pstClassifierEntry->bUsed) { + if (pstClassifierEntry->bUsed) { DeleteClassifierRuleFromSF(Adapter,uiSearchRuleIndex,nClassifierIndex); } } @@ -530,7 +530,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "CopyToAdapter : u8CSSpecification : %X\n", psfLocalSet->u8CSSpecification); - switch(psfLocalSet->u8CSSpecification) { + switch (psfLocalSet->u8CSSpecification) { case eCSPacketIPV4: { Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS; break; @@ -577,17 +577,17 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A //Store IP Version used //Get The Version Of IP used (IPv6 or IPv4) from CSSpecification field of SF - if(Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport == IPV6_CS) { + if (Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport == IPV6_CS) { Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion = IPV6; } else { Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion = IPV4; } /* To ensure that the ETH CS code doesn't gets executed if the BS doesn't supports ETH CS */ - if(!Adapter->bETHCSEnabled) + if (!Adapter->bETHCSEnabled) Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = 0; - if(psfLocalSet->u8ServiceClassNameLength > 0 && + if (psfLocalSet->u8ServiceClassNameLength > 0 && psfLocalSet->u8ServiceClassNameLength < 32) { memcpy(Adapter->PackInfo[uiSearchRuleIndex].ucServiceClassName, psfLocalSet->u8ServiceClassName, @@ -596,7 +596,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A Adapter->PackInfo[uiSearchRuleIndex].u8QueueType = psfLocalSet->u8ServiceFlowSchedulingType; - if(Adapter->PackInfo[uiSearchRuleIndex].u8QueueType==BE && + if (Adapter->PackInfo[uiSearchRuleIndex].u8QueueType==BE && Adapter->PackInfo[uiSearchRuleIndex].ucDirection) { Adapter->usBestEffortQueueIndex=uiSearchRuleIndex; } @@ -606,26 +606,26 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A Adapter->PackInfo[uiSearchRuleIndex].u8TrafficPriority = psfLocalSet->u8TrafficPriority; //copy all the classifier in the Service Flow param structure - for(nIndex=0; nIndex<psfLocalSet->u8TotalClassifiers; nIndex++) { + for (nIndex=0; nIndex<psfLocalSet->u8TotalClassifiers; nIndex++) { bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Classifier index =%d\n", nIndex); psfCSType = &psfLocalSet->cConvergenceSLTypes[nIndex]; bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Classifier index =%d\n", nIndex); - if(psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority) { + if (psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority) { Adapter->PackInfo[uiSearchRuleIndex].bClassifierPriority=TRUE; } - if(psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority) { + if (psfCSType->cCPacketClassificationRule.u8ClassifierRulePriority) { Adapter->PackInfo[uiSearchRuleIndex].bClassifierPriority=TRUE; } - if(ucDsxType== DSA_ACK) { + if (ucDsxType== DSA_ACK) { eClassifierAction = eAddClassifier; - } else if(ucDsxType == DSC_ACK) { - switch(psfCSType->u8ClassfierDSCAction) { + } else if (ucDsxType == DSC_ACK) { + switch (psfCSType->u8ClassfierDSCAction) { case 0://DSC Add Classifier { eClassifierAction = eAddClassifier; @@ -651,15 +651,15 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A u16PacketClassificationRuleIndex = ntohs(psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex); - switch(eClassifierAction) { + switch (eClassifierAction) { case eAddClassifier: { //Get a Free Classifier Index From Classifier table for this SF to add the Classifier //Contained in this message nClassifierIndex = SearchClsid(Adapter,ulSFID,u16PacketClassificationRuleIndex); - if(nClassifierIndex > MAX_CLASSIFIERS) { + if (nClassifierIndex > MAX_CLASSIFIERS) { nClassifierIndex = SearchFreeClsid(Adapter); - if(nClassifierIndex > MAX_CLASSIFIERS) { + if (nClassifierIndex > MAX_CLASSIFIERS) { //Failed To get a free Entry bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Error Failed To get a free Classifier Entry\n"); @@ -682,7 +682,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A //Get the Classifier Index From Classifier table for this SF and replace existing Classifier //with the new classifier Contained in this message nClassifierIndex = SearchClsid(Adapter,ulSFID,u16PacketClassificationRuleIndex); - if(nClassifierIndex > MAX_CLASSIFIERS) { + if (nClassifierIndex > MAX_CLASSIFIERS) { //Failed To search the classifier bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Error Search for Classifier To be replaced failed\n"); @@ -697,7 +697,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A //Get the Classifier Index From Classifier table for this SF and replace existing Classifier //with the new classifier Contained in this message nClassifierIndex = SearchClsid(Adapter,ulSFID,u16PacketClassificationRuleIndex); - if(nClassifierIndex > MAX_CLASSIFIERS) { + if (nClassifierIndex > MAX_CLASSIFIERS) { //Failed To search the classifier bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Error Search for Classifier To be deleted failed\n"); @@ -718,7 +718,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A } //Repeat parsing Classification Entries to process PHS Rules - for(nIndex=0; nIndex < psfLocalSet->u8TotalClassifiers; nIndex++) { + for (nIndex=0; nIndex < psfLocalSet->u8TotalClassifiers; nIndex++) { psfCSType = &psfLocalSet->cConvergenceSLTypes[nIndex]; bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, @@ -743,7 +743,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "PHS DSC Action = Delete PHS Rule\n"); - if(psfCSType->cPhsRule.u8PHSI) { + if (psfCSType->cPhsRule.u8PHSI) { PhsDeletePHSRule( &Adapter->stBCMPhsContext, uVCID, @@ -754,7 +754,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A } default : { - if(ucDsxType == DSC_ACK) { + if (ucDsxType == DSC_ACK) { break; //FOr DSC ACK Case PHS DSC Action must be in valid set } } @@ -763,12 +763,12 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A case eAddPHSRule: case eSetPHSRule: { - if(psfCSType->cPhsRule.u8PHSI) { + if (psfCSType->cPhsRule.u8PHSI) { //Apply This PHS Rule to all classifiers whose Associated PHSI Match unsigned int uiClassifierIndex = 0; - if(pstAddIndication->u8Direction == UPLINK_DIR ) { - for(uiClassifierIndex=0;uiClassifierIndex<MAX_CLASSIFIERS;uiClassifierIndex++) { - if((Adapter->astClassifierTable[uiClassifierIndex].bUsed) && + if (pstAddIndication->u8Direction == UPLINK_DIR ) { + for (uiClassifierIndex=0;uiClassifierIndex<MAX_CLASSIFIERS;uiClassifierIndex++) { + if ((Adapter->astClassifierTable[uiClassifierIndex].bUsed) && (Adapter->astClassifierTable[uiClassifierIndex].ulSFID == Adapter->PackInfo[uiSearchRuleIndex].ulSFID) && (Adapter->astClassifierTable[uiClassifierIndex].u8AssociatedPHSI == psfCSType->cPhsRule.u8PHSI)) { bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, @@ -802,7 +802,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A Adapter->astClassifierTable[uiClassifierIndex].u8AssociatedPHSI); //Update PHS Rule For the Classifier - if(sPhsRule.u8PHSI) { + if (sPhsRule.u8PHSI) { Adapter->astClassifierTable[uiClassifierIndex].u32PHSRuleID = sPhsRule.u8PHSI; memcpy(&Adapter->astClassifierTable[uiClassifierIndex].sPhsRule,&sPhsRule,sizeof(S_PHS_RULE)); } @@ -848,7 +848,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A } } - if(psfLocalSet->u32MaxSustainedTrafficRate == 0 ) { + if (psfLocalSet->u32MaxSustainedTrafficRate == 0 ) { //No Rate Limit . Set Max Sustained Traffic Rate to Maximum Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate = WIMAX_MAX_ALLOWED_RATE; @@ -865,15 +865,15 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency = ntohl(psfLocalSet->u32MaximumLatency); - if(Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency == 0) /* 0 should be treated as infinite */ + if (Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency == 0) /* 0 should be treated as infinite */ Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency = MAX_LATENCY_ALLOWED; - if(( Adapter->PackInfo[uiSearchRuleIndex].u8QueueType == ERTPS || + if (( Adapter->PackInfo[uiSearchRuleIndex].u8QueueType == ERTPS || Adapter->PackInfo[uiSearchRuleIndex].u8QueueType == UGS ) ) UGIValue = ntohs(psfLocalSet->u16UnsolicitedGrantInterval); - if(UGIValue == 0) + if (UGIValue == 0) UGIValue = DEFAULT_UG_INTERVAL; /* @@ -886,7 +886,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize = (DEFAULT_UGI_FACTOR*Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate*UGIValue)/1000; - if(Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize < WIMAX_MAX_MTU*8) { + if (Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize < WIMAX_MAX_MTU*8) { UINT UGIFactor = 0; /* Special Handling to ensure the biggest size of packet can go out from host to FW as follows: 1. Any packet from Host to FW can go out in different packet size. @@ -895,11 +895,11 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A */ UGIFactor = (Adapter->PackInfo[uiSearchRuleIndex].uiMaxLatency/UGIValue + 1); - if(UGIFactor > DEFAULT_UGI_FACTOR) + if (UGIFactor > DEFAULT_UGI_FACTOR) Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize = (UGIFactor*Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate*UGIValue)/1000; - if(Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize > WIMAX_MAX_MTU*8) + if (Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize > WIMAX_MAX_MTU*8) Adapter->PackInfo[uiSearchRuleIndex].uiMaxBucketSize = WIMAX_MAX_MTU*8; } @@ -1098,7 +1098,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) nCurClassifierCnt = pstAddIndication->sfAuthorizedSet.u8TotalClassifiers; - if(nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF) { + if (nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF) { nCurClassifierCnt = MAX_CLASSIFIERS_IN_SF; } bcm_dbg(Adapter, OTHERS, DUMP_CONTROL, ALL, @@ -1107,9 +1107,9 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) bcm_dbg(Adapter, OTHERS, DUMP_CONTROL, ALL, "pstAddIndication->sfAuthorizedSet.u16MacOverhead %x\n", pstAddIndication->sfAuthorizedSet.u16MacOverhead); - if(!pstAddIndication->sfAuthorizedSet.bValid) + if (!pstAddIndication->sfAuthorizedSet.bValid) pstAddIndication->sfAuthorizedSet.bValid=1; - for(nIndex = 0 ; nIndex < nCurClassifierCnt ; nIndex++) { + for (nIndex = 0 ; nIndex < nCurClassifierCnt ; nIndex++) { stConvergenceSLTypes *psfCSType = NULL; psfCSType = &pstAddIndication->sfAuthorizedSet.cConvergenceSLTypes[nIndex]; @@ -1131,7 +1131,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1], psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]); - for(uiLoopIndex=0; uiLoopIndex < 1; uiLoopIndex++) + for (uiLoopIndex=0; uiLoopIndex < 1; uiLoopIndex++) bcm_dbg(Adapter, OTHERS, DUMP_CONTROL, ALL, "u8Protocol : 0x%02X\n", psfCSType->cCPacketClassificationRule.u8Protocol); @@ -1140,7 +1140,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) "u8IPMaskedSourceAddressLength :0x%X\n", psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength); - for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++) + for (uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++) bcm_dbg(Adapter, OTHERS, DUMP_CONTROL, ALL, "u8IPMaskedSourceAddress[32] : 0x%02X\n", psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress[uiLoopIndex]); @@ -1149,7 +1149,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) "u8IPDestinationAddressLength : 0x%X\n", psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength); - for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++) + for (uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++) bcm_dbg(Adapter, OTHERS, DUMP_CONTROL, ALL, "u8IPDestinationAddress[32] : 0x%02X\n", psfCSType->cCPacketClassificationRule.u8IPDestinationAddress[uiLoopIndex]); @@ -1368,12 +1368,12 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) nCurClassifierCnt = pstAddIndication->sfAdmittedSet.u8TotalClassifiers; - if(nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF) { + if (nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF) { nCurClassifierCnt = MAX_CLASSIFIERS_IN_SF; } - for(nIndex = 0 ; nIndex < nCurClassifierCnt ; nIndex++) { + for (nIndex = 0 ; nIndex < nCurClassifierCnt ; nIndex++) { stConvergenceSLTypes *psfCSType = NULL; psfCSType = &pstAddIndication->sfAdmittedSet.cConvergenceSLTypes[nIndex]; @@ -1393,7 +1393,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0], psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1], psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]); - for(uiLoopIndex=0; uiLoopIndex < 1; uiLoopIndex++) + for (uiLoopIndex=0; uiLoopIndex < 1; uiLoopIndex++) bcm_dbg(Adapter, OTHERS, DUMP_CONTROL, ALL, "u8Protocol: 0x%02X\n", psfCSType->cCPacketClassificationRule.u8Protocol); @@ -1402,7 +1402,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) "u8IPMaskedSourceAddressLength :0x%02X\n", psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength); - for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++) + for (uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++) bcm_dbg(Adapter, OTHERS, DUMP_CONTROL, ALL, "u8IPMaskedSourceAddress[32] : 0x%02X\n", psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress[uiLoopIndex]); @@ -1411,7 +1411,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) "u8IPDestinationAddressLength : 0x%02X\n", psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength); - for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++) + for (uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++) bcm_dbg(Adapter, OTHERS, DUMP_CONTROL, ALL, "u8IPDestinationAddress[32] : 0x%02X\n", psfCSType->cCPacketClassificationRule.u8IPDestinationAddress[uiLoopIndex]); @@ -1628,11 +1628,11 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) nCurClassifierCnt = pstAddIndication->sfActiveSet.u8TotalClassifiers; - if(nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF) { + if (nCurClassifierCnt > MAX_CLASSIFIERS_IN_SF) { nCurClassifierCnt = MAX_CLASSIFIERS_IN_SF; } - for(nIndex = 0 ; nIndex < nCurClassifierCnt ; nIndex++) { + for (nIndex = 0 ; nIndex < nCurClassifierCnt ; nIndex++) { stConvergenceSLTypes *psfCSType = NULL; psfCSType = &pstAddIndication->sfActiveSet.cConvergenceSLTypes[nIndex]; @@ -1653,7 +1653,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) psfCSType->cCPacketClassificationRule.u8IPTypeOfService[0], psfCSType->cCPacketClassificationRule.u8IPTypeOfService[1], psfCSType->cCPacketClassificationRule.u8IPTypeOfService[2]); - for(uiLoopIndex=0; uiLoopIndex < 1; uiLoopIndex++) + for (uiLoopIndex=0; uiLoopIndex < 1; uiLoopIndex++) bcm_dbg(Adapter, OTHERS, DUMP_CONTROL, ALL, "u8Protocol : 0x%X\n", psfCSType->cCPacketClassificationRule.u8Protocol); @@ -1662,7 +1662,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) "u8IPMaskedSourceAddressLength :0x%X\n", psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddressLength); - for(uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++) + for (uiLoopIndex=0; uiLoopIndex < 32; uiLoopIndex++) bcm_dbg(Adapter, OTHERS, DUMP_CONTROL, ALL, "u8IPMaskedSourceAddress[32]:0x%X\n", psfCSType->cCPacketClassificationRule.u8IPMaskedSourceAddress[uiLoopIndex]); @@ -1671,7 +1671,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) "u8IPDestinationAddressLength : 0x%02X\n", psfCSType->cCPacketClassificationRule.u8IPDestinationAddressLength); - for(uiLoopIndex=0;uiLoopIndex<32;uiLoopIndex++) + for (uiLoopIndex=0;uiLoopIndex<32;uiLoopIndex++) bcm_dbg(Adapter, OTHERS, DUMP_CONTROL, ALL, "u8IPDestinationAddress[32]:0x%X\n", psfCSType->cCPacketClassificationRule.u8IPDestinationAddress[uiLoopIndex]); @@ -1776,7 +1776,7 @@ static inline ULONG RestoreSFParam(PMINI_ADAPTER Adapter, ULONG ulAddrSFParamSet { UINT nBytesToRead = sizeof(stServiceFlowParamSI); - if(ulAddrSFParamSet == 0 || NULL == pucDestBuffer) { + if (ulAddrSFParamSet == 0 || NULL == pucDestBuffer) { bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Got Param address as 0!!\n"); return 0; @@ -1784,7 +1784,7 @@ static inline ULONG RestoreSFParam(PMINI_ADAPTER Adapter, ULONG ulAddrSFParamSet ulAddrSFParamSet = ntohl(ulAddrSFParamSet); //Read out the SF Param Set At the indicated Location - if(rdm(Adapter, ulAddrSFParamSet, (PUCHAR)pucDestBuffer, nBytesToRead) < 0) + if (rdm(Adapter, ulAddrSFParamSet, (PUCHAR)pucDestBuffer, nBytesToRead) < 0) return STATUS_FAILURE; return 1; @@ -1796,7 +1796,7 @@ static ULONG StoreSFParam(PMINI_ADAPTER Adapter,PUCHAR pucSrcBuffer,ULONG ulAdd UINT nBytesToWrite = sizeof(stServiceFlowParamSI); int ret = 0; - if(ulAddrSFParamSet == 0 || NULL == pucSrcBuffer) { + if (ulAddrSFParamSet == 0 || NULL == pucSrcBuffer) { return 0; } @@ -1823,13 +1823,13 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter,PVOID pvBuffer,UINT *p * In case of DSD Req By MS, we should immediately delete this SF so that * we can stop the further classifying the pkt for this SF. */ - if(pstAddIndicationAlt->u8Type == DSD_REQ) { + if (pstAddIndicationAlt->u8Type == DSD_REQ) { pstDeletionRequest = (stLocalSFDeleteRequest *)pvBuffer; ulSFID = ntohl(pstDeletionRequest->u32SFID); uiSearchRuleIndex=SearchSfid(Adapter,ulSFID); - if(uiSearchRuleIndex < NO_OF_QUEUES) { + if (uiSearchRuleIndex < NO_OF_QUEUES) { deleteSFBySfid(Adapter,uiSearchRuleIndex); Adapter->u32TotalDSD++; } @@ -1837,7 +1837,7 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter,PVOID pvBuffer,UINT *p } - if( (pstAddIndicationAlt->u8Type == DSD_RSP) || + if ( (pstAddIndicationAlt->u8Type == DSD_RSP) || (pstAddIndicationAlt->u8Type == DSD_ACK)) { //No Special handling send the message as it is return 1; @@ -1845,23 +1845,23 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter,PVOID pvBuffer,UINT *p // For DSA_REQ, only up to "psfAuthorizedSet" parameter should be accessed by driver! pstAddIndication=kmalloc(sizeof(*pstAddIndication), GFP_KERNEL); - if(NULL==pstAddIndication) + if (NULL==pstAddIndication) return 0; /* AUTHORIZED SET */ pstAddIndication->psfAuthorizedSet = (stServiceFlowParamSI *) GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID); - if(!pstAddIndication->psfAuthorizedSet) + if (!pstAddIndication->psfAuthorizedSet) return 0; - if(StoreSFParam(Adapter,(PUCHAR)&pstAddIndicationAlt->sfAuthorizedSet, + if (StoreSFParam(Adapter,(PUCHAR)&pstAddIndicationAlt->sfAuthorizedSet, (ULONG)pstAddIndication->psfAuthorizedSet)!= 1) return 0; /* this can't possibly be right */ pstAddIndication->psfAuthorizedSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfAuthorizedSet); - if(pstAddIndicationAlt->u8Type == DSA_REQ) { + if (pstAddIndicationAlt->u8Type == DSA_REQ) { stLocalSFAddRequest AddRequest; AddRequest.u8Type = pstAddIndicationAlt->u8Type; @@ -1889,9 +1889,9 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter,PVOID pvBuffer,UINT *p /* ADMITTED SET */ pstAddIndication->psfAdmittedSet = (stServiceFlowParamSI *) GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID); - if(!pstAddIndication->psfAdmittedSet) + if (!pstAddIndication->psfAdmittedSet) return 0; - if(StoreSFParam(Adapter,(PUCHAR)&pstAddIndicationAlt->sfAdmittedSet,(ULONG)pstAddIndication->psfAdmittedSet) != 1) + if (StoreSFParam(Adapter,(PUCHAR)&pstAddIndicationAlt->sfAdmittedSet,(ULONG)pstAddIndication->psfAdmittedSet) != 1) return 0; pstAddIndication->psfAdmittedSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfAdmittedSet); @@ -1900,9 +1900,9 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter,PVOID pvBuffer,UINT *p /* ACTIVE SET */ pstAddIndication->psfActiveSet = (stServiceFlowParamSI *) GetNextTargetBufferLocation(Adapter, pstAddIndicationAlt->u16TID); - if(!pstAddIndication->psfActiveSet) + if (!pstAddIndication->psfActiveSet) return 0; - if(StoreSFParam(Adapter,(PUCHAR)&pstAddIndicationAlt->sfActiveSet,(ULONG)pstAddIndication->psfActiveSet) != 1) + if (StoreSFParam(Adapter,(PUCHAR)&pstAddIndicationAlt->sfActiveSet,(ULONG)pstAddIndication->psfActiveSet) != 1) return 0; pstAddIndication->psfActiveSet = (stServiceFlowParamSI *)ntohl((ULONG)pstAddIndication->psfActiveSet); @@ -1937,7 +1937,7 @@ static inline stLocalSFAddIndicationAlt */ pstAddIndicationDest=kmalloc(sizeof(stLocalSFAddIndicationAlt), GFP_KERNEL); - if(pstAddIndicationDest) { + if (pstAddIndicationDest) { memset(pstAddIndicationDest,0,sizeof(stLocalSFAddIndicationAlt)); } else { bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, @@ -1976,26 +1976,26 @@ static inline stLocalSFAddIndicationAlt bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Restoring Active Set\n"); ulStatus=RestoreSFParam(Adapter,(ULONG)pstAddIndication->psfActiveSet, (PUCHAR)&pstAddIndicationDest->sfActiveSet); - if(ulStatus != 1) { + if (ulStatus != 1) { goto failed_restore_sf_param; } - if(pstAddIndicationDest->sfActiveSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF) + if (pstAddIndicationDest->sfActiveSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF) pstAddIndicationDest->sfActiveSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF; bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Restoring Admitted Set\n"); ulStatus=RestoreSFParam(Adapter,(ULONG)pstAddIndication->psfAdmittedSet,(PUCHAR)&pstAddIndicationDest->sfAdmittedSet); - if(ulStatus != 1) { + if (ulStatus != 1) { goto failed_restore_sf_param; } - if(pstAddIndicationDest->sfAdmittedSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF) + if (pstAddIndicationDest->sfAdmittedSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF) pstAddIndicationDest->sfAdmittedSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF; bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Restoring Authorized Set\n"); ulStatus=RestoreSFParam(Adapter,(ULONG)pstAddIndication->psfAuthorizedSet,(PUCHAR)&pstAddIndicationDest->sfAuthorizedSet); - if(ulStatus != 1) { + if (ulStatus != 1) { goto failed_restore_sf_param; } - if(pstAddIndicationDest->sfAuthorizedSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF) + if (pstAddIndicationDest->sfAuthorizedSet.u8TotalClassifiers > MAX_CLASSIFIERS_IN_SF) pstAddIndicationDest->sfAuthorizedSet.u8TotalClassifiers = MAX_CLASSIFIERS_IN_SF; bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, @@ -2028,7 +2028,7 @@ ULONG SetUpTargetDsxBuffers(PMINI_ADAPTER Adapter) return 0; } - if(Adapter->astTargetDsxBuffer[0].ulTargetDsxBuffer) + if (Adapter->astTargetDsxBuffer[0].ulTargetDsxBuffer) return 1; bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, @@ -2040,7 +2040,7 @@ ULONG SetUpTargetDsxBuffers(PMINI_ADAPTER Adapter) Status = rdmalt(Adapter, DSX_MESSAGE_EXCHANGE_BUFFER, (PUINT)&ulTargetDsxBuffersBase, sizeof(UINT)); - if(Status < 0) { + if (Status < 0) { bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "RDM failed!!\n"); return 0; } @@ -2062,7 +2062,7 @@ ULONG SetUpTargetDsxBuffers(PMINI_ADAPTER Adapter) "Total Target DSX Buffer setup %lx\n", Adapter->ulTotalTargetBuffersAvailable); - for(ulIndex=0; ulIndex < Adapter->ulTotalTargetBuffersAvailable ; ulIndex++) { + for (ulIndex=0; ulIndex < Adapter->ulTotalTargetBuffersAvailable ; ulIndex++) { Adapter->astTargetDsxBuffer[ulIndex].ulTargetDsxBuffer = ulTargetDsxBuffersBase; Adapter->astTargetDsxBuffer[ulIndex].valid=1; Adapter->astTargetDsxBuffer[ulIndex].tid=0; @@ -2081,7 +2081,7 @@ static ULONG GetNextTargetBufferLocation(PMINI_ADAPTER Adapter,B_UINT16 tid) ULONG ulTargetDSXBufferAddress; ULONG ulTargetDsxBufferIndexToUse,ulMaxTry; - if((Adapter->ulTotalTargetBuffersAvailable == 0)|| + if ((Adapter->ulTotalTargetBuffersAvailable == 0)|| (Adapter->ulFreeTargetBufferCnt == 0)) { ClearTargetDSXBuffer(Adapter,tid,FALSE); return 0; @@ -2089,13 +2089,13 @@ static ULONG GetNextTargetBufferLocation(PMINI_ADAPTER Adapter,B_UINT16 tid) ulTargetDsxBufferIndexToUse = Adapter->ulCurrentTargetBuffer; ulMaxTry = Adapter->ulTotalTargetBuffersAvailable; - while((ulMaxTry)&&(Adapter->astTargetDsxBuffer[ulTargetDsxBufferIndexToUse].valid != 1)) { + while ((ulMaxTry)&&(Adapter->astTargetDsxBuffer[ulTargetDsxBufferIndexToUse].valid != 1)) { ulTargetDsxBufferIndexToUse = (ulTargetDsxBufferIndexToUse+1)% Adapter->ulTotalTargetBuffersAvailable; ulMaxTry--; } - if(ulMaxTry==0) { + if (ulMaxTry==0) { pr_info("GetNextTargetBufferLocation : Error No Free Target DSX Buffers FreeCnt : %lx\n", Adapter->ulFreeTargetBufferCnt); ClearTargetDSXBuffer(Adapter,tid,FALSE); @@ -2126,7 +2126,7 @@ INT AllocAdapterDsxBuffer(PMINI_ADAPTER Adapter) //Our driver can't create these structures on Stack */ Adapter->caDsxReqResp=kmalloc(sizeof(stLocalSFAddIndicationAlt)+LEADER_SIZE, GFP_KERNEL); - if(!Adapter->caDsxReqResp) + if (!Adapter->caDsxReqResp) return -ENOMEM; return 0; } @@ -2155,7 +2155,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap //Otherwise the message contains a target address from where we need to //read out the rest of the service flow param structure */ - if((pstAddIndication = RestoreCmControlResponseMessage(Adapter,pvBuffer)) + if ((pstAddIndication = RestoreCmControlResponseMessage(Adapter,pvBuffer)) == NULL) { ClearTargetDSXBuffer(Adapter,((stLocalSFAddIndication *)pvBuffer)->u16TID, FALSE); pr_info("Error in restoring Service Flow param structure from DSx message\n"); @@ -2171,7 +2171,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap ClearTargetDSXBuffer(Adapter,pstAddIndication->u16TID,FALSE); pr_info("### TID RECEIVED %d\n", pstAddIndication->u16TID); - switch(pstAddIndication->u8Type) { + switch (pstAddIndication->u8Type) { case DSA_REQ: { pLeader->PLength = sizeof(stLocalSFAddIndicationAlt); bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, @@ -2211,27 +2211,27 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Direction:0x%X\n", pstAddIndication->u8Direction); - if((uiSearchRuleIndex< NO_OF_QUEUES) ) { + if ((uiSearchRuleIndex< NO_OF_QUEUES) ) { Adapter->PackInfo[uiSearchRuleIndex].ucDirection = pstAddIndication->u8Direction; bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "bValid:0x%X\n", pstAddIndication->sfActiveSet.bValid); - if(pstAddIndication->sfActiveSet.bValid==TRUE) { + if (pstAddIndication->sfActiveSet.bValid==TRUE) { Adapter->PackInfo[uiSearchRuleIndex].bActiveSet=TRUE; } - if(pstAddIndication->sfAuthorizedSet.bValid==TRUE) { + if (pstAddIndication->sfAuthorizedSet.bValid==TRUE) { Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet=TRUE; } - if(pstAddIndication->sfAdmittedSet.bValid==TRUE) { + if (pstAddIndication->sfAdmittedSet.bValid==TRUE) { Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet=TRUE; } - if(FALSE == pstAddIndication->sfActiveSet.bValid) { + if (FALSE == pstAddIndication->sfActiveSet.bValid) { Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE; Adapter->PackInfo[uiSearchRuleIndex].bActivateRequestSent = FALSE; - if(pstAddIndication->sfAdmittedSet.bValid) { + if (pstAddIndication->sfAdmittedSet.bValid) { psfLocalSet = &pstAddIndication->sfAdmittedSet; - } else if(pstAddIndication->sfAuthorizedSet.bValid) { + } else if (pstAddIndication->sfAuthorizedSet.bValid) { psfLocalSet = &pstAddIndication->sfAuthorizedSet; } } else { @@ -2239,7 +2239,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap Adapter->PackInfo[uiSearchRuleIndex].bActive=TRUE; } - if(!psfLocalSet) { + if (!psfLocalSet) { pr_info("No set is valid\n"); Adapter->PackInfo[uiSearchRuleIndex].bActive=FALSE; Adapter->PackInfo[uiSearchRuleIndex].bValid=FALSE; @@ -2247,7 +2247,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap kfree(pstAddIndication); } - else if(psfLocalSet->bValid && (pstAddIndication->u8CC == 0)) { + else if (psfLocalSet->bValid && (pstAddIndication->u8CC == 0)) { bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "DSA ACK\n"); Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value = @@ -2255,7 +2255,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap Adapter->PackInfo[uiSearchRuleIndex].usCID = ntohs(pstAddIndication->u16CID); - if(UPLINK_DIR == pstAddIndication->u8Direction) + if (UPLINK_DIR == pstAddIndication->u8Direction) atomic_set(&Adapter->PackInfo[uiSearchRuleIndex].uiPerSFTxResourceCount, DEFAULT_PERSFCOUNT); CopyToAdapter(Adapter,psfLocalSet,uiSearchRuleIndex, DSA_ACK, pstAddIndication); @@ -2268,9 +2268,9 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap // *(PULONG)(((PUCHAR)pvBuffer)+1)=psfLocalSet->u32SFID; memcpy((((PUCHAR)pvBuffer)+1), &psfLocalSet->u32SFID, 4); - if(pstAddIndication->sfActiveSet.bValid == TRUE) { - if(UPLINK_DIR == pstAddIndication->u8Direction) { - if(!Adapter->LinkUpStatus) { + if (pstAddIndication->sfActiveSet.bValid == TRUE) { + if (UPLINK_DIR == pstAddIndication->u8Direction) { + if (!Adapter->LinkUpStatus) { netif_carrier_on(Adapter->dev); netif_start_queue(Adapter->dev); Adapter->LinkUpStatus = 1; @@ -2325,27 +2325,27 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap pstChangeIndication = (stLocalSFChangeIndicationAlt *)pstAddIndication; uiSearchRuleIndex=SearchSfid(Adapter,ntohl(pstChangeIndication->sfActiveSet.u32SFID)); - if(uiSearchRuleIndex > NO_OF_QUEUES-1) { + if (uiSearchRuleIndex > NO_OF_QUEUES-1) { pr_info("SF doesn't exist for which DSC_ACK is received\n"); } - if((uiSearchRuleIndex < NO_OF_QUEUES)) { + if ((uiSearchRuleIndex < NO_OF_QUEUES)) { Adapter->PackInfo[uiSearchRuleIndex].ucDirection = pstChangeIndication->u8Direction; - if(pstChangeIndication->sfActiveSet.bValid==TRUE) { + if (pstChangeIndication->sfActiveSet.bValid==TRUE) { Adapter->PackInfo[uiSearchRuleIndex].bActiveSet=TRUE; } - if(pstChangeIndication->sfAuthorizedSet.bValid==TRUE) { + if (pstChangeIndication->sfAuthorizedSet.bValid==TRUE) { Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet=TRUE; } - if(pstChangeIndication->sfAdmittedSet.bValid==TRUE) { + if (pstChangeIndication->sfAdmittedSet.bValid==TRUE) { Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet=TRUE; } - if(FALSE==pstChangeIndication->sfActiveSet.bValid) { + if (FALSE==pstChangeIndication->sfActiveSet.bValid) { Adapter->PackInfo[uiSearchRuleIndex].bActive = FALSE; Adapter->PackInfo[uiSearchRuleIndex].bActivateRequestSent = FALSE; - if(pstChangeIndication->sfAdmittedSet.bValid) { + if (pstChangeIndication->sfAdmittedSet.bValid) { psfLocalSet = &pstChangeIndication->sfAdmittedSet; - } else if(pstChangeIndication->sfAuthorizedSet.bValid) { + } else if (pstChangeIndication->sfAuthorizedSet.bValid) { psfLocalSet = &pstChangeIndication->sfAuthorizedSet; } } @@ -2354,7 +2354,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap psfLocalSet = &pstChangeIndication->sfActiveSet; Adapter->PackInfo[uiSearchRuleIndex].bActive=TRUE; } - if(psfLocalSet->bValid && (pstChangeIndication->u8CC == 0)) { + if (psfLocalSet->bValid && (pstChangeIndication->u8CC == 0)) { Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value = ntohs(pstChangeIndication->u16VCID); pr_info("CC field is %d bvalid = %d\n", @@ -2368,7 +2368,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap DSC_ACK, pstAddIndication); *(PULONG)(((PUCHAR)pvBuffer)+1)=psfLocalSet->u32SFID; - } else if(pstChangeIndication->u8CC == 6) { + } else if (pstChangeIndication->u8CC == 6) { deleteSFBySfid(Adapter,uiSearchRuleIndex); kfree(pstAddIndication); } @@ -2392,7 +2392,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap "DSD - Removing connection %x\n", uiSearchRuleIndex); - if(uiSearchRuleIndex < NO_OF_QUEUES) { + if (uiSearchRuleIndex < NO_OF_QUEUES) { //Delete All Classifiers Associated with this SFID deleteSFBySfid(Adapter,uiSearchRuleIndex); Adapter->u32TotalDSD++; @@ -2431,7 +2431,7 @@ int get_dsx_sf_data_to_application(PMINI_ADAPTER Adapter, UINT uiSFId, void __us } bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "status =%d\n", status); psSfInfo=&Adapter->PackInfo[status]; - if(psSfInfo->pstSFIndication && copy_to_user(user_buffer, + if (psSfInfo->pstSFIndication && copy_to_user(user_buffer, psSfInfo->pstSFIndication, sizeof(stLocalSFAddIndicationAlt))) { pr_info("copy to user failed SFID %d, present in queue !!!\n", uiSFId); @@ -2453,7 +2453,7 @@ VOID OverrideServiceFlowParams(PMINI_ADAPTER Adapter,PUINT puiBuffer) bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "u32NumofSFsinMsg: 0x%x\n", u32NumofSFsinMsg); - while(u32NumofSFsinMsg != 0 && u32NumofSFsinMsg < NO_OF_QUEUES) { + while (u32NumofSFsinMsg != 0 && u32NumofSFsinMsg < NO_OF_QUEUES) { u32NumofSFsinMsg--; pHostInfo = (stIM_SFHostNotify *)puiBuffer; puiBuffer = (PUINT)(pHostInfo + 1); @@ -2463,14 +2463,14 @@ VOID OverrideServiceFlowParams(PMINI_ADAPTER Adapter,PUINT puiBuffer) bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "SFID: 0x%lx\n", ulSFID); - if(uiSearchRuleIndex >= NO_OF_QUEUES || uiSearchRuleIndex == HiPriority) { + if (uiSearchRuleIndex >= NO_OF_QUEUES || uiSearchRuleIndex == HiPriority) { bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "The SFID <%lx> doesn't exist in host entry or is Invalid\n", ulSFID); continue; } - if(pHostInfo->RetainSF == FALSE) { + if (pHostInfo->RetainSF == FALSE) { bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Going to Delete SF\n"); deleteSFBySfid(Adapter,uiSearchRuleIndex); @@ -2484,11 +2484,11 @@ VOID OverrideServiceFlowParams(PMINI_ADAPTER Adapter,PUINT puiBuffer) "pHostInfo->QoSParamSet: 0x%x\n", pHostInfo->QoSParamSet); - if(pHostInfo->QoSParamSet & 0x1) + if (pHostInfo->QoSParamSet & 0x1) Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet =TRUE; - if(pHostInfo->QoSParamSet & 0x2) + if (pHostInfo->QoSParamSet & 0x2) Adapter->PackInfo[uiSearchRuleIndex].bAdmittedSet =TRUE; - if(pHostInfo->QoSParamSet & 0x4) { + if (pHostInfo->QoSParamSet & 0x4) { Adapter->PackInfo[uiSearchRuleIndex].bActiveSet =TRUE; Adapter->PackInfo[uiSearchRuleIndex].bActive=TRUE; } diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c index 6b2a9a4..b3482cb 100644 --- a/drivers/staging/bcm/DDRInit.c +++ b/drivers/staging/bcm/DDRInit.c @@ -798,7 +798,7 @@ int ddr_init(MINI_ADAPTER *Adapter) psDDRSetting=asT3LP_DDRSetting133MHz; RegCount=(sizeof(asT3LP_DDRSetting133MHz)/ sizeof(DDR_SETTING)); - if(Adapter->bMipsConfig == MIPS_200_MHZ) { + if (Adapter->bMipsConfig == MIPS_200_MHZ) { uiClockSetting = 0x03F13652; } else { uiClockSetting = 0x03F1365B; @@ -817,11 +817,11 @@ int ddr_init(MINI_ADAPTER *Adapter) /* Set bit 2 and bit 6 to 1 for BBIC 2mA drive * (please check current value and additionally set these bits) */ - if( (Adapter->chip_id != BCS220_2) && + if ( (Adapter->chip_id != BCS220_2) && (Adapter->chip_id != BCS220_2BC) && (Adapter->chip_id != BCS220_3) ) { retval= rdmalt(Adapter,(UINT)0x0f000830, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); @@ -829,14 +829,14 @@ int ddr_init(MINI_ADAPTER *Adapter) } uiResetValue |= 0x44; retval = wrmalt(Adapter,(UINT)0x0f000830, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, WRM, ALL, "%s:%d WRM failed\n", __func__, __LINE__); return retval; } } - switch(Adapter->DDRSetting) { + switch (Adapter->DDRSetting) { @@ -855,7 +855,7 @@ int ddr_init(MINI_ADAPTER *Adapter) RegCount=(sizeof(asT3B_DDRSetting133MHz)/ sizeof(DDR_SETTING)); - if(Adapter->bMipsConfig == MIPS_200_MHZ) { + if (Adapter->bMipsConfig == MIPS_200_MHZ) { uiClockSetting = 0x03F13652; } else { uiClockSetting = 0x03F1365B; @@ -866,7 +866,7 @@ int ddr_init(MINI_ADAPTER *Adapter) psDDRSetting = asT3LPB_DDRSetting160MHz; RegCount = sizeof(asT3LPB_DDRSetting160MHz)/sizeof(DDR_SETTING); - if(Adapter->bMipsConfig == MIPS_200_MHZ) { + if (Adapter->bMipsConfig == MIPS_200_MHZ) { uiClockSetting = 0x03F137D2; } else { uiClockSetting = 0x03F137DB; @@ -914,7 +914,7 @@ int ddr_init(MINI_ADAPTER *Adapter) break; case DDR_133_MHZ: - if(Adapter->bDPLLConfig == PLL_266_MHZ)//266Mhz PLL selected. + if (Adapter->bDPLLConfig == PLL_266_MHZ)//266Mhz PLL selected. { memcpy(asT3B_DDRSetting133MHz, asDPLL_266MHZ, sizeof(asDPLL_266MHZ)); @@ -925,7 +925,7 @@ int ddr_init(MINI_ADAPTER *Adapter) psDDRSetting = asT3B_DDRSetting133MHz; RegCount=(sizeof(asT3B_DDRSetting133MHz)/ sizeof(DDR_SETTING)); - if(Adapter->bMipsConfig == MIPS_200_MHZ) { + if (Adapter->bMipsConfig == MIPS_200_MHZ) { uiClockSetting = 0x07F13652; } else { uiClockSetting = 0x07F1365B; @@ -945,14 +945,14 @@ int ddr_init(MINI_ADAPTER *Adapter) value=0; bcm_dbg(Adapter, INITEXIT, DRV_ENTRY, ALL, "Register Count is =%lu\n", RegCount); - while(RegCount && !retval) { - if(uiClockSetting && psDDRSetting->ulRegAddress == MIPS_CLOCK_REG) { + while (RegCount && !retval) { + if (uiClockSetting && psDDRSetting->ulRegAddress == MIPS_CLOCK_REG) { value = uiClockSetting; } else { value = psDDRSetting->ulRegValue; } retval = wrmalt(Adapter, psDDRSetting->ulRegAddress, &value, sizeof(value)); - if(STATUS_SUCCESS != retval) { + if (STATUS_SUCCESS != retval) { pr_info("%s:%d\n", __func__, __LINE__); break; } @@ -961,16 +961,16 @@ int ddr_init(MINI_ADAPTER *Adapter) psDDRSetting++; } - if(Adapter->chip_id >= 0xbece3300 ) { + if (Adapter->chip_id >= 0xbece3300 ) { mdelay(3); - if( (Adapter->chip_id != BCS220_2)&& + if ( (Adapter->chip_id != BCS220_2)&& (Adapter->chip_id != BCS220_2BC)&& (Adapter->chip_id != BCS220_3)) { /* drive MDDR to half in case of UMA-B: */ uiResetValue = 0x01010001; retval = wrmalt(Adapter, (UINT)0x0F007018, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); @@ -978,7 +978,7 @@ int ddr_init(MINI_ADAPTER *Adapter) } uiResetValue = 0x00040020; retval = wrmalt(Adapter, (UINT)0x0F007094, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); @@ -986,7 +986,7 @@ int ddr_init(MINI_ADAPTER *Adapter) } uiResetValue = 0x01020101; retval = wrmalt(Adapter, (UINT)0x0F00701c, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); @@ -994,7 +994,7 @@ int ddr_init(MINI_ADAPTER *Adapter) } uiResetValue = 0x01010000; retval = wrmalt(Adapter, (UINT)0x0F007018, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); @@ -1009,16 +1009,16 @@ int ddr_init(MINI_ADAPTER *Adapter) * and since we dont have internal PMU lets do it under UMA-B chip id. * we will change this when we will have internal PMU. */ - if(Adapter->PmuMode == HYBRID_MODE_7C) { + if (Adapter->PmuMode == HYBRID_MODE_7C) { retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); @@ -1026,20 +1026,20 @@ int ddr_init(MINI_ADAPTER *Adapter) } uiResetValue = 0x1322a8; retval = wrmalt(Adapter, (UINT)0x0f000d1c, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { pr_info("%s:%d RDM failed\n", __func__, __LINE__); return retval; } retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); @@ -1047,23 +1047,23 @@ int ddr_init(MINI_ADAPTER *Adapter) } uiResetValue = 0x132296; retval = wrmalt(Adapter, (UINT)0x0f000d14, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } - } else if(Adapter->PmuMode == HYBRID_MODE_6 ) { + } else if (Adapter->PmuMode == HYBRID_MODE_6 ) { retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); @@ -1071,21 +1071,21 @@ int ddr_init(MINI_ADAPTER *Adapter) } uiResetValue = 0x6003229a; retval = wrmalt(Adapter, (UINT)0x0f000d14, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); return retval; } retval = rdmalt(Adapter,(UINT)0x0f000c00, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); @@ -1093,7 +1093,7 @@ int ddr_init(MINI_ADAPTER *Adapter) } uiResetValue = 0x1322a8; retval = wrmalt(Adapter, (UINT)0x0f000d1c, &uiResetValue, sizeof(uiResetValue)); - if(retval < 0) { + if (retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, "%s:%d RDM failed\n", __func__, __LINE__); @@ -1234,7 +1234,7 @@ int download_ddr_settings(PMINI_ADAPTER Adapter) //total number of Register that has to be dumped value =RegCount ; retval = wrmalt(Adapter, ul_ddr_setting_load_addr, &value, sizeof(value)); - if(retval) { + if (retval) { pr_info("%s:%d\n", __func__, __LINE__); return retval; @@ -1243,7 +1243,7 @@ int download_ddr_settings(PMINI_ADAPTER Adapter) /*signature */ value =(0x1d1e0dd0); retval = wrmalt(Adapter, ul_ddr_setting_load_addr, &value, sizeof(value)); - if(retval) { + if (retval) { pr_info("%s:%d\n", __func__, __LINE__); return retval; } @@ -1251,14 +1251,14 @@ int download_ddr_settings(PMINI_ADAPTER Adapter) ul_ddr_setting_load_addr+=sizeof(ULONG); RegCount*=(sizeof(DDR_SETTING)/sizeof(ULONG)); - while(RegCount && !retval) { + while (RegCount && !retval) { value = psDDRSetting->ulRegAddress ; retval = wrmalt( Adapter, ul_ddr_setting_load_addr, &value, sizeof(value)); ul_ddr_setting_load_addr+=sizeof(ULONG); - if(!retval) { - if(bOverrideSelfRefresh && (psDDRSetting->ulRegAddress == 0x0F007018)) { + if (!retval) { + if (bOverrideSelfRefresh && (psDDRSetting->ulRegAddress == 0x0F007018)) { value = (psDDRSetting->ulRegValue |(1<<8)); - if(STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr, + if (STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr, &value, sizeof(value))){ pr_info("%s:%d\n", __func__, __LINE__); break; @@ -1266,7 +1266,7 @@ int download_ddr_settings(PMINI_ADAPTER Adapter) } else { value = psDDRSetting->ulRegValue; - if(STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr , + if (STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr , &value, sizeof(value))){ pr_info("%s:%d\n", __func__, __LINE__); break; diff --git a/drivers/staging/bcm/IPv6Protocol.c b/drivers/staging/bcm/IPv6Protocol.c index 8e24671..5f341b5 100644 --- a/drivers/staging/bcm/IPv6Protocol.c +++ b/drivers/staging/bcm/IPv6Protocol.c @@ -11,7 +11,7 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader USHORT usNextHeaderOffset = 0 ; PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - if((NULL == ppucPayload) || (*pusPayloadLength == 0) || (*bParseDone)) { + if ((NULL == ppucPayload) || (*pusPayloadLength == 0) || (*bParseDone)) { *bParseDone = TRUE; return NULL; @@ -20,7 +20,7 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader pucRetHeaderPtr = *ppucPayload; pucPayloadPtr = *ppucPayload; - if(!pucRetHeaderPtr || !pucPayloadPtr) { + if (!pucRetHeaderPtr || !pucPayloadPtr) { *bParseDone = TRUE; return NULL; } @@ -30,7 +30,7 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader - switch(*pucNextHeader) { + switch (*pucNextHeader) { case IPV6HDR_TYPE_HOPBYHOP: { bcm_dbg(Adapter, TX, IPV6_DBG, ALL, @@ -106,8 +106,8 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader } - if(*bParseDone == FALSE) { - if(*pusPayloadLength <= usNextHeaderOffset) { + if (*bParseDone == FALSE) { + if (*pusPayloadLength <= usNextHeaderOffset) { *bParseDone = TRUE; } else { *pucNextHeader = *pucPayloadPtr; @@ -132,16 +132,16 @@ static UCHAR GetIpv6ProtocolPorts(UCHAR *pucPayload,USHORT *pusSrcPort,USHORT *p UCHAR *pucNextHeader = NULL; PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - if( !pucPayload || (usPayloadLength == 0)) { + if ( !pucPayload || (usPayloadLength == 0)) { return 0; } *pusSrcPort = *pusDestPort = 0; ucHeaderType = ucNextHeader; - while(!bDone) { + while (!bDone) { pucNextHeader = GetNextIPV6ChainedHeader(&pIpv6HdrScanContext,&ucHeaderType,&bDone,&usPayloadLength); - if(bDone) { - if((ucHeaderType==TCP_HEADER_TYPE) || (ucHeaderType == UDP_HEADER_TYPE)) { + if (bDone) { + if ((ucHeaderType==TCP_HEADER_TYPE) || (ucHeaderType == UDP_HEADER_TYPE)) { *pusSrcPort=*((PUSHORT)(pucNextHeader)); *pusDestPort=*((PUSHORT)(pucNextHeader+2)); bcm_dbg(Adapter, TX, IPV6_DBG, ALL, @@ -183,37 +183,37 @@ USHORT IpVersion6(PMINI_ADAPTER Adapter, /**< Pointer to the driver control stru do { - if(0 == pstClassifierRule->ucDirection) { + if (0 == pstClassifierRule->ucDirection) { //cannot be processed for classification. // it is a down link connection break; } - if(!pstClassifierRule->bIpv6Protocol) { + if (!pstClassifierRule->bIpv6Protocol) { //We are looking for Ipv6 Classifiers . Lets ignore this classifier and try the next one. break; } bClassificationSucceed=MatchSrcIpv6Address(pstClassifierRule,pstIpv6Header); - if(!bClassificationSucceed) + if (!bClassificationSucceed) break; bClassificationSucceed=MatchDestIpv6Address(pstClassifierRule,pstIpv6Header); - if(!bClassificationSucceed) + if (!bClassificationSucceed) break; //Match the protocol type.For IPv6 the next protocol at end of Chain of IPv6 prot headers bClassificationSucceed=MatchProtocol(pstClassifierRule,ucNextProtocolAboveIP); - if(!bClassificationSucceed) + if (!bClassificationSucceed) break; bcm_dbg(Adapter, TX, IPV6_DBG, ALL, "IPv6 Protocol Matched\n"); - if((ucNextProtocolAboveIP == TCP_HEADER_TYPE) || (ucNextProtocolAboveIP == UDP_HEADER_TYPE)) { + if ((ucNextProtocolAboveIP == TCP_HEADER_TYPE) || (ucNextProtocolAboveIP == UDP_HEADER_TYPE)) { //Match Src Port bcm_dbg(Adapter, TX, IPV6_DBG, ALL, "IPv6 Source Port:%x\n", ntohs(ushSrcPort)); bClassificationSucceed=MatchSrcPort(pstClassifierRule,ntohs(ushSrcPort)); - if(!bClassificationSucceed) + if (!bClassificationSucceed) break; bcm_dbg(Adapter, TX, IPV6_DBG, ALL, @@ -224,20 +224,20 @@ USHORT IpVersion6(PMINI_ADAPTER Adapter, /**< Pointer to the driver control stru "IPv6 Destination Port:%x\n", ntohs(ushDestPort)); bClassificationSucceed=MatchDestPort(pstClassifierRule,ntohs(ushDestPort)); - if(!bClassificationSucceed) + if (!bClassificationSucceed) break; bcm_dbg(Adapter, TX, IPV6_DBG, ALL, "IPv6 Dest Port Matched\n"); } - }while(0); + }while (0); - if(TRUE==bClassificationSucceed) { + if (TRUE==bClassificationSucceed) { INT iMatchedSFQueueIndex = 0; iMatchedSFQueueIndex = SearchSfid(Adapter,pstClassifierRule->ulSFID); - if(iMatchedSFQueueIndex >= NO_OF_QUEUES) { + if (iMatchedSFQueueIndex >= NO_OF_QUEUES) { bClassificationSucceed = FALSE; } else { - if(FALSE == Adapter->PackInfo[iMatchedSFQueueIndex].bActive) { + if (FALSE == Adapter->PackInfo[iMatchedSFQueueIndex].bActive) { bClassificationSucceed = FALSE; } } @@ -261,16 +261,16 @@ static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,IPV6Head UINT uiCountIPSrcAddresses = (UINT)pstClassifierRule->ucIPSourceAddressLength; - if(0 == uiCountIPSrcAddresses) + if (0 == uiCountIPSrcAddresses) return TRUE; //First Convert the Ip Address in the packet to Host Endian order - for(uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) { + for (uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) { aulSrcIP[uiIpv6AddIndex]=ntohl(pstIpv6Header->ulSrcIpAddress[uiIpv6AddIndex]); } - for(uiLoopIndex=0;uiLoopIndex<uiCountIPSrcAddresses;uiLoopIndex+=uiIpv6AddrNoLongWords) { + for (uiLoopIndex=0;uiLoopIndex<uiCountIPSrcAddresses;uiLoopIndex+=uiIpv6AddrNoLongWords) { bcm_dbg(Adapter, TX, IPV6_DBG, ALL, "Src Ipv6 Address In Received Packet :\n"); DumpIpv6Address(aulSrcIP); @@ -281,14 +281,14 @@ static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,IPV6Head "Src Ipv6 Address In Classifier Rule :\n"); DumpIpv6Address(&pstClassifierRule->stSrcIpAddress.ulIpv6Addr[uiLoopIndex]); - for(uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) { - if((pstClassifierRule->stSrcIpAddress.ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & aulSrcIP[uiIpv6AddIndex]) + for (uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) { + if ((pstClassifierRule->stSrcIpAddress.ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & aulSrcIP[uiIpv6AddIndex]) != pstClassifierRule->stSrcIpAddress.ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) { //Match failed for current Ipv6 Address.Try next Ipv6 Address break; } - if(uiIpv6AddIndex == uiIpv6AddrNoLongWords-1) { + if (uiIpv6AddIndex == uiIpv6AddrNoLongWords-1) { //Match Found bcm_dbg(Adapter, TX, IPV6_DBG, ALL, "Ipv6 Src Ip Address Matched\n"); @@ -313,16 +313,16 @@ static BOOLEAN MatchDestIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,IPV6Hea UINT uiCountIPDestinationAddresses = (UINT)pstClassifierRule->ucIPDestinationAddressLength; - if(0 == uiCountIPDestinationAddresses) + if (0 == uiCountIPDestinationAddresses) return TRUE; //First Convert the Ip Address in the packet to Host Endian order - for(uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) { + for (uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) { aulDestIP[uiIpv6AddIndex]=ntohl(pstIpv6Header->ulDestIpAddress[uiIpv6AddIndex]); } - for(uiLoopIndex=0;uiLoopIndex<uiCountIPDestinationAddresses;uiLoopIndex+=uiIpv6AddrNoLongWords) { + for (uiLoopIndex=0;uiLoopIndex<uiCountIPDestinationAddresses;uiLoopIndex+=uiIpv6AddrNoLongWords) { bcm_dbg(Adapter, TX, IPV6_DBG, ALL, "Destination Ipv6 Address In Received Packet :\n"); DumpIpv6Address(aulDestIP); @@ -333,14 +333,14 @@ static BOOLEAN MatchDestIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,IPV6Hea "Destination Ipv6 Address In Classifier Rule :\n"); DumpIpv6Address(&pstClassifierRule->stDestIpAddress.ulIpv6Addr[uiLoopIndex]); - for(uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) { - if((pstClassifierRule->stDestIpAddress.ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & aulDestIP[uiIpv6AddIndex]) + for (uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) { + if ((pstClassifierRule->stDestIpAddress.ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & aulDestIP[uiIpv6AddIndex]) != pstClassifierRule->stDestIpAddress.ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) { //Match failed for current Ipv6 Address.Try next Ipv6 Address break; } - if(uiIpv6AddIndex == uiIpv6AddrNoLongWords-1) { + if (uiIpv6AddIndex == uiIpv6AddrNoLongWords-1) { //Match Found bcm_dbg(Adapter, TX, IPV6_DBG, ALL, "Ipv6 Destination Ip Address Matched\n"); @@ -357,7 +357,7 @@ VOID DumpIpv6Address(ULONG *puIpv6Address) UINT uiIpv6AddrNoLongWords = 4; UINT uiIpv6AddIndex=0; PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - for(uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) { + for (uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) { bcm_dbg(Adapter, TX, IPV6_DBG, ALL, ":%lx\n", puIpv6Address[uiIpv6AddIndex]); } diff --git a/drivers/staging/bcm/InterfaceDld.c b/drivers/staging/bcm/InterfaceDld.c index 167428b..049b46e 100644 --- a/drivers/staging/bcm/InterfaceDld.c +++ b/drivers/staging/bcm/InterfaceDld.c @@ -141,7 +141,7 @@ int InterfaceFileReadbackFromChip(PVOID arg, struct file *flp, unsigned int on_c } } on_chip_loc += MAX_TRANSFER_CTRL_BYTE_USB; - } /* End of while(1) */ + } /* End of while (1) */ exit: kfree(buff); diff --git a/drivers/staging/bcm/InterfaceIdleMode.c b/drivers/staging/bcm/InterfaceIdleMode.c index 0d54eaf..823be06 100644 --- a/drivers/staging/bcm/InterfaceIdleMode.c +++ b/drivers/staging/bcm/InterfaceIdleMode.c @@ -51,29 +51,29 @@ int InterfaceIdleModeRespond(PMINI_ADAPTER Adapter, unsigned int* puiBuffer) bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "SubType of Message :0x%X\n", ntohl(*puiBuffer)); - if(ntohl(*puiBuffer) == GO_TO_IDLE_MODE_PAYLOAD) { + if (ntohl(*puiBuffer) == GO_TO_IDLE_MODE_PAYLOAD) { bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "Got GO_TO_IDLE_MODE_PAYLOAD(210) Msg Subtype\n"); - if(ntohl(*(puiBuffer+1)) == 0 ) { + if (ntohl(*(puiBuffer+1)) == 0 ) { bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "Got IDLE MODE WAKE UP Response From F/W\n"); status = wrmalt (Adapter,SW_ABORT_IDLEMODE_LOC, &uiRegRead, sizeof(uiRegRead)); - if(status) { + if (status) { pr_info("wrm failed while clearing Idle Mode Reg\n"); return status; } - if(Adapter->ulPowerSaveMode == DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) { + if (Adapter->ulPowerSaveMode == DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) { uiRegRead = 0x00000000 ; status = wrmalt (Adapter,DEBUG_INTERRUPT_GENERATOR_REGISTOR, &uiRegRead, sizeof(uiRegRead)); - if(status) { + if (status) { pr_info("wrm failed while clearing Idle Mode Reg\n"); return status; } } //Below Register should not br read in case of Manual and Protocol Idle mode. - else if(Adapter->ulPowerSaveMode != DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE) { + else if (Adapter->ulPowerSaveMode != DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE) { //clear on read Register bytes = rdmalt(Adapter, DEVICE_INT_OUT_EP_REG0, &uiRegRead, sizeof(uiRegRead)); if (bytes < 0) { @@ -99,7 +99,7 @@ int InterfaceIdleModeRespond(PMINI_ADAPTER Adapter, unsigned int* puiBuffer) wake_up(&Adapter->lowpower_mode_wait_queue); } else { - if(TRUE == Adapter->IdleMode) { + if (TRUE == Adapter->IdleMode) { bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "Device is already in Idle mode....\n"); return status ; @@ -126,7 +126,7 @@ int InterfaceIdleModeRespond(PMINI_ADAPTER Adapter, unsigned int* puiBuffer) uiRegRead |= (1<<17); status = wrmalt (Adapter,HPM_CONFIG_MSW, &uiRegRead, sizeof(uiRegRead)); - if(status) { + if (status) { pr_info("wrm failed while clearing Idle Mode Reg\n"); return status; } @@ -134,7 +134,7 @@ int InterfaceIdleModeRespond(PMINI_ADAPTER Adapter, unsigned int* puiBuffer) } SendIdleModeResponse(Adapter); } - } else if(ntohl(*puiBuffer) == IDLE_MODE_SF_UPDATE_MSG) { + } else if (ntohl(*puiBuffer) == IDLE_MODE_SF_UPDATE_MSG) { bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "OverRiding Service Flow Params\n"); OverrideServiceFlowParams(Adapter,puiBuffer); @@ -154,7 +154,7 @@ static int InterfaceAbortIdlemode(PMINI_ADAPTER Adapter, unsigned int Pattern) PS_INTERFACE_ADAPTER psInterfaceAdapter = Adapter->pvInterfaceAdapter; //Abort Bus suspend if its already suspended - if((TRUE == psInterfaceAdapter->bSuspended) && (TRUE == Adapter->bDoSuspend)) { + if ((TRUE == psInterfaceAdapter->bSuspended) && (TRUE == Adapter->bDoSuspend)) { status = usb_autopm_get_interface(psInterfaceAdapter->interface); bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "Bus got wakeup..Aborting Idle mode... status:%d\n", @@ -162,7 +162,7 @@ static int InterfaceAbortIdlemode(PMINI_ADAPTER Adapter, unsigned int Pattern) } - if((Adapter->ulPowerSaveMode == DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) + if ((Adapter->ulPowerSaveMode == DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) || (Adapter->ulPowerSaveMode == DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE)) { //write the SW abort pattern. @@ -170,22 +170,22 @@ static int InterfaceAbortIdlemode(PMINI_ADAPTER Adapter, unsigned int Pattern) "Writing pattern<%d> to SW_ABORT_IDLEMODE_LOC\n", Pattern); status = wrmalt(Adapter,SW_ABORT_IDLEMODE_LOC, &Pattern, sizeof(Pattern)); - if(status) { + if (status) { bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "WRM to Register SW_ABORT_IDLEMODE_LOC failed..\n"); return status; } } - if(Adapter->ulPowerSaveMode == DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) { + if (Adapter->ulPowerSaveMode == DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) { value = 0x80000000; status = wrmalt(Adapter,DEBUG_INTERRUPT_GENERATOR_REGISTOR, &value, sizeof(value)); - if(status) { + if (status) { bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "WRM to DEBUG_INTERRUPT_GENERATOR_REGISTOR Register failed\n"); return status; } - } else if(Adapter->ulPowerSaveMode != DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE) { + } else if (Adapter->ulPowerSaveMode != DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE) { /* * Get a Interrupt Out URB and send 8 Bytes Down * To be Done in Thread Context. @@ -198,7 +198,7 @@ static int InterfaceAbortIdlemode(PMINI_ADAPTER Adapter, unsigned int Pattern) 8, &lenwritten, 5000); - if(status) { + if (status) { bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "Sending Abort pattern down fails with status:%d..\n", status); @@ -211,16 +211,16 @@ static int InterfaceAbortIdlemode(PMINI_ADAPTER Adapter, unsigned int Pattern) //mdelay(25); timeout= jiffies + msecs_to_jiffies(50) ; - while( timeout > jiffies ) { + while ( timeout > jiffies ) { itr++ ; rdmalt(Adapter, CHIP_ID_REG, &chip_id, sizeof(UINT)); - if(0xbece3200==(chip_id&~(0xF0))) { + if (0xbece3200==(chip_id&~(0xF0))) { chip_id = chip_id&~(0xF0); } - if(chip_id == Adapter->chip_id) + if (chip_id == Adapter->chip_id) break; } - if(timeout < jiffies ) { + if (timeout < jiffies ) { bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "Not able to read chip-id even after 25 msec\n"); } else { @@ -230,7 +230,7 @@ static int InterfaceAbortIdlemode(PMINI_ADAPTER Adapter, unsigned int Pattern) } status = wrmalt(Adapter,SW_ABORT_IDLEMODE_LOC, &Pattern, sizeof(status)); - if(status) { + if (status) { pr_info("WRM to Register SW_ABORT_IDLEMODE_LOC failed..\n"); return status; } @@ -240,7 +240,7 @@ static int InterfaceAbortIdlemode(PMINI_ADAPTER Adapter, unsigned int Pattern) int InterfaceIdleModeWakeup(PMINI_ADAPTER Adapter) { ULONG Status = 0; - if(Adapter->bTriedToWakeUpFromlowPowerMode) { + if (Adapter->bTriedToWakeUpFromlowPowerMode) { bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "Wake up already attempted.. ignoring\n"); } else { @@ -259,11 +259,11 @@ void InterfaceHandleShutdownModeWakeup(PMINI_ADAPTER Adapter) INT Status = 0; int bytes; - if(Adapter->ulPowerSaveMode == DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) { + if (Adapter->ulPowerSaveMode == DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) { // clear idlemode interrupt. uiRegVal = 0; Status =wrmalt(Adapter,DEBUG_INTERRUPT_GENERATOR_REGISTOR, &uiRegVal, sizeof(uiRegVal)); - if(Status) { + if (Status) { pr_info("WRM to DEBUG_INTERRUPT_GENERATOR_REGISTOR Failed with err :%d\n", Status); return; diff --git a/drivers/staging/bcm/InterfaceIsr.c b/drivers/staging/bcm/InterfaceIsr.c index 1842d3a..c58c1d7 100644 --- a/drivers/staging/bcm/InterfaceIsr.c +++ b/drivers/staging/bcm/InterfaceIsr.c @@ -11,13 +11,13 @@ static void read_int_callback(struct urb *urb/*, struct pt_regs *regs*/) pr_info("%s: interrupt status %d\n", Adapter->dev->name, status); - if(Adapter->device_removed == TRUE) { + if (Adapter->device_removed == TRUE) { bcm_dbg(Adapter, OTHERS, INTF_INIT, ALL, "Device has Got Removed.\n"); return ; } - if(((Adapter->bPreparingForLowPowerMode == TRUE) && (Adapter->bDoSuspend == TRUE)) || + if (((Adapter->bPreparingForLowPowerMode == TRUE) && (Adapter->bDoSuspend == TRUE)) || psIntfAdapter->bSuspended || psIntfAdapter->bPreparingForBusSuspend) { bcm_dbg(Adapter, OTHERS, INTF_INIT, ALL, @@ -32,12 +32,12 @@ static void read_int_callback(struct urb *urb/*, struct pt_regs *regs*/) case STATUS_SUCCESS: if ( urb->actual_length ) { - if(psIntfAdapter->ulInterruptData[1] & 0xFF) { + if (psIntfAdapter->ulInterruptData[1] & 0xFF) { bcm_dbg(Adapter, OTHERS, INTF_INIT, ALL, "Got USIM interrupt\n"); } - if(psIntfAdapter->ulInterruptData[1] & 0xFF00) { + if (psIntfAdapter->ulInterruptData[1] & 0xFF00) { atomic_set(&Adapter->CurrNumFreeTxDesc, (psIntfAdapter->ulInterruptData[1] & 0xFF00) >> 8); atomic_set (&Adapter->uiMBupdate, TRUE); @@ -45,7 +45,7 @@ static void read_int_callback(struct urb *urb/*, struct pt_regs *regs*/) "TX mailbox contains %d\n", atomic_read(&Adapter->CurrNumFreeTxDesc)); } - if(psIntfAdapter->ulInterruptData[1] >> 16) { + if (psIntfAdapter->ulInterruptData[1] >> 16) { Adapter->CurrNumRecvDescs= (psIntfAdapter->ulInterruptData[1] >> 16); bcm_dbg(Adapter, OTHERS, INTF_INIT, ALL, @@ -53,17 +53,17 @@ static void read_int_callback(struct urb *urb/*, struct pt_regs *regs*/) Adapter->CurrNumRecvDescs); InterfaceRx(psIntfAdapter); } - if(Adapter->fw_download_done && + if (Adapter->fw_download_done && !Adapter->downloadDDR && atomic_read(&Adapter->CurrNumFreeTxDesc)) { psIntfAdapter->psAdapter->downloadDDR +=1; wake_up(&Adapter->tx_packet_wait_queue); } - if(FALSE == Adapter->waiting_to_fw_download_done) { + if (FALSE == Adapter->waiting_to_fw_download_done) { Adapter->waiting_to_fw_download_done = TRUE; wake_up(&Adapter->ioctl_fw_dnld_wait_queue); } - if(!atomic_read(&Adapter->TxPktAvail)) { + if (!atomic_read(&Adapter->TxPktAvail)) { atomic_set(&Adapter->TxPktAvail, 1); wake_up(&Adapter->tx_packet_wait_queue); } @@ -152,7 +152,7 @@ INT StartInterruptUrb(PS_INTERFACE_ADAPTER psIntfAdapter) { INT status = 0; - if( FALSE == psIntfAdapter->psAdapter->device_removed && + if ( FALSE == psIntfAdapter->psAdapter->device_removed && FALSE == psIntfAdapter->psAdapter->bEndPointHalted && FALSE == psIntfAdapter->bSuspended && FALSE == psIntfAdapter->bPreparingForBusSuspend && @@ -162,7 +162,7 @@ INT StartInterruptUrb(PS_INTERFACE_ADAPTER psIntfAdapter) bcm_dbg(psIntfAdapter->psAdapter, OTHERS, INTF_INIT, ALL, "Cannot send int urb %d\n", status); - if(status == -EPIPE) { + if (status == -EPIPE) { psIntfAdapter->psAdapter->bEndPointHalted = TRUE ; wake_up(&psIntfAdapter->psAdapter->tx_packet_wait_queue); } diff --git a/drivers/staging/bcm/InterfaceRx.c b/drivers/staging/bcm/InterfaceRx.c index 31e50ee..7bf351c 100644 --- a/drivers/staging/bcm/InterfaceRx.c +++ b/drivers/staging/bcm/InterfaceRx.c @@ -4,8 +4,8 @@ static int SearchVcid(PMINI_ADAPTER Adapter,unsigned short usVcid) { int iIndex=0; - for(iIndex=(NO_OF_QUEUES-1);iIndex>=0;iIndex--) - if(Adapter->PackInfo[iIndex].usVCID_Value == usVcid) + for (iIndex=(NO_OF_QUEUES-1);iIndex>=0;iIndex--) + if (Adapter->PackInfo[iIndex].usVCID_Value == usVcid) return iIndex; return NO_OF_QUEUES+1; @@ -18,7 +18,7 @@ GetBulkInRcb(PS_INTERFACE_ADAPTER psIntfAdapter) PUSB_RCB pRcb = NULL; UINT index = 0; - if((atomic_read(&psIntfAdapter->uNumRcbUsed) < MAXIMUM_USB_RCB) && + if ((atomic_read(&psIntfAdapter->uNumRcbUsed) < MAXIMUM_USB_RCB) && (psIntfAdapter->psAdapter->StopAllXaction == FALSE)) { index = atomic_read(&psIntfAdapter->uCurrRcb); pRcb = &psIntfAdapter->asUsbRcb[index]; @@ -52,7 +52,7 @@ static void read_bulk_callback(struct urb *urb) pr_info("%s: rx urb status %d length %d\n", Adapter->dev->name, urb->status, urb->actual_length); - if((Adapter->device_removed == TRUE) || + if ((Adapter->device_removed == TRUE) || (TRUE == Adapter->bEndPointHalted) || (0 == urb->actual_length) ) { @@ -61,8 +61,8 @@ static void read_bulk_callback(struct urb *urb) return; } - if(urb->status != STATUS_SUCCESS) { - if(urb->status == -EPIPE) { + if (urb->status != STATUS_SUCCESS) { + if (urb->status == -EPIPE) { Adapter->bEndPointHalted = TRUE ; wake_up(&Adapter->tx_packet_wait_queue); } else { @@ -76,7 +76,7 @@ static void read_bulk_callback(struct urb *urb) return ; } - if(Adapter->bDoSuspend && (Adapter->bPreparingForLowPowerMode)) { + if (Adapter->bDoSuspend && (Adapter->bPreparingForLowPowerMode)) { bcm_dbg(Adapter, RX, RX_DPC, ALL, "device is going in low power mode while PMU option selected..hence rx packet should not be process\n"); return ; @@ -84,7 +84,7 @@ static void read_bulk_callback(struct urb *urb) bcm_dbg(Adapter, RX, RX_DPC, ALL, "Read back done len %d\n", pLeader->PLength); - if(!pLeader->PLength) { + if (!pLeader->PLength) { bcm_dbg(Adapter, RX, RX_DPC, ALL, "Leader Length 0\n"); atomic_dec(&psIntfAdapter->uNumRcbUsed); return; @@ -92,7 +92,7 @@ static void read_bulk_callback(struct urb *urb) bcm_dbg(Adapter, RX, RX_DPC, ALL, "Leader Status:0x%hX, Length:0x%hX, VCID:0x%hX\n", pLeader->Status, pLeader->PLength, pLeader->Vcid); - if(MAX_CNTL_PKT_SIZE < pLeader->PLength) { + if (MAX_CNTL_PKT_SIZE < pLeader->PLength) { if (netif_msg_rx_err(Adapter)) pr_info("%s: corrupted leader length...%d\n", Adapter->dev->name, pLeader->PLength); @@ -102,7 +102,7 @@ static void read_bulk_callback(struct urb *urb) } QueueIndex = SearchVcid( Adapter,pLeader->Vcid); - if(QueueIndex < NO_OF_QUEUES) { + if (QueueIndex < NO_OF_QUEUES) { bHeaderSupressionEnabled = Adapter->PackInfo[QueueIndex].bHeaderSuppressionEnabled; bHeaderSupressionEnabled = @@ -110,13 +110,13 @@ static void read_bulk_callback(struct urb *urb) } skb = dev_alloc_skb (pLeader->PLength + SKB_RESERVE_PHS_BYTES + SKB_RESERVE_ETHERNET_HEADER);//2 //2 for allignment - if(!skb) { + if (!skb) { pr_info("NO SKBUFF!!! Dropping the Packet\n"); atomic_dec(&psIntfAdapter->uNumRcbUsed); return; } /* If it is a control Packet, then call handle_bcm_packet ()*/ - if((ntohs(pLeader->Vcid) == VCID_CONTROL_PACKET) || + if ((ntohs(pLeader->Vcid) == VCID_CONTROL_PACKET) || (!(pLeader->Status >= 0x20 && pLeader->Status <= 0x3F))) { bcm_dbg(psIntfAdapter->psAdapter, RX, RX_CTRL, ALL, "Received control pkt...\n"); @@ -149,13 +149,13 @@ static void read_bulk_callback(struct urb *urb) bcm_dbg(psIntfAdapter->psAdapter, RX, RX_DATA, ALL, "Received Data pkt of len :0x%X\n", pLeader->PLength); - if(netif_running(Adapter->dev)) { + if (netif_running(Adapter->dev)) { /* Moving ahead by ETH_HLEN to the data ptr as received from FW */ skb_pull(skb, ETH_HLEN); PHSReceive(Adapter, pLeader->Vcid, skb, &skb->len, NULL,bHeaderSupressionEnabled); - if(!Adapter->PackInfo[QueueIndex].bEthCSSupport) { + if (!Adapter->PackInfo[QueueIndex].bEthCSSupport) { skb_push(skb, ETH_HLEN); memcpy(skb->data, skb->dev->dev_addr, 6); @@ -177,8 +177,8 @@ static void read_bulk_callback(struct urb *urb) ++Adapter->dev->stats.rx_packets; Adapter->dev->stats.rx_bytes += pLeader->PLength; - for(uiIndex = 0 ; uiIndex < MIBS_MAX_HIST_ENTRIES ; uiIndex++) { - if((pLeader->PLength <= MIBS_PKTSIZEHIST_RANGE*(uiIndex+1)) + for (uiIndex = 0 ; uiIndex < MIBS_MAX_HIST_ENTRIES ; uiIndex++) { + if ((pLeader->PLength <= MIBS_PKTSIZEHIST_RANGE*(uiIndex+1)) && (pLeader->PLength > MIBS_PKTSIZEHIST_RANGE*(uiIndex))) Adapter->aRxPktSizeHist[uiIndex]++; } @@ -197,7 +197,7 @@ static int ReceiveRcb(PS_INTERFACE_ADAPTER psIntfAdapter, PUSB_RCB pRcb) psIntfAdapter->udev, psIntfAdapter->sBulkIn.bulk_in_endpointAddr), urb->transfer_buffer, BCM_USB_MAX_READ_LENGTH, read_bulk_callback, pRcb); - if(FALSE == psIntfAdapter->psAdapter->device_removed && + if (FALSE == psIntfAdapter->psAdapter->device_removed && FALSE == psIntfAdapter->psAdapter->bEndPointHalted && FALSE == psIntfAdapter->bSuspended && FALSE == psIntfAdapter->bPreparingForBusSuspend) { @@ -207,7 +207,7 @@ static int ReceiveRcb(PS_INTERFACE_ADAPTER psIntfAdapter, PUSB_RCB pRcb) "failed submitting read urb, error %d\n", retval); //if this return value is because of pipe halt. need to clear this. - if(retval == -EPIPE) { + if (retval == -EPIPE) { psIntfAdapter->psAdapter->bEndPointHalted = TRUE ; wake_up(&psIntfAdapter->psAdapter->tx_packet_wait_queue); } @@ -238,9 +238,9 @@ BOOLEAN InterfaceRx (PS_INTERFACE_ADAPTER psIntfAdapter) // RxDescCount = psIntfAdapter->psAdapter->CurrNumRecvDescs - // psIntfAdapter->psAdapter->PrevNumRecvDescs; - while(RxDescCount) { + while (RxDescCount) { pRcb = GetBulkInRcb(psIntfAdapter); - if(pRcb == NULL) { + if (pRcb == NULL) { pr_info("Unable to get Rcb pointer\n"); return FALSE; } diff --git a/drivers/staging/bcm/InterfaceTx.c b/drivers/staging/bcm/InterfaceTx.c index a4fed36..171d09f 100644 --- a/drivers/staging/bcm/InterfaceTx.c +++ b/drivers/staging/bcm/InterfaceTx.c @@ -13,8 +13,8 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/) if (unlikely(netif_msg_tx_done(Adapter))) pr_info("%s: transmit status %d\n", Adapter->dev->name, urb->status); - if(urb->status != STATUS_SUCCESS) { - if(urb->status == -EPIPE) { + if (urb->status != STATUS_SUCCESS) { + if (urb->status == -EPIPE) { psIntfAdapter->psAdapter->bEndPointHalted = TRUE ; wake_up(&psIntfAdapter->psAdapter->tx_packet_wait_queue); } else { @@ -29,15 +29,15 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/) - if(TRUE == psAdapter->bPreparingForLowPowerMode) { + if (TRUE == psAdapter->bPreparingForLowPowerMode) { - if(((pControlMsg->szData[0] == GO_TO_IDLE_MODE_PAYLOAD) && + if (((pControlMsg->szData[0] == GO_TO_IDLE_MODE_PAYLOAD) && (pControlMsg->szData[1] == TARGET_CAN_GO_TO_IDLE_MODE))) { bpowerDownMsg = TRUE ; //This covers the bus err while Idle Request msg sent down. - if(urb->status != STATUS_SUCCESS) { + if (urb->status != STATUS_SUCCESS) { psAdapter->bPreparingForLowPowerMode = FALSE ; bcm_dbg(Adapter, TX, NEXT_SEND, ALL, "Idle Mode Request msg failed to reach to Modem\n"); @@ -47,7 +47,7 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/) goto err_exit; } - if(psAdapter->bDoSuspend == FALSE) { + if (psAdapter->bDoSuspend == FALSE) { psAdapter->IdleMode = TRUE; //since going in Idle mode completed hence making this var false; psAdapter->bPreparingForLowPowerMode = FALSE ; @@ -58,12 +58,12 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/) wake_up(&psAdapter->lowpower_mode_wait_queue); } - } else if((pControlMsg->Leader.Status == LINK_UP_CONTROL_REQ) && + } else if ((pControlMsg->Leader.Status == LINK_UP_CONTROL_REQ) && (pControlMsg->szData[0] == LINK_UP_ACK) && (pControlMsg->szData[1] == LINK_SHUTDOWN_REQ_FROM_FIRMWARE) && (pControlMsg->szData[2] == SHUTDOWN_ACK_FROM_DRIVER)) { //This covers the bus err while shutdown Request msg sent down. - if(urb->status != STATUS_SUCCESS) { + if (urb->status != STATUS_SUCCESS) { psAdapter->bPreparingForLowPowerMode = FALSE ; bcm_dbg(Adapter, TX, NEXT_SEND, ALL, "Shutdown Request Msg failed to reach to Modem\n"); @@ -74,7 +74,7 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/) } bpowerDownMsg = TRUE ; - if(psAdapter->bDoSuspend == FALSE) { + if (psAdapter->bDoSuspend == FALSE) { psAdapter->bShutStatus = TRUE; //since going in shutdown mode completed hence making this var false; psAdapter->bPreparingForLowPowerMode = FALSE ; @@ -85,7 +85,7 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/) } } - if(psAdapter->bDoSuspend && bpowerDownMsg) { + if (psAdapter->bDoSuspend && bpowerDownMsg) { //issuing bus suspend request bcm_dbg(Adapter, TX, NEXT_SEND, ALL, "Issuing the Bus suspend request to USB stack\n"); @@ -107,7 +107,7 @@ static PUSB_TCB GetBulkOutTcb(PS_INTERFACE_ADAPTER psIntfAdapter) PUSB_TCB pTcb = NULL; UINT index = 0; - if((atomic_read(&psIntfAdapter->uNumTcbUsed) < MAXIMUM_USB_TCB) && + if ((atomic_read(&psIntfAdapter->uNumTcbUsed) < MAXIMUM_USB_TCB) && (psIntfAdapter->psAdapter->StopAllXaction ==FALSE)) { index = atomic_read(&psIntfAdapter->uCurrTcb); pTcb = &psIntfAdapter->asUsbTcb[index]; @@ -141,7 +141,7 @@ static int TransmitTcb(PS_INTERFACE_ADAPTER psIntfAdapter, PUSB_TCB pTcb, PVOID bcm_dbg(psIntfAdapter->psAdapter, TX, NEXT_SEND, ALL, "Sending Bulk out packet\n"); //For T3B,INT OUT end point will be used as bulk out end point - if((psIntfAdapter->psAdapter->chip_id == T3B) && (psIntfAdapter->bHighSpeedDevice == TRUE)) { + if ((psIntfAdapter->psAdapter->chip_id == T3B) && (psIntfAdapter->bHighSpeedDevice == TRUE)) { usb_fill_int_urb(urb, psIntfAdapter->udev, psIntfAdapter->sBulkOut.bulk_out_pipe, urb->transfer_buffer, len, write_bulk_callback, pTcb, @@ -153,7 +153,7 @@ static int TransmitTcb(PS_INTERFACE_ADAPTER psIntfAdapter, PUSB_TCB pTcb, PVOID } urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; /* For DMA transfer */ - if(FALSE == psIntfAdapter->psAdapter->device_removed && + if (FALSE == psIntfAdapter->psAdapter->device_removed && FALSE == psIntfAdapter->psAdapter->bEndPointHalted && FALSE == psIntfAdapter->bSuspended && FALSE == psIntfAdapter->bPreparingForBusSuspend) { @@ -162,7 +162,7 @@ static int TransmitTcb(PS_INTERFACE_ADAPTER psIntfAdapter, PUSB_TCB pTcb, PVOID bcm_dbg(psIntfAdapter->psAdapter, TX, NEXT_SEND, ALL, "failed submitting write urb, error %d\n", retval); - if(retval == -EPIPE) { + if (retval == -EPIPE) { psIntfAdapter->psAdapter->bEndPointHalted = TRUE ; wake_up(&psIntfAdapter->psAdapter->tx_packet_wait_queue); } @@ -177,7 +177,7 @@ int InterfaceTransmitPacket(PVOID arg, PVOID data, UINT len) PS_INTERFACE_ADAPTER psIntfAdapter = (PS_INTERFACE_ADAPTER)arg; pTcb= GetBulkOutTcb(psIntfAdapter); - if(pTcb == NULL) { + if (pTcb == NULL) { pr_info("No URB to transmit packet, dropping packet\n"); return -EFAULT; } diff --git a/drivers/staging/bcm/LeakyBucket.c b/drivers/staging/bcm/LeakyBucket.c index db796a3..d96c256 100644 --- a/drivers/staging/bcm/LeakyBucket.c +++ b/drivers/staging/bcm/LeakyBucket.c @@ -22,28 +22,28 @@ static VOID UpdateTokenCount(register PMINI_ADAPTER Adapter) struct timeval tv; bcm_dbg(Adapter, TX, TOKEN_COUNTS, ALL, "=====>\n"); - if(NULL == Adapter) { + if (NULL == Adapter) { bcm_dbg(Adapter, TX, TOKEN_COUNTS, ALL, "Adapter found NULL!\n"); return; } do_gettimeofday(&tv); - for(i = 0; i < NO_OF_QUEUES; i++) { - if(TRUE == Adapter->PackInfo[i].bValid && + for (i = 0; i < NO_OF_QUEUES; i++) { + if (TRUE == Adapter->PackInfo[i].bValid && (1 == Adapter->PackInfo[i].ucDirection)) { liCurrentTime = ((tv.tv_sec- Adapter->PackInfo[i].stLastUpdateTokenAt.tv_sec)*1000 + (tv.tv_usec-Adapter->PackInfo[i].stLastUpdateTokenAt.tv_usec)/ 1000); - if(0!=liCurrentTime) { + if (0!=liCurrentTime) { Adapter->PackInfo[i].uiCurrentTokenCount += (ULONG) ((Adapter->PackInfo[i].uiMaxAllowedRate) * ((ULONG)((liCurrentTime)))/1000); memcpy(&Adapter->PackInfo[i].stLastUpdateTokenAt, &tv, sizeof(struct timeval)); Adapter->PackInfo[i].liLastUpdateTokenAt = liCurrentTime; - if((Adapter->PackInfo[i].uiCurrentTokenCount) >= + if ((Adapter->PackInfo[i].uiCurrentTokenCount) >= Adapter->PackInfo[i].uiMaxBucketSize) { Adapter->PackInfo[i].uiCurrentTokenCount = Adapter->PackInfo[i].uiMaxBucketSize; @@ -76,7 +76,7 @@ static ULONG GetSFTokenCount(PMINI_ADAPTER Adapter, PacketInfo *psSF) bcm_dbg(Adapter, TX, TOKEN_COUNTS, ALL, "IsPacketAllowedForFlow ===>\n"); /* Validate the parameters */ - if(NULL == Adapter || (psSF < Adapter->PackInfo && + if (NULL == Adapter || (psSF < Adapter->PackInfo && (uintptr_t)psSF > (uintptr_t) &Adapter->PackInfo[HiPriority])) { bcm_dbg(Adapter, TX, TOKEN_COUNTS, ALL, "IPAFF: Got wrong Parameters:Adapter: %p, QIndex: %zd\n", @@ -84,8 +84,8 @@ static ULONG GetSFTokenCount(PMINI_ADAPTER Adapter, PacketInfo *psSF) return 0; } - if(FALSE != psSF->bValid && psSF->ucDirection) { - if(0 != psSF->uiCurrentTokenCount) { + if (FALSE != psSF->bValid && psSF->ucDirection) { + if (0 != psSF->uiCurrentTokenCount) { return psSF->uiCurrentTokenCount; } else { bcm_dbg(Adapter, TX, TOKEN_COUNTS, ALL, @@ -115,21 +115,21 @@ static INT SendPacketFromQueue(PMINI_ADAPTER Adapter,/**<Logical Adapter*/ UINT uiIndex =0,PktLen = 0; bcm_dbg(Adapter, TX, SEND_QUEUE, ALL, "=====>\n"); - if(!Adapter || !Packet || !psSF) { + if (!Adapter || !Packet || !psSF) { bcm_dbg(Adapter, TX, SEND_QUEUE, ALL, "Got NULL Adapter or Packet\n"); return -EINVAL; } - if(psSF->liDrainCalculated==0) { + if (psSF->liDrainCalculated==0) { psSF->liDrainCalculated = jiffies; } ///send the packet to the fifo.. PktLen = Packet->len; Status = SetupNextSend(Adapter, Packet, psSF->usVCID_Value); - if(Status == 0) { - for(uiIndex = 0 ; uiIndex < MIBS_MAX_HIST_ENTRIES ; uiIndex++) - { if((PktLen <= MIBS_PKTSIZEHIST_RANGE*(uiIndex+1)) && (PktLen > MIBS_PKTSIZEHIST_RANGE*(uiIndex))) + if (Status == 0) { + for (uiIndex = 0 ; uiIndex < MIBS_MAX_HIST_ENTRIES ; uiIndex++) + { if ((PktLen <= MIBS_PKTSIZEHIST_RANGE*(uiIndex+1)) && (PktLen > MIBS_PKTSIZEHIST_RANGE*(uiIndex))) Adapter->aTxPktSizeHist[uiIndex]++; } } @@ -159,17 +159,17 @@ static VOID CheckAndSendPacketFromIndex(PMINI_ADAPTER Adapter, PacketInfo *psSF) bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "%zd ====>\n", (psSF-Adapter->PackInfo)); - if((psSF != &Adapter->PackInfo[HiPriority]) && Adapter->LinkUpStatus && atomic_read(&psSF->uiPerSFTxResourceCount))//Get data packet + if ((psSF != &Adapter->PackInfo[HiPriority]) && Adapter->LinkUpStatus && atomic_read(&psSF->uiPerSFTxResourceCount))//Get data packet { - if(!psSF->ucDirection ) + if (!psSF->ucDirection ) return; bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "UpdateTokenCount\n"); - if(Adapter->IdleMode || Adapter->bPreparingForLowPowerMode) + if (Adapter->IdleMode || Adapter->bPreparingForLowPowerMode) return; /* in idle mode */ // Check for Free Descriptors - if(atomic_read(&Adapter->CurrNumFreeTxDesc) <= MINIMUM_PENDING_DESCRIPTORS) { + if (atomic_read(&Adapter->CurrNumFreeTxDesc) <= MINIMUM_PENDING_DESCRIPTORS) { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "No Free Tx Descriptor(%d) is available for Data pkt..\n", atomic_read(&Adapter->CurrNumFreeTxDesc)); @@ -179,17 +179,17 @@ static VOID CheckAndSendPacketFromIndex(PMINI_ADAPTER Adapter, PacketInfo *psSF) spin_lock_bh(&psSF->SFQueueLock); QueuePacket=psSF->FirstTxQueue; - if(QueuePacket) { + if (QueuePacket) { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "Dequeuing Data Packet\n"); - if(psSF->bEthCSSupport) + if (psSF->bEthCSSupport) iPacketLen = QueuePacket->len; else iPacketLen = QueuePacket->len-ETH_HLEN; iPacketLen<<=3; - if(iPacketLen <= GetSFTokenCount(Adapter, psSF)) { + if (iPacketLen <= GetSFTokenCount(Adapter, psSF)) { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "Allowed bytes %d\n", (iPacketLen >> 3)); @@ -220,17 +220,17 @@ static VOID CheckAndSendPacketFromIndex(PMINI_ADAPTER Adapter, PacketInfo *psSF) } } else { - if((atomic_read(&Adapter->CurrNumFreeTxDesc) > 0 ) && + if ((atomic_read(&Adapter->CurrNumFreeTxDesc) > 0 ) && (atomic_read(&Adapter->index_rd_txcntrlpkt) != atomic_read(&Adapter->index_wr_txcntrlpkt)) ) { pControlPacket = Adapter->txctlpacket [(atomic_read(&Adapter->index_rd_txcntrlpkt)%MAX_CNTRL_PKTS)]; - if(pControlPacket) { + if (pControlPacket) { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "Sending Control packet\n"); Status = SendControlPacket(Adapter, pControlPacket); - if(STATUS_SUCCESS==Status) { + if (STATUS_SUCCESS==Status) { spin_lock_bh(&psSF->SFQueueLock); psSF->NumOfPacketsSent++; psSF->uiSentBytes+=((PLEADER)pControlPacket)->PLength; @@ -271,11 +271,11 @@ VOID transmit_packets(PMINI_ADAPTER Adapter) bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "=====>\n"); - if(NULL == Adapter) { + if (NULL == Adapter) { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "Got NULL Adapter\n"); return; } - if(Adapter->device_removed == TRUE) { + if (Adapter->device_removed == TRUE) { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "Device removed\n"); return; } @@ -290,11 +290,11 @@ VOID transmit_packets(PMINI_ADAPTER Adapter) uiPrevTotalCount = atomic_read(&Adapter->TotalPacketCount); - for(iIndex=HiPriority;iIndex>=0;iIndex--) { - if( !uiPrevTotalCount || (TRUE == Adapter->device_removed)) + for (iIndex=HiPriority;iIndex>=0;iIndex--) { + if ( !uiPrevTotalCount || (TRUE == Adapter->device_removed)) break; - if(Adapter->PackInfo[iIndex].bValid && + if (Adapter->PackInfo[iIndex].bValid && Adapter->PackInfo[iIndex].uiPendedLast && Adapter->PackInfo[iIndex].uiCurrentBytesOnHost) { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, @@ -304,14 +304,14 @@ VOID transmit_packets(PMINI_ADAPTER Adapter) } } - while(uiPrevTotalCount > 0 && !Adapter->device_removed) { + while (uiPrevTotalCount > 0 && !Adapter->device_removed) { exit_flag = TRUE ; //second iteration to parse non-pending queues - for(iIndex=HiPriority;iIndex>=0;iIndex--) { - if( !uiPrevTotalCount || (TRUE == Adapter->device_removed)) + for (iIndex=HiPriority;iIndex>=0;iIndex--) { + if ( !uiPrevTotalCount || (TRUE == Adapter->device_removed)) break; - if(Adapter->PackInfo[iIndex].bValid && + if (Adapter->PackInfo[iIndex].bValid && Adapter->PackInfo[iIndex].uiCurrentBytesOnHost && !Adapter->PackInfo[iIndex].uiPendedLast ) { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, @@ -322,12 +322,12 @@ VOID transmit_packets(PMINI_ADAPTER Adapter) } } - if(Adapter->IdleMode || Adapter->bPreparingForLowPowerMode) { + if (Adapter->IdleMode || Adapter->bPreparingForLowPowerMode) { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "In Idle Mode\n"); break; } - if(exit_flag == TRUE ) + if (exit_flag == TRUE ) break ; }/* end of inner while loop */ diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c index 92c40b8..3beb50e 100644 --- a/drivers/staging/bcm/PHSModule.c +++ b/drivers/staging/bcm/PHSModule.c @@ -98,7 +98,7 @@ int PHSTransmit(PMINI_ADAPTER Adapter, bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, "In PHSTransmit\n"); - if(!bEthCSSupport) + if (!bEthCSSupport) BytesToRemove=ETH_HLEN; /* Accumulate the header upto the size we support supression @@ -110,20 +110,20 @@ int PHSTransmit(PMINI_ADAPTER Adapter, pucPHSPktHdrInBuf = Packet->data + BytesToRemove; //considering data after ethernet header - if((*PacketLen - BytesToRemove) < MAX_PHS_LENGTHS) { + if ((*PacketLen - BytesToRemove) < MAX_PHS_LENGTHS) { unPHSPktHdrBytesCopied = (*PacketLen - BytesToRemove); } else { unPHSPktHdrBytesCopied = MAX_PHS_LENGTHS; } - if( (unPHSPktHdrBytesCopied > 0 ) && + if ( (unPHSPktHdrBytesCopied > 0 ) && (unPHSPktHdrBytesCopied <= MAX_PHS_LENGTHS)) { // Step 2 Supress Header using PHS and fill into intermediate ucaPHSPktHdrOutBuf. // Suppress only if IP Header and PHS Enabled For the Service Flow - if(((usPacketType == ETHERNET_FRAMETYPE_IPV4) || + if (((usPacketType == ETHERNET_FRAMETYPE_IPV4) || (usPacketType == ETHERNET_FRAMETYPE_IPV6)) && (bHeaderSuppressionEnabled)) { bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, @@ -143,20 +143,20 @@ int PHSTransmit(PMINI_ADAPTER Adapter, "PHS Old header Size : %d New Header Size %d\n", unPhsOldHdrSize, unPHSNewPktHeaderLen); - if(unPHSNewPktHeaderLen == unPhsOldHdrSize) { - if( ulPhsStatus == STATUS_PHS_COMPRESSED) + if (unPHSNewPktHeaderLen == unPhsOldHdrSize) { + if ( ulPhsStatus == STATUS_PHS_COMPRESSED) bPHSI = *pucPHSPktHdrOutBuf; ulPhsStatus = STATUS_PHS_NOCOMPRESSION; } - if( ulPhsStatus == STATUS_PHS_COMPRESSED) { + if ( ulPhsStatus == STATUS_PHS_COMPRESSED) { bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, "PHS Sending packet Compressed\n"); - if(skb_cloned(Packet)) { + if (skb_cloned(Packet)) { newPacket = skb_copy(Packet, GFP_ATOMIC); - if(newPacket == NULL) + if (newPacket == NULL) return STATUS_FAILURE; dev_kfree_skb(Packet); @@ -175,8 +175,8 @@ int PHSTransmit(PMINI_ADAPTER Adapter, else { //if one byte headroom is not available, increase it through skb_cow - if(!(skb_headroom(Packet) > 0)) { - if(skb_cow(Packet, 1)) { + if (!(skb_headroom(Packet) > 0)) { + if (skb_cow(Packet, 1)) { pr_info("SKB Cow Failed\n"); return STATUS_FAILURE; } @@ -188,7 +188,7 @@ int PHSTransmit(PMINI_ADAPTER Adapter, return STATUS_SUCCESS; } } else { - if(!bHeaderSuppressionEnabled) { + if (!bHeaderSuppressionEnabled) { bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, "Header Suppression Disabled For SF: No PHS\n"); } @@ -213,7 +213,7 @@ int PHSReceive(PMINI_ADAPTER Adapter, int ulPhsStatus = 0; PUCHAR pucInBuff = NULL ; UINT TotalBytesAdded = 0; - if(!bHeaderSuppressionEnabled) { + if (!bHeaderSuppressionEnabled) { bcm_dbg(Adapter, OTHERS, PHS_RECEIVE, ALL, "Phs Disabled for incoming packet\n"); return ulPhsStatus; @@ -234,16 +234,16 @@ int PHSReceive(PMINI_ADAPTER Adapter, "Supressed PktHdrLen : 0x%x Restored PktHdrLen : 0x%x\n", nTotalsupressedPktHdrBytes,nStandardPktHdrLen); - if(ulPhsStatus != STATUS_PHS_COMPRESSED) { + if (ulPhsStatus != STATUS_PHS_COMPRESSED) { skb_pull(packet, 1); return STATUS_SUCCESS; } else { TotalBytesAdded = nStandardPktHdrLen - nTotalsupressedPktHdrBytes - PHSI_LEN; - if(TotalBytesAdded) { - if(skb_headroom(packet) >= (SKB_RESERVE_ETHERNET_HEADER + TotalBytesAdded)) + if (TotalBytesAdded) { + if (skb_headroom(packet) >= (SKB_RESERVE_ETHERNET_HEADER + TotalBytesAdded)) skb_push(packet, TotalBytesAdded); else { - if(skb_cow(packet, skb_headroom(packet) + TotalBytesAdded)) { + if (skb_cow(packet, skb_headroom(packet) + TotalBytesAdded)) { pr_info("cow failed in receive\n"); return STATUS_FAILURE; } @@ -284,23 +284,23 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter) S_SERVICEFLOW_TABLE *pstServiceFlowTable; bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "PHS:phs_init function\n"); - if(pPhsdeviceExtension->pstServiceFlowPhsRulesTable) + if (pPhsdeviceExtension->pstServiceFlowPhsRulesTable) return -EINVAL; pPhsdeviceExtension->pstServiceFlowPhsRulesTable = kzalloc(sizeof(S_SERVICEFLOW_TABLE), GFP_KERNEL); - if(!pPhsdeviceExtension->pstServiceFlowPhsRulesTable) { + if (!pPhsdeviceExtension->pstServiceFlowPhsRulesTable) { bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "Allocation ServiceFlowPhsRulesTable failed\n"); return -ENOMEM; } pstServiceFlowTable = pPhsdeviceExtension->pstServiceFlowPhsRulesTable; - for(i=0;i<MAX_SERVICEFLOWS;i++) { + for (i=0;i<MAX_SERVICEFLOWS;i++) { S_SERVICEFLOW_ENTRY sServiceFlow = pstServiceFlowTable->stSFList[i]; sServiceFlow.pstClassifierTable = kzalloc(sizeof(S_CLASSIFIER_TABLE), GFP_KERNEL); - if(!sServiceFlow.pstClassifierTable) { + if (!sServiceFlow.pstClassifierTable) { bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "Allocation failed\n"); free_phs_serviceflow_rules(pPhsdeviceExtension-> @@ -312,7 +312,7 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter) pPhsdeviceExtension->CompressedTxBuffer = kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL); - if(pPhsdeviceExtension->CompressedTxBuffer == NULL) { + if (pPhsdeviceExtension->CompressedTxBuffer == NULL) { bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "Allocation failed\n"); free_phs_serviceflow_rules(pPhsdeviceExtension->pstServiceFlowPhsRulesTable); @@ -321,7 +321,7 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter) } pPhsdeviceExtension->UnCompressedRxBuffer = kmalloc(PHS_BUFFER_SIZE, GFP_KERNEL); - if(pPhsdeviceExtension->UnCompressedRxBuffer == NULL) { + if (pPhsdeviceExtension->UnCompressedRxBuffer == NULL) { bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "Allocation failed\n"); kfree(pPhsdeviceExtension->CompressedTxBuffer); @@ -339,7 +339,7 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter) int PhsCleanup(IN PPHS_DEVICE_EXTENSION pPHSDeviceExt) { - if(pPHSDeviceExt->pstServiceFlowPhsRulesTable) { + if (pPHSDeviceExt->pstServiceFlowPhsRulesTable) { free_phs_serviceflow_rules(pPHSDeviceExt->pstServiceFlowPhsRulesTable); pPHSDeviceExt->pstServiceFlowPhsRulesTable = NULL; } @@ -392,14 +392,14 @@ ULONG PhsUpdateClassifierRule(IN void* pvContext, bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "PHS With Corr2 Changes\n"); - if(pDeviceExtension == NULL) { + if (pDeviceExtension == NULL) { bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "Invalid Device Extension\n"); return ERR_PHS_INVALID_DEVICE_EXETENSION; } - if(u8AssociatedPHSI == 0) { + if (u8AssociatedPHSI == 0) { return ERR_PHS_INVALID_PHS_RULE; } @@ -408,7 +408,7 @@ ULONG PhsUpdateClassifierRule(IN void* pvContext, nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, uiVcid,&pstServiceFlowEntry); - if(nSFIndex == PHS_INVALID_TABLE_INDEX) { + if (nSFIndex == PHS_INVALID_TABLE_INDEX) { /* This is a new SF. Create a mapping entry for this */ lStatus = CreateSFToClassifierRuleMapping(uiVcid, uiClsId, pDeviceExtension->pstServiceFlowPhsRulesTable, psPhsRule, u8AssociatedPHSI); @@ -453,26 +453,26 @@ ULONG PhsDeletePHSRule(IN void* pvContext,IN B_UINT16 uiVcid,IN B_UINT8 u8PHSI) bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "======>\n"); - if(pDeviceExtension) { + if (pDeviceExtension) { //Retrieve the SFID Entry Index for requested Service Flow nSFIndex = GetServiceFlowEntry(pDeviceExtension ->pstServiceFlowPhsRulesTable,uiVcid,&pstServiceFlowEntry); - if(nSFIndex == PHS_INVALID_TABLE_INDEX) { + if (nSFIndex == PHS_INVALID_TABLE_INDEX) { bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "SFID Match Failed\n"); return ERR_SF_MATCH_FAIL; } pstClassifierRulesTable=pstServiceFlowEntry->pstClassifierTable; - if(pstClassifierRulesTable) { - for(nClsidIndex=0;nClsidIndex<MAX_PHSRULE_PER_SF;nClsidIndex++) { - if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].bUsed && pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule) { - if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8PHSI == u8PHSI) { - if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt) + if (pstClassifierRulesTable) { + for (nClsidIndex=0;nClsidIndex<MAX_PHSRULE_PER_SF;nClsidIndex++) { + if (pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].bUsed && pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule) { + if (pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8PHSI == u8PHSI) { + if (pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt) pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt--; - if(0 == pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt) + if (0 == pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule->u8RefCnt) kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule); memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0, sizeof(S_CLASSIFIER_ENTRY)); @@ -511,11 +511,11 @@ ULONG PhsDeleteClassifierRule(IN void* pvContext,IN B_UINT16 uiVcid ,IN B_UINT16 PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; - if(pDeviceExtension) { + if (pDeviceExtension) { //Retrieve the SFID Entry Index for requested Service Flow nSFIndex = GetServiceFlowEntry(pDeviceExtension ->pstServiceFlowPhsRulesTable, uiVcid, &pstServiceFlowEntry); - if(nSFIndex == PHS_INVALID_TABLE_INDEX) { + if (nSFIndex == PHS_INVALID_TABLE_INDEX) { bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "SFID Match Failed\n"); return ERR_SF_MATCH_FAIL; @@ -523,11 +523,11 @@ ULONG PhsDeleteClassifierRule(IN void* pvContext,IN B_UINT16 uiVcid ,IN B_UINT16 nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable, uiClsId, eActiveClassifierRuleContext, &pstClassifierEntry); - if((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule)) { - if(pstClassifierEntry->pstPhsRule) { - if(pstClassifierEntry->pstPhsRule->u8RefCnt) + if ((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule)) { + if (pstClassifierEntry->pstPhsRule) { + if (pstClassifierEntry->pstPhsRule->u8RefCnt) pstClassifierEntry->pstPhsRule->u8RefCnt--; - if(0==pstClassifierEntry->pstPhsRule->u8RefCnt) + if (0==pstClassifierEntry->pstPhsRule->u8RefCnt) kfree(pstClassifierEntry->pstPhsRule); } @@ -537,7 +537,7 @@ ULONG PhsDeleteClassifierRule(IN void* pvContext,IN B_UINT16 uiVcid ,IN B_UINT16 nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable, uiClsId,eOldClassifierRuleContext,&pstClassifierEntry); - if((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule)) { + if ((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule)) { kfree(pstClassifierEntry->pstPhsRule); memset(pstClassifierEntry, 0, sizeof(S_CLASSIFIER_ENTRY)); } @@ -572,37 +572,37 @@ ULONG PhsDeleteSFRules(IN void* pvContext,IN B_UINT16 uiVcid) PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "====>\n"); - if(pDeviceExtension) { + if (pDeviceExtension) { //Retrieve the SFID Entry Index for requested Service Flow nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, uiVcid,&pstServiceFlowEntry); - if(nSFIndex == PHS_INVALID_TABLE_INDEX) { + if (nSFIndex == PHS_INVALID_TABLE_INDEX) { bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "SFID Match Failed\n"); return ERR_SF_MATCH_FAIL; } pstClassifierRulesTable=pstServiceFlowEntry->pstClassifierTable; - if(pstClassifierRulesTable) { - for(nClsidIndex=0;nClsidIndex<MAX_PHSRULE_PER_SF;nClsidIndex++) { - if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule) { - if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] + if (pstClassifierRulesTable) { + for (nClsidIndex=0;nClsidIndex<MAX_PHSRULE_PER_SF;nClsidIndex++) { + if (pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule) { + if (pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] .pstPhsRule->u8RefCnt) pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] .pstPhsRule->u8RefCnt--; - if(0==pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] + if (0==pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] .pstPhsRule->u8RefCnt) kfree(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule); pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] .pstPhsRule = NULL; } memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0, sizeof(S_CLASSIFIER_ENTRY)); - if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule) { - if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] + if (pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule) { + if (pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] .pstPhsRule->u8RefCnt) pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] .pstPhsRule->u8RefCnt--; - if(0 == pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] + if (0 == pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] .pstPhsRule->u8RefCnt) kfree(pstClassifierRulesTable ->stOldPhsRulesList[nClsidIndex].pstPhsRule); @@ -662,7 +662,7 @@ ULONG PhsCompress(IN void* pvContext, PPHS_DEVICE_EXTENSION pDeviceExtension= (PPHS_DEVICE_EXTENSION)pvContext; - if(pDeviceExtension == NULL) { + if (pDeviceExtension == NULL) { bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, "Invalid Device Extension\n"); lStatus = STATUS_PHS_NOCOMPRESSION ; @@ -676,7 +676,7 @@ ULONG PhsCompress(IN void* pvContext, //Retrieve the SFID Entry Index for requested Service Flow nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, uiVcid,&pstServiceFlowEntry); - if(nSFIndex == PHS_INVALID_TABLE_INDEX) { + if (nSFIndex == PHS_INVALID_TABLE_INDEX) { bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, "SFID Match Failed\n"); lStatus = STATUS_PHS_NOCOMPRESSION ; return lStatus; @@ -685,7 +685,7 @@ ULONG PhsCompress(IN void* pvContext, nClsidIndex = GetClassifierEntry(pstServiceFlowEntry->pstClassifierTable, uiClsId,eActiveClassifierRuleContext,&pstClassifierEntry); - if(nClsidIndex == PHS_INVALID_TABLE_INDEX) { + if (nClsidIndex == PHS_INVALID_TABLE_INDEX) { bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, "No PHS Rule Defined For Classifier\n"); lStatus = STATUS_PHS_NOCOMPRESSION ; @@ -696,7 +696,7 @@ ULONG PhsCompress(IN void* pvContext, //get rule from SF id,Cls ID pair and proceed pstPhsRule = pstClassifierEntry->pstPhsRule; - if(!ValidatePHSRuleComplete(pstPhsRule)) { + if (!ValidatePHSRuleComplete(pstPhsRule)) { bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "PHS Rule Defined For Classifier But Not Complete\n"); lStatus = STATUS_PHS_NOCOMPRESSION ; @@ -707,7 +707,7 @@ ULONG PhsCompress(IN void* pvContext, lStatus = phs_compress(pstPhsRule,(PUCHAR)pvInputBuffer, (PUCHAR)pvOutputBuffer, pOldHeaderSize,pNewHeaderSize); - if(lStatus == STATUS_PHS_COMPRESSED) { + if (lStatus == STATUS_PHS_COMPRESSED) { pstPhsRule->PHSModifiedBytes += *pOldHeaderSize - *pNewHeaderSize - 1; pstPhsRule->PHSModifiedNumPackets++; } else @@ -752,7 +752,7 @@ ULONG PhsDeCompress(IN void* pvContext, *pInHeaderSize = 0; - if(pDeviceExtension == NULL) { + if (pDeviceExtension == NULL) { bcm_dbg(Adapter, OTHERS, PHS_RECEIVE, ALL, "Invalid Device Extension\n"); return ERR_PHS_INVALID_DEVICE_EXETENSION; @@ -763,14 +763,14 @@ ULONG PhsDeCompress(IN void* pvContext, phsi = *((unsigned char *)(pvInputBuffer)); bcm_dbg(Adapter, OTHERS, PHS_RECEIVE, ALL, "PHSI To Be Used For restore : %x\n", phsi); - if(phsi == UNCOMPRESSED_PACKET ) { + if (phsi == UNCOMPRESSED_PACKET ) { return STATUS_PHS_NOCOMPRESSION; } //Retrieve the SFID Entry Index for requested Service Flow nSFIndex = GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, uiVcid,&pstServiceFlowEntry); - if(nSFIndex == PHS_INVALID_TABLE_INDEX) { + if (nSFIndex == PHS_INVALID_TABLE_INDEX) { bcm_dbg(Adapter, OTHERS, PHS_RECEIVE, ALL, "SFID Match Failed During Lookup\n"); return ERR_SF_MATCH_FAIL; @@ -778,11 +778,11 @@ ULONG PhsDeCompress(IN void* pvContext, nPhsRuleIndex = GetPhsRuleEntry(pstServiceFlowEntry->pstClassifierTable,phsi, eActiveClassifierRuleContext,&pstPhsRule); - if(nPhsRuleIndex == PHS_INVALID_TABLE_INDEX) { + if (nPhsRuleIndex == PHS_INVALID_TABLE_INDEX) { //Phs Rule does not exist in active rules table. Lets try in the old rules table. nPhsRuleIndex = GetPhsRuleEntry(pstServiceFlowEntry->pstClassifierTable, phsi,eOldClassifierRuleContext,&pstPhsRule); - if(nPhsRuleIndex == PHS_INVALID_TABLE_INDEX) { + if (nPhsRuleIndex == PHS_INVALID_TABLE_INDEX) { return ERR_PHSRULE_MATCH_FAIL; } @@ -816,31 +816,31 @@ static void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTa PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "=======>\n"); - if(psServiceFlowRulesTable) { - for(i=0;i<MAX_SERVICEFLOWS;i++) { + if (psServiceFlowRulesTable) { + for (i=0;i<MAX_SERVICEFLOWS;i++) { S_SERVICEFLOW_ENTRY stServiceFlowEntry = psServiceFlowRulesTable->stSFList[i]; S_CLASSIFIER_TABLE *pstClassifierRulesTable = stServiceFlowEntry.pstClassifierTable; - if(pstClassifierRulesTable) { - for(j=0;j<MAX_PHSRULE_PER_SF;j++) { - if(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule) { - if(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule + if (pstClassifierRulesTable) { + for (j=0;j<MAX_PHSRULE_PER_SF;j++) { + if (pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule) { + if (pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule ->u8RefCnt) pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule ->u8RefCnt--; - if(0==pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule + if (0==pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule ->u8RefCnt) kfree(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule); pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule = NULL; } - if(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule) { - if(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule + if (pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule) { + if (pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule ->u8RefCnt) pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule ->u8RefCnt--; - if(0==pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule + if (0==pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule ->u8RefCnt) kfree(pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule); pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule = NULL; @@ -860,19 +860,19 @@ static void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTa static BOOLEAN ValidatePHSRuleComplete(IN S_PHS_RULE *psPhsRule) { - if(psPhsRule) { - if(!psPhsRule->u8PHSI) { + if (psPhsRule) { + if (!psPhsRule->u8PHSI) { // PHSI is not valid return FALSE; } - if(!psPhsRule->u8PHSS) { + if (!psPhsRule->u8PHSS) { //PHSS Is Undefined return FALSE; } //Check if PHSF is defines for the PHS Rule - if(!psPhsRule->u8PHSFLength) // If any part of PHSF is valid then Rule contains valid PHSF + if (!psPhsRule->u8PHSFLength) // If any part of PHSF is valid then Rule contains valid PHSF { return FALSE; } @@ -886,9 +886,9 @@ UINT GetServiceFlowEntry(IN S_SERVICEFLOW_TABLE *psServiceFlowTable, IN B_UINT16 uiVcid,S_SERVICEFLOW_ENTRY **ppstServiceFlowEntry) { int i; - for(i=0;i<MAX_SERVICEFLOWS;i++) { - if(psServiceFlowTable->stSFList[i].bUsed) { - if(psServiceFlowTable->stSFList[i].uiVcid == uiVcid) { + for (i=0;i<MAX_SERVICEFLOWS;i++) { + if (psServiceFlowTable->stSFList[i].bUsed) { + if (psServiceFlowTable->stSFList[i].uiVcid == uiVcid) { *ppstServiceFlowEntry = &psServiceFlowTable->stSFList[i]; return i; } @@ -906,16 +906,16 @@ UINT GetClassifierEntry(IN S_CLASSIFIER_TABLE *pstClassifierTable, { int i; S_CLASSIFIER_ENTRY *psClassifierRules = NULL; - for(i=0;i<MAX_PHSRULE_PER_SF;i++) { + for (i=0;i<MAX_PHSRULE_PER_SF;i++) { - if(eClsContext == eActiveClassifierRuleContext) { + if (eClsContext == eActiveClassifierRuleContext) { psClassifierRules = &pstClassifierTable->stActivePhsRulesList[i]; } else { psClassifierRules = &pstClassifierTable->stOldPhsRulesList[i]; } - if(psClassifierRules->bUsed) { - if(psClassifierRules->uiClassifierRuleId == uiClsid) { + if (psClassifierRules->bUsed) { + if (psClassifierRules->uiClassifierRuleId == uiClsid) { *ppstClassifierEntry = psClassifierRules; return i; } @@ -933,14 +933,14 @@ static UINT GetPhsRuleEntry(IN S_CLASSIFIER_TABLE *pstClassifierTable, { int i; S_CLASSIFIER_ENTRY *pstClassifierRule = NULL; - for(i=0;i<MAX_PHSRULE_PER_SF;i++) { - if(eClsContext == eActiveClassifierRuleContext) { + for (i=0;i<MAX_PHSRULE_PER_SF;i++) { + if (eClsContext == eActiveClassifierRuleContext) { pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[i]; } else { pstClassifierRule = &pstClassifierTable->stOldPhsRulesList[i]; } - if(pstClassifierRule->bUsed) { - if(pstClassifierRule->u8PHSI == uiPHSI) { + if (pstClassifierRule->bUsed) { + if (pstClassifierRule->u8PHSI == uiPHSI) { *ppstPhsRule = pstClassifierRule->pstPhsRule; return i; } @@ -962,21 +962,21 @@ UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid,IN B_UINT16 uiClsId, int iSfIndex; BOOLEAN bFreeEntryFound =FALSE; //Check for a free entry in SFID table - for(iSfIndex=0;iSfIndex < MAX_SERVICEFLOWS;iSfIndex++) { - if(!psServiceFlowTable->stSFList[iSfIndex].bUsed) { + for (iSfIndex=0;iSfIndex < MAX_SERVICEFLOWS;iSfIndex++) { + if (!psServiceFlowTable->stSFList[iSfIndex].bUsed) { bFreeEntryFound = TRUE; break; } } - if(!bFreeEntryFound) + if (!bFreeEntryFound) return ERR_SFTABLE_FULL; psaClassifiertable = psServiceFlowTable->stSFList[iSfIndex].pstClassifierTable; uiStatus = CreateClassifierPHSRule(uiClsId,psaClassifiertable,psPhsRule, eActiveClassifierRuleContext,u8AssociatedPHSI); - if(uiStatus == PHS_SUCCESS) { + if (uiStatus == PHS_SUCCESS) { //Add entry at free index to the SF psServiceFlowTable->stSFList[iSfIndex].bUsed = TRUE; psServiceFlowTable->stSFList[iSfIndex].uiVcid = uiVcid; @@ -1003,7 +1003,7 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, nClassifierIndex =GetClassifierEntry( pstServiceFlowEntry->pstClassifierTable,uiClsId, eActiveClassifierRuleContext,&pstClassifierEntry); - if(nClassifierIndex == PHS_INVALID_TABLE_INDEX) { + if (nClassifierIndex == PHS_INVALID_TABLE_INDEX) { /* The Classifier doesn't exist. So its a new classifier being added. Add new entry to associate PHS Rule to the Classifier @@ -1018,8 +1018,8 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, The Classifier exists.The PHS Rule for this classifier is being modified */ - if(pstClassifierEntry->u8PHSI == psPhsRule->u8PHSI) { - if(pstClassifierEntry->pstPhsRule == NULL) + if (pstClassifierEntry->u8PHSI == psPhsRule->u8PHSI) { + if (pstClassifierEntry->pstPhsRule == NULL) return ERR_PHS_INVALID_PHS_RULE; /* @@ -1027,27 +1027,27 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, rule update them. */ /* If any part of PHSF is valid then we update PHSF */ - if(psPhsRule->u8PHSFLength) { + if (psPhsRule->u8PHSFLength) { //update PHSF memcpy(pstClassifierEntry->pstPhsRule->u8PHSF, psPhsRule->u8PHSF , MAX_PHS_LENGTHS); } - if(psPhsRule->u8PHSFLength) { + if (psPhsRule->u8PHSFLength) { //update PHSFLen pstClassifierEntry->pstPhsRule->u8PHSFLength = psPhsRule->u8PHSFLength; } - if(psPhsRule->u8PHSMLength) { + if (psPhsRule->u8PHSMLength) { //update PHSM memcpy(pstClassifierEntry->pstPhsRule->u8PHSM, psPhsRule->u8PHSM, MAX_PHS_LENGTHS); } - if(psPhsRule->u8PHSMLength) { + if (psPhsRule->u8PHSMLength) { //update PHSM Len pstClassifierEntry->pstPhsRule->u8PHSMLength = psPhsRule->u8PHSMLength; } - if(psPhsRule->u8PHSS) { + if (psPhsRule->u8PHSS) { //update PHSS pstClassifierEntry->pstPhsRule->u8PHSS = psPhsRule->u8PHSS; } @@ -1079,18 +1079,18 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "Inside CreateClassifierPHSRule\n"); - if(psaClassifiertable == NULL) { + if (psaClassifiertable == NULL) { return ERR_INVALID_CLASSIFIERTABLE_FOR_SF; } - if(eClsContext == eOldClassifierRuleContext) { + if (eClsContext == eOldClassifierRuleContext) { /* If An Old Entry for this classifier ID already exists in the old rules table replace it. */ iClassifierIndex = GetClassifierEntry(psaClassifiertable, uiClsId, eClsContext,&psClassifierRules); - if(iClassifierIndex != PHS_INVALID_TABLE_INDEX) { + if (iClassifierIndex != PHS_INVALID_TABLE_INDEX) { /* The Classifier already exists in the old rules table Lets replace the old classifier with the new one. @@ -1099,13 +1099,13 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, } } - if(!bFreeEntryFound) { + if (!bFreeEntryFound) { /* Continue to search for a free location to add the rule */ - for(iClassifierIndex = 0; iClassifierIndex < + for (iClassifierIndex = 0; iClassifierIndex < MAX_PHSRULE_PER_SF; iClassifierIndex++) { - if(eClsContext == eActiveClassifierRuleContext) { + if (eClsContext == eActiveClassifierRuleContext) { psClassifierRules = &psaClassifiertable->stActivePhsRulesList[iClassifierIndex]; } else { @@ -1113,19 +1113,19 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, &psaClassifiertable->stOldPhsRulesList[iClassifierIndex]; } - if(!psClassifierRules->bUsed) { + if (!psClassifierRules->bUsed) { bFreeEntryFound = TRUE; break; } } } - if(!bFreeEntryFound) { - if(eClsContext == eActiveClassifierRuleContext) { + if (!bFreeEntryFound) { + if (eClsContext == eActiveClassifierRuleContext) { return ERR_CLSASSIFIER_TABLE_FULL; } else { //Lets replace the oldest rule if we are looking in old Rule table - if(psaClassifiertable->uiOldestPhsRuleIndex >= + if (psaClassifiertable->uiOldestPhsRuleIndex >= MAX_PHSRULE_PER_SF) { psaClassifiertable->uiOldestPhsRuleIndex =0; } @@ -1138,11 +1138,11 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, } } - if(eClsContext == eOldClassifierRuleContext) { - if(psClassifierRules->pstPhsRule == NULL) { + if (eClsContext == eOldClassifierRuleContext) { + if (psClassifierRules->pstPhsRule == NULL) { psClassifierRules->pstPhsRule = kmalloc(sizeof(S_PHS_RULE),GFP_KERNEL); - if(NULL == psClassifierRules->pstPhsRule) + if (NULL == psClassifierRules->pstPhsRule) return ERR_PHSRULE_MEMALLOC_FAIL; } @@ -1180,19 +1180,19 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, //Step 2 Search if there is a PHS Rule with u8AssociatedPHSI in Classifier table for this SF nPhsRuleIndex =GetPhsRuleEntry(psaClassifiertable,u8AssociatedPHSI, eActiveClassifierRuleContext, &pstAddPhsRule); - if(PHS_INVALID_TABLE_INDEX == nPhsRuleIndex) { + if (PHS_INVALID_TABLE_INDEX == nPhsRuleIndex) { bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "Adding New PHSRuleEntry For Classifier\n"); - if(psPhsRule->u8PHSI == 0) { + if (psPhsRule->u8PHSI == 0) { bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "Error PHSI is Zero\n"); return ERR_PHS_INVALID_PHS_RULE; } //Step 2.a PHS Rule Does Not Exist .Create New PHS Rule for uiClsId - if(FALSE == bPHSRuleOrphaned) { + if (FALSE == bPHSRuleOrphaned) { pstClassifierEntry->pstPhsRule = kmalloc(sizeof(S_PHS_RULE), GFP_KERNEL); - if(NULL == pstClassifierEntry->pstPhsRule) { + if (NULL == pstClassifierEntry->pstPhsRule) { return ERR_PHSRULE_MEMALLOC_FAIL; } } @@ -1202,7 +1202,7 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, //Step 2.b PHS Rule Exists Tie uiClsId with the existing PHS Rule bcm_dbg(Adapter, OTHERS, PHS_DISPATCH, ALL, "Tying Classifier to Existing PHS Rule\n"); - if(bPHSRuleOrphaned) { + if (bPHSRuleOrphaned) { kfree(pstClassifierEntry->pstPhsRule); pstClassifierEntry->pstPhsRule = NULL; } @@ -1221,12 +1221,12 @@ static UINT UpdateClassifierPHSRule(IN B_UINT16 uiClsId, static BOOLEAN DerefPhsRule(IN B_UINT16 uiClsId,S_CLASSIFIER_TABLE *psaClassifiertable,S_PHS_RULE *pstPhsRule) { - if(pstPhsRule==NULL) + if (pstPhsRule==NULL) return FALSE; - if(pstPhsRule->u8RefCnt) + if (pstPhsRule->u8RefCnt) pstPhsRule->u8RefCnt--; - if(0==pstPhsRule->u8RefCnt) { - /*if(pstPhsRule->u8PHSI) + if (0==pstPhsRule->u8RefCnt) { + /*if (pstPhsRule->u8PHSI) //Store the currently active rule into the old rules list CreateClassifierPHSRule(uiClsId,psaClassifiertable,pstPhsRule,eOldClassifierRuleContext,pstPhsRule->u8PHSI);*/ return TRUE; @@ -1240,25 +1240,25 @@ void DumpPhsRules(PPHS_DEVICE_EXTENSION pDeviceExtension) int i,j,k,l; PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); bcm_dbg(Adapter, OTHERS, DUMP_INFO, ALL, "Dumping PHS Rules :\n"); - for(i=0;i<MAX_SERVICEFLOWS;i++) { + for (i=0;i<MAX_SERVICEFLOWS;i++) { S_SERVICEFLOW_ENTRY stServFlowEntry = pDeviceExtension->pstServiceFlowPhsRulesTable->stSFList[i]; - if(stServFlowEntry.bUsed) { - for(j=0;j<MAX_PHSRULE_PER_SF;j++) { - for(l=0;l<2;l++) { + if (stServFlowEntry.bUsed) { + for (j=0;j<MAX_PHSRULE_PER_SF;j++) { + for (l=0;l<2;l++) { S_CLASSIFIER_ENTRY stClsEntry; - if(l==0) { + if (l==0) { stClsEntry = stServFlowEntry.pstClassifierTable->stActivePhsRulesList[j]; - if(stClsEntry.bUsed) + if (stClsEntry.bUsed) bcm_dbg(Adapter, OTHERS, DUMP_INFO, ALL, "Active PHS Rule :\n"); } else { stClsEntry = stServFlowEntry.pstClassifierTable->stOldPhsRulesList[j]; - if(stClsEntry.bUsed) + if (stClsEntry.bUsed) bcm_dbg(Adapter, OTHERS, DUMP_INFO, ALL, "Old PHS Rule :\n"); } - if(stClsEntry.bUsed) { + if (stClsEntry.bUsed) { bcm_dbg(Adapter, OTHERS, DUMP_INFO, ALL, "VCID : %#X\n", @@ -1279,7 +1279,7 @@ void DumpPhsRules(PPHS_DEVICE_EXTENSION pDeviceExtension) stClsEntry.pstPhsRule->u8PHSFLength); bcm_dbg(Adapter, OTHERS, DUMP_INFO, ALL, "PHSF :\n"); - for(k=0;k<stClsEntry.pstPhsRule->u8PHSFLength;k++) { + for (k=0;k<stClsEntry.pstPhsRule->u8PHSFLength;k++) { bcm_dbg(Adapter, OTHERS, DUMP_INFO, ALL, "%#X\n", stClsEntry.pstPhsRule->u8PHSF[k]); @@ -1289,7 +1289,7 @@ void DumpPhsRules(PPHS_DEVICE_EXTENSION pDeviceExtension) stClsEntry.pstPhsRule->u8PHSMLength); bcm_dbg(Adapter, OTHERS, DUMP_INFO, ALL, "PHSM :\n"); - for(k=0;k<stClsEntry.pstPhsRule->u8PHSMLength;k++) { + for (k=0;k<stClsEntry.pstPhsRule->u8PHSMLength;k++) { bcm_dbg(Adapter, OTHERS, DUMP_INFO, ALL, "%#X\n", stClsEntry.pstPhsRule->u8PHSM[k]); @@ -1340,7 +1340,7 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, bcm_dbg(Adapter, OTHERS, PHS_RECEIVE, ALL, "====>\n"); *header_size = 0; - if((decomp_phs_rules == NULL )) + if ((decomp_phs_rules == NULL )) return 0; @@ -1352,14 +1352,14 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, phsf = tmp_memb->u8PHSF; phsm = tmp_memb->u8PHSM; - if(phss > MAX_PHS_LENGTHS) + if (phss > MAX_PHS_LENGTHS) phss = MAX_PHS_LENGTHS; //bcm_dbg(Adapter, OTHERS, PHS_RECEIVE, ALL, //"\nDECOMP:In phs_decompress PHSI %d phss %d index %d\n", phsi,phss,index)); - while((phss > 0) && (size < in_buf_len)) { + while ((phss > 0) && (size < in_buf_len)) { bit = ((*phsm << i)& SUPPRESS); - if(bit == SUPPRESS) { + if (bit == SUPPRESS) { *out_buf = *phsf; bcm_dbg(Adapter, OTHERS, PHS_RECEIVE, ALL, "DECOMP:In phss %d phsf %d ouput %d\n", @@ -1378,7 +1378,7 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, i++; *header_size=*header_size + 1; - if(i > MAX_NO_BIT) { + if (i > MAX_NO_BIT) { i=0; phsm++; } @@ -1415,7 +1415,7 @@ static int phs_compress(S_PHS_RULE *phs_rule,unsigned char *in_buf unsigned char *old_addr = out_buf; int supress = 0; PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - if(phs_rule == NULL) { + if (phs_rule == NULL) { bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, "phs_compress(): phs_rule null!\n"); *out_buf = ZERO_PHSI; @@ -1423,7 +1423,7 @@ static int phs_compress(S_PHS_RULE *phs_rule,unsigned char *in_buf } - if(phs_rule->u8PHSS <= *new_header_size) { + if (phs_rule->u8PHSS <= *new_header_size) { *header_size = phs_rule->u8PHSS; } else { *header_size = *new_header_size; @@ -1433,7 +1433,7 @@ static int phs_compress(S_PHS_RULE *phs_rule,unsigned char *in_buf supress = verify_suppress_phsf(in_buf,out_buf,phs_rule->u8PHSF, phs_rule->u8PHSM, phs_rule->u8PHSS, phs_rule->u8PHSV,new_header_size); - if(supress == STATUS_PHS_COMPRESSED) { + if (supress == STATUS_PHS_COMPRESSED) { *old_addr = (unsigned char)phs_rule->u8PHSI; bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, "COMP:In phs_compress phsi %d\n", phs_rule->u8PHSI); @@ -1477,15 +1477,15 @@ static int verify_suppress_phsf(unsigned char *in_buffer,unsigned char *out_buff "COMP:In verify_phsf PHSM - 0x%X\n", *phsm); - if(phss>(*new_header_size)) { + if (phss>(*new_header_size)) { phss=*new_header_size; } - while(phss > 0) { + while (phss > 0) { bit = ((*phsm << i)& SUPPRESS); - if(bit == SUPPRESS) { + if (bit == SUPPRESS) { - if(*in_buffer != *phsf) { - if(phsv == VERIFY) { + if (*in_buffer != *phsf) { + if (phsv == VERIFY) { bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, "COMP:In verify_phsf failed for field %d buf %d phsf %d\n", phss, *in_buffer, *phsf); @@ -1507,7 +1507,7 @@ static int verify_suppress_phsf(unsigned char *in_buffer,unsigned char *out_buff phsf++; phss--; i++; - if(i > MAX_NO_BIT) { + if (i > MAX_NO_BIT) { i=0; phsm++; } diff --git a/drivers/staging/bcm/Qos.c b/drivers/staging/bcm/Qos.c index 999c0e4..17c8e4d 100644 --- a/drivers/staging/bcm/Qos.c +++ b/drivers/staging/bcm/Qos.c @@ -31,15 +31,15 @@ BOOLEAN MatchSrcIpAddress(S_CLASSIFIER_RULE *pstClassifierRule,ULONG ulSrcIP) PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); ulSrcIP=ntohl(ulSrcIP); - if(0 == pstClassifierRule->ucIPSourceAddressLength) + if (0 == pstClassifierRule->ucIPSourceAddressLength) return TRUE; - for(ucLoopIndex=0; ucLoopIndex < (pstClassifierRule->ucIPSourceAddressLength);ucLoopIndex++) { + for (ucLoopIndex=0; ucLoopIndex < (pstClassifierRule->ucIPSourceAddressLength);ucLoopIndex++) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "Src Ip Address Mask:0x%x PacketIp:0x%x and Classification:0x%x\n", (UINT)pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex], (UINT)ulSrcIP, (UINT)pstClassifierRule->stSrcIpAddress.ulIpv6Addr[ucLoopIndex]); - if((pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex] & ulSrcIP)== + if ((pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex] & ulSrcIP)== (pstClassifierRule->stSrcIpAddress.ulIpv4Addr[ucLoopIndex] & pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex] )) { return TRUE; } @@ -66,7 +66,7 @@ BOOLEAN MatchDestIpAddress(S_CLASSIFIER_RULE *pstClassifierRule,ULONG ulDestIP) PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); ulDestIP=ntohl(ulDestIP); - if(0 == pstClassifierRule->ucIPDestinationAddressLength) + if (0 == pstClassifierRule->ucIPDestinationAddressLength) return TRUE; bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "Destination Ip Address 0x%x 0x%x 0x%x\n", @@ -74,8 +74,8 @@ BOOLEAN MatchDestIpAddress(S_CLASSIFIER_RULE *pstClassifierRule,ULONG ulDestIP) (UINT)pstClassifierRule->stDestIpAddress.ulIpv4Mask[ucLoopIndex], (UINT)pstClassifierRule->stDestIpAddress.ulIpv4Addr[ucLoopIndex]); - for(ucLoopIndex=0;ucLoopIndex<(pstClassifierRule->ucIPDestinationAddressLength);ucLoopIndex++) { - if((pstClassifierRule->stDestIpAddress.ulIpv4Mask[ucLoopIndex] & ulDestIP)== + for (ucLoopIndex=0;ucLoopIndex<(pstClassifierRule->ucIPDestinationAddressLength);ucLoopIndex++) { + if ((pstClassifierRule->stDestIpAddress.ulIpv4Mask[ucLoopIndex] & ulDestIP)== (pstClassifierRule->stDestIpAddress.ulIpv4Addr[ucLoopIndex] & pstClassifierRule->stDestIpAddress.ulIpv4Mask[ucLoopIndex])) { return TRUE; } @@ -100,10 +100,10 @@ BOOLEAN MatchTos(S_CLASSIFIER_RULE *pstClassifierRule,UCHAR ucTypeOfService) { PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - if( 3 != pstClassifierRule->ucIPTypeOfServiceLength ) + if ( 3 != pstClassifierRule->ucIPTypeOfServiceLength ) return TRUE; - if(((pstClassifierRule->ucTosMask & ucTypeOfService)<=pstClassifierRule->ucTosHigh) && ((pstClassifierRule->ucTosMask & ucTypeOfService)>=pstClassifierRule->ucTosLow)) { + if (((pstClassifierRule->ucTosMask & ucTypeOfService)<=pstClassifierRule->ucTosHigh) && ((pstClassifierRule->ucTosMask & ucTypeOfService)>=pstClassifierRule->ucTosLow)) { return TRUE; } bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "Type Of Service Not Matched\n"); @@ -125,13 +125,13 @@ BOOLEAN MatchProtocol(S_CLASSIFIER_RULE *pstClassifierRule,UCHAR ucProtocol) { UCHAR ucLoopIndex=0; PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - if(0 == pstClassifierRule->ucProtocolLength) + if (0 == pstClassifierRule->ucProtocolLength) return TRUE; - for(ucLoopIndex=0;ucLoopIndex<pstClassifierRule->ucProtocolLength;ucLoopIndex++) { + for (ucLoopIndex=0;ucLoopIndex<pstClassifierRule->ucProtocolLength;ucLoopIndex++) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "Protocol:0x%X Classification Protocol:0x%X\n", ucProtocol, pstClassifierRule->ucProtocol[ucLoopIndex]); - if(pstClassifierRule->ucProtocol[ucLoopIndex]==ucProtocol) { + if (pstClassifierRule->ucProtocol[ucLoopIndex]==ucProtocol) { return TRUE; } } @@ -157,10 +157,10 @@ BOOLEAN MatchSrcPort(S_CLASSIFIER_RULE *pstClassifierRule,USHORT ushSrcPort) PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - if(0 == pstClassifierRule->ucSrcPortRangeLength) + if (0 == pstClassifierRule->ucSrcPortRangeLength) return TRUE; - for(ucLoopIndex=0;ucLoopIndex<pstClassifierRule->ucSrcPortRangeLength;ucLoopIndex++) { - if(ushSrcPort <= pstClassifierRule->usSrcPortRangeHi[ucLoopIndex] && + for (ucLoopIndex=0;ucLoopIndex<pstClassifierRule->ucSrcPortRangeLength;ucLoopIndex++) { + if (ushSrcPort <= pstClassifierRule->usSrcPortRangeHi[ucLoopIndex] && ushSrcPort >= pstClassifierRule->usSrcPortRangeLo[ucLoopIndex]) { return TRUE; } @@ -186,17 +186,17 @@ BOOLEAN MatchDestPort(S_CLASSIFIER_RULE *pstClassifierRule,USHORT ushDestPort) UCHAR ucLoopIndex=0; PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - if(0 == pstClassifierRule->ucDestPortRangeLength) + if (0 == pstClassifierRule->ucDestPortRangeLength) return TRUE; - for(ucLoopIndex=0;ucLoopIndex<pstClassifierRule->ucDestPortRangeLength;ucLoopIndex++) { + for (ucLoopIndex=0;ucLoopIndex<pstClassifierRule->ucDestPortRangeLength;ucLoopIndex++) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "Matching Port:0x%X 0x%X 0x%X\n", ushDestPort, pstClassifierRule->usDestPortRangeLo[ucLoopIndex], pstClassifierRule->usDestPortRangeHi[ucLoopIndex]); - if(ushDestPort <= pstClassifierRule->usDestPortRangeHi[ucLoopIndex] && + if (ushDestPort <= pstClassifierRule->usDestPortRangeHi[ucLoopIndex] && ushDestPort >= pstClassifierRule->usDestPortRangeLo[ucLoopIndex]) { return TRUE; } @@ -228,31 +228,31 @@ static USHORT IpVersion4(PMINI_ADAPTER Adapter, pstClassifierRule->usVCID_Value); //Checking classifier validity - if(!pstClassifierRule->bUsed || pstClassifierRule->ucDirection == DOWNLINK_DIR) { + if (!pstClassifierRule->bUsed || pstClassifierRule->ucDirection == DOWNLINK_DIR) { bClassificationSucceed = FALSE; break; } bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "is IPv6 check!\n"); - if(pstClassifierRule->bIpv6Protocol) + if (pstClassifierRule->bIpv6Protocol) break; //**************Checking IP header parameter**************************// bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "Trying to match Source IP Address\n"); - if(FALSE == (bClassificationSucceed = + if (FALSE == (bClassificationSucceed = MatchSrcIpAddress(pstClassifierRule, iphd->saddr))) break; bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "Source IP Address Matched\n"); - if(FALSE == (bClassificationSucceed = + if (FALSE == (bClassificationSucceed = MatchDestIpAddress(pstClassifierRule, iphd->daddr))) break; bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "Destination IP Address Matched\n"); - if(FALSE == (bClassificationSucceed = + if (FALSE == (bClassificationSucceed = MatchTos(pstClassifierRule, iphd->tos))) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "TOS Match failed\n"); @@ -260,19 +260,19 @@ static USHORT IpVersion4(PMINI_ADAPTER Adapter, } bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "TOS Matched\n"); - if(FALSE == (bClassificationSucceed = + if (FALSE == (bClassificationSucceed = MatchProtocol(pstClassifierRule,iphd->protocol))) break; bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "Protocol Matched\n"); //if protocol is not TCP or UDP then no need of comparing source port and destination port - if(iphd->protocol!=TCP && iphd->protocol!=UDP) + if (iphd->protocol!=TCP && iphd->protocol!=UDP) break; //******************Checking Transport Layer Header field if present *****************// bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "Source Port %04x\n", (iphd->protocol==UDP)?xprt_hdr->uhdr.source:xprt_hdr->thdr.source); - if(FALSE == (bClassificationSucceed = + if (FALSE == (bClassificationSucceed = MatchSrcPort(pstClassifierRule, ntohs((iphd->protocol == UDP)? xprt_hdr->uhdr.source:xprt_hdr->thdr.source)))) @@ -282,20 +282,20 @@ static USHORT IpVersion4(PMINI_ADAPTER Adapter, bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "Destination Port %04x\n", (iphd->protocol==UDP)?xprt_hdr->uhdr.dest: xprt_hdr->thdr.dest); - if(FALSE == (bClassificationSucceed = + if (FALSE == (bClassificationSucceed = MatchDestPort(pstClassifierRule, ntohs((iphd->protocol == UDP)? xprt_hdr->uhdr.dest:xprt_hdr->thdr.dest)))) break; - } while(0); + } while (0); - if(TRUE==bClassificationSucceed) { + if (TRUE==bClassificationSucceed) { INT iMatchedSFQueueIndex = 0; iMatchedSFQueueIndex = SearchSfid(Adapter,pstClassifierRule->ulSFID); - if(iMatchedSFQueueIndex >= NO_OF_QUEUES) { + if (iMatchedSFQueueIndex >= NO_OF_QUEUES) { bClassificationSucceed = FALSE; } else { - if(FALSE == Adapter->PackInfo[iMatchedSFQueueIndex].bActive) { + if (FALSE == Adapter->PackInfo[iMatchedSFQueueIndex].bActive) { bClassificationSucceed = FALSE; } } @@ -310,8 +310,8 @@ VOID PruneQueueAllSF(PMINI_ADAPTER Adapter) { UINT iIndex = 0; - for(iIndex = 0; iIndex < HiPriority; iIndex++) { - if(!Adapter->PackInfo[iIndex].bValid) + for (iIndex = 0; iIndex < HiPriority; iIndex++) { + if (!Adapter->PackInfo[iIndex].bValid) continue; PruneQueue(Adapter, iIndex); @@ -333,10 +333,10 @@ static VOID PruneQueue(PMINI_ADAPTER Adapter, INT iIndex) bcm_dbg(Adapter, TX, PRUNE_QUEUE, ALL, "=====> Index %d\n", iIndex); - if(iIndex == HiPriority) + if (iIndex == HiPriority) return; - if(!Adapter || (iIndex < 0) || (iIndex > HiPriority)) + if (!Adapter || (iIndex < 0) || (iIndex > HiPriority)) return; /* To Store the netdevice statistic */ @@ -344,8 +344,8 @@ static VOID PruneQueue(PMINI_ADAPTER Adapter, INT iIndex) spin_lock_bh(&Adapter->PackInfo[iIndex].SFQueueLock); - while(1) { -// while((UINT)Adapter->PackInfo[iIndex].uiCurrentPacketsOnHost > + while (1) { +// while ((UINT)Adapter->PackInfo[iIndex].uiCurrentPacketsOnHost > // SF_MAX_ALLOWED_PACKETS_TO_BACKUP) { bcm_dbg(Adapter, TX, PRUNE_QUEUE, ALL, "uiCurrentBytesOnHost:%x uiMaxBucketSize :%x\n", @@ -354,13 +354,13 @@ static VOID PruneQueue(PMINI_ADAPTER Adapter, INT iIndex) PacketToDrop = Adapter->PackInfo[iIndex].FirstTxQueue; - if(PacketToDrop == NULL) + if (PacketToDrop == NULL) break; - if((Adapter->PackInfo[iIndex].uiCurrentPacketsOnHost < SF_MAX_ALLOWED_PACKETS_TO_BACKUP) && + if ((Adapter->PackInfo[iIndex].uiCurrentPacketsOnHost < SF_MAX_ALLOWED_PACKETS_TO_BACKUP) && ((1000*(jiffies - *((B_UINT32 *)(PacketToDrop->cb)+SKB_CB_LATENCY_OFFSET))/HZ) <= Adapter->PackInfo[iIndex].uiMaxLatency)) break; - if(PacketToDrop) { + if (PacketToDrop) { if (netif_msg_tx_err(Adapter)) pr_info("%s: tx queue %d overlimit\n", Adapter->dev->name, iIndex); @@ -404,13 +404,13 @@ VOID flush_all_queues(PMINI_ADAPTER Adapter) bcm_dbg(Adapter, OTHERS, DUMP_INFO, ALL, "=====>\n"); // down(&Adapter->data_packet_queue_lock); - for(iQIndex=LowPriority; iQIndex<HiPriority; iQIndex++) { + for (iQIndex=LowPriority; iQIndex<HiPriority; iQIndex++) { struct net_device_stats *netstats = &Adapter->dev->stats; spin_lock_bh(&Adapter->PackInfo[iQIndex].SFQueueLock); - while(Adapter->PackInfo[iQIndex].FirstTxQueue) { + while (Adapter->PackInfo[iQIndex].FirstTxQueue) { PacketToDrop = Adapter->PackInfo[iQIndex].FirstTxQueue; - if(PacketToDrop) { + if (PacketToDrop) { uiTotalPacketLength = PacketToDrop->len; netstats->tx_dropped++; } else @@ -462,7 +462,7 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) *((UINT32*) (skb->cb) +SKB_CB_TCPACK_OFFSET ) = 0; EThCSGetPktInfo(Adapter,pvEThPayload,&stEthCsPktInfo); - switch(stEthCsPktInfo.eNwpktEthFrameType) { + switch (stEthCsPktInfo.eNwpktEthFrameType) { case eEth802LLCFrame: { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "ClassifyPacket : 802LLCFrame\n"); @@ -497,20 +497,20 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) } } - if(stEthCsPktInfo.eNwpktIPFrameType == eIPv4Packet) { + if (stEthCsPktInfo.eNwpktIPFrameType == eIPv4Packet) { usCurrFragment = (ntohs(pIpHeader->frag_off) & IP_OFFSET); - if((ntohs(pIpHeader->frag_off) & IP_MF) || usCurrFragment) + if ((ntohs(pIpHeader->frag_off) & IP_MF) || usCurrFragment) bFragmentedPkt = TRUE; - if(bFragmentedPkt) { + if (bFragmentedPkt) { //Fragmented Packet. Get Frag Classifier Entry. pstClassifierRule = GetFragIPClsEntry(Adapter,pIpHeader->id, pIpHeader->saddr); - if(pstClassifierRule) { + if (pstClassifierRule) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "It is next Fragmented pkt\n"); bClassificationSucceed=TRUE; } - if(!(ntohs(pIpHeader->frag_off) & IP_MF)) { + if (!(ntohs(pIpHeader->frag_off) & IP_MF)) { //Fragmented Last packet . Remove Frag Classifier Entry bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "This is the last fragmented Pkt\n"); @@ -519,14 +519,14 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) } } - for(uiLoopIndex = MAX_CLASSIFIERS - 1; uiLoopIndex >= 0; uiLoopIndex--) { - if(bClassificationSucceed) + for (uiLoopIndex = MAX_CLASSIFIERS - 1; uiLoopIndex >= 0; uiLoopIndex--) { + if (bClassificationSucceed) break; //Iterate through all classifiers which are already in order of priority //to classify the packet until match found do { - if(FALSE==Adapter->astClassifierTable[uiLoopIndex].bUsed) { + if (FALSE==Adapter->astClassifierTable[uiLoopIndex].bUsed) { bClassificationSucceed=FALSE; break; } @@ -534,7 +534,7 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) "Adapter->PackInfo[%d].bvalid=True\n", uiLoopIndex); - if(0 == Adapter->astClassifierTable[uiLoopIndex].ucDirection) { + if (0 == Adapter->astClassifierTable[uiLoopIndex].ucDirection) { bClassificationSucceed=FALSE;//cannot be processed for classification. break; // it is a down link connection } @@ -548,9 +548,9 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) break; } - if(Adapter->PackInfo[uiSfIndex].bEthCSSupport) { + if (Adapter->PackInfo[uiSfIndex].bEthCSSupport) { - if(eEthUnsupportedFrame==stEthCsPktInfo.eNwpktEthFrameType) { + if (eEthUnsupportedFrame==stEthCsPktInfo.eNwpktEthFrameType) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "ClassifyPacket : Packet Not a Valid Supported Ethernet Frame\n"); bClassificationSucceed = FALSE; @@ -565,7 +565,7 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) Adapter->PackInfo[uiSfIndex].ulSFID); bClassificationSucceed = EThCSClassifyPkt(Adapter,skb,&stEthCsPktInfo,pstClassifierRule, Adapter->PackInfo[uiSfIndex].bEthCSSupport); - if(!bClassificationSucceed) { + if (!bClassificationSucceed) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "ClassifyPacket : Ethernet CS Classification Failed\n"); break; @@ -574,7 +574,7 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) else // No ETH Supported on this SF { - if(eEthOtherFrame != stEthCsPktInfo.eNwpktEthFrameType) { + if (eEthOtherFrame != stEthCsPktInfo.eNwpktEthFrameType) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "ClassifyPacket : Packet Not a 802.3 Ethernet Frame... hence not allowed over non-ETH CS SF\n"); bClassificationSucceed = FALSE; @@ -585,9 +585,9 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "Proceeding to IP CS Clasification\n"); - if(Adapter->PackInfo[uiSfIndex].bIPCSSupport) { + if (Adapter->PackInfo[uiSfIndex].bIPCSSupport) { - if(stEthCsPktInfo.eNwpktIPFrameType == eNonIPPacket) { + if (stEthCsPktInfo.eNwpktIPFrameType == eNonIPPacket) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "ClassifyPacket : Packet is Not an IP Packet\n"); bClassificationSucceed = FALSE; @@ -597,16 +597,16 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) "Dump IP Header :\n"); DumpFullPacket((PUCHAR)pIpHeader,20); - if(stEthCsPktInfo.eNwpktIPFrameType == eIPv4Packet) + if (stEthCsPktInfo.eNwpktIPFrameType == eIPv4Packet) bClassificationSucceed = IpVersion4(Adapter,pIpHeader,pstClassifierRule); - else if(stEthCsPktInfo.eNwpktIPFrameType == eIPv6Packet) + else if (stEthCsPktInfo.eNwpktIPFrameType == eIPv6Packet) bClassificationSucceed = IpVersion6(Adapter,pIpHeader,pstClassifierRule); } - }while(0); + }while (0); } - if(bClassificationSucceed == TRUE) { + if (bClassificationSucceed == TRUE) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "CF id : %d, SF ID is =%lu\n", pstClassifierRule->uiClassifierRuleIndex, @@ -614,12 +614,12 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) //Store The matched Classifier in SKB *((UINT32*)(skb->cb)+SKB_CB_CLASSIFICATION_OFFSET) = pstClassifierRule->uiClassifierRuleIndex; - if((TCP == pIpHeader->protocol ) && !bFragmentedPkt && (ETH_AND_IP_HEADER_LEN + TCP_HEADER_LEN <= skb->len) ) { + if ((TCP == pIpHeader->protocol ) && !bFragmentedPkt && (ETH_AND_IP_HEADER_LEN + TCP_HEADER_LEN <= skb->len) ) { IpHeaderLength = pIpHeader->ihl; pTcpHeader = (PTCP_HEADER)(((PUCHAR)pIpHeader)+(IpHeaderLength*4)); TcpHeaderLength = GET_TCP_HEADER_LEN(pTcpHeader->HeaderLength); - if((pTcpHeader->ucFlags & TCP_ACK) && + if ((pTcpHeader->ucFlags & TCP_ACK) && (ntohs(pIpHeader->tot_len) == (IpHeaderLength*4)+(TcpHeaderLength*4))) { *((UINT32*) (skb->cb) +SKB_CB_TCPACK_OFFSET ) = TCP_ACK; } @@ -630,7 +630,7 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) "index is =%d\n", usIndex); //If this is the first fragment of a Fragmented pkt, add this CF. Only This CF should be used for all other fragment of this Pkt. - if(bFragmentedPkt && (usCurrFragment == 0)) { + if (bFragmentedPkt && (usCurrFragment == 0)) { //First Fragment of Fragmented Packet. Create Frag CLS Entry S_FRAGMENTED_PACKET_INFO stFragPktInfo; stFragPktInfo.bUsed = TRUE; @@ -644,7 +644,7 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) } - if(bClassificationSucceed) + if (bClassificationSucceed) return usIndex; else return INVALID_QUEUE_INDEX; @@ -654,15 +654,15 @@ static BOOLEAN EthCSMatchSrcMACAddress(S_CLASSIFIER_RULE *pstClassifierRule,PUCH { UINT i=0; PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - if(pstClassifierRule->ucEthCSSrcMACLen==0) + if (pstClassifierRule->ucEthCSSrcMACLen==0) return TRUE; bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "%s\n", __func__); - for(i=0;i<MAC_ADDRESS_SIZE;i++) { + for (i=0;i<MAC_ADDRESS_SIZE;i++) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "SRC MAC[%x] = %x ClassifierRuleSrcMAC = %x Mask : %x\n", i, Mac[i], pstClassifierRule->au8EThCSSrcMAC[i], pstClassifierRule->au8EThCSSrcMACMask[i]); - if((pstClassifierRule->au8EThCSSrcMAC[i] & pstClassifierRule->au8EThCSSrcMACMask[i])!= + if ((pstClassifierRule->au8EThCSSrcMAC[i] & pstClassifierRule->au8EThCSSrcMACMask[i])!= (Mac[i] & pstClassifierRule->au8EThCSSrcMACMask[i])) return FALSE; } @@ -673,15 +673,15 @@ static BOOLEAN EthCSMatchDestMACAddress(S_CLASSIFIER_RULE *pstClassifierRule,PUC { UINT i=0; PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - if(pstClassifierRule->ucEthCSDestMACLen==0) + if (pstClassifierRule->ucEthCSDestMACLen==0) return TRUE; bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "%s\n", __func__); - for(i=0;i<MAC_ADDRESS_SIZE;i++) { + for (i=0;i<MAC_ADDRESS_SIZE;i++) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "SRC MAC[%x] = %x ClassifierRuleSrcMAC = %x Mask : %x\n", i, Mac[i], pstClassifierRule->au8EThCSDestMAC[i], pstClassifierRule->au8EThCSDestMACMask[i]); - if((pstClassifierRule->au8EThCSDestMAC[i] & pstClassifierRule->au8EThCSDestMACMask[i])!= + if ((pstClassifierRule->au8EThCSDestMAC[i] & pstClassifierRule->au8EThCSDestMACMask[i])!= (Mac[i] & pstClassifierRule->au8EThCSDestMACMask[i])) return FALSE; } @@ -691,7 +691,7 @@ static BOOLEAN EthCSMatchDestMACAddress(S_CLASSIFIER_RULE *pstClassifierRule,PUC static BOOLEAN EthCSMatchEThTypeSAP(S_CLASSIFIER_RULE *pstClassifierRule,struct sk_buff* skb,PS_ETHCS_PKT_INFO pstEthCsPktInfo) { PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - if((pstClassifierRule->ucEtherTypeLen==0)|| + if ((pstClassifierRule->ucEtherTypeLen==0)|| (pstClassifierRule->au8EthCSEtherType[0] == 0)) return TRUE; @@ -699,21 +699,21 @@ static BOOLEAN EthCSMatchEThTypeSAP(S_CLASSIFIER_RULE *pstClassifierRule,struct "%s SrcEtherType:%x CLS EtherType[0]:%x\n", __func__, pstEthCsPktInfo->usEtherType, pstClassifierRule->au8EthCSEtherType[0]); - if(pstClassifierRule->au8EthCSEtherType[0] == 1) { + if (pstClassifierRule->au8EthCSEtherType[0] == 1) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "%s CLS EtherType[1]:%x EtherType[2]:%x\n", __func__, pstClassifierRule->au8EthCSEtherType[1], pstClassifierRule->au8EthCSEtherType[2]); - if(memcmp(&pstEthCsPktInfo->usEtherType,&pstClassifierRule->au8EthCSEtherType[1],2)==0) + if (memcmp(&pstEthCsPktInfo->usEtherType,&pstClassifierRule->au8EthCSEtherType[1],2)==0) return TRUE; else return FALSE; } - if(pstClassifierRule->au8EthCSEtherType[0] == 2) { - if(eEth802LLCFrame != pstEthCsPktInfo->eNwpktEthFrameType) + if (pstClassifierRule->au8EthCSEtherType[0] == 2) { + if (eEth802LLCFrame != pstEthCsPktInfo->eNwpktEthFrameType) return FALSE; bcm_dbg(Adapter, TX, IPV4_DBG, ALL, @@ -721,7 +721,7 @@ static BOOLEAN EthCSMatchEThTypeSAP(S_CLASSIFIER_RULE *pstClassifierRule,struct __func__, pstEthCsPktInfo->ucDSAP, pstClassifierRule->au8EthCSEtherType[2]); - if(pstEthCsPktInfo->ucDSAP == pstClassifierRule->au8EthCSEtherType[2]) + if (pstEthCsPktInfo->ucDSAP == pstClassifierRule->au8EthCSEtherType[2]) return TRUE; else return FALSE; @@ -746,16 +746,16 @@ static BOOLEAN EthCSMatchVLANRules(S_CLASSIFIER_RULE *pstClassifierRule,struct s pstClassifierRule->usVLANID); /* In case FW didn't receive the TLV, the priority field should be ignored */ - if(pstClassifierRule->usValidityBitMap & (1<<PKT_CLASSIFICATION_USER_PRIORITY_VALID)) { - if(pstEthCsPktInfo->eNwpktEthFrameType!=eEth802QVLANFrame) + if (pstClassifierRule->usValidityBitMap & (1<<PKT_CLASSIFICATION_USER_PRIORITY_VALID)) { + if (pstEthCsPktInfo->eNwpktEthFrameType!=eEth802QVLANFrame) return FALSE; uPriority = (ntohs(*(USHORT *)(skb->data + sizeof(ETH_HEADER_STRUC))) & 0xF000) >> 13; - if((uPriority >= pstClassifierRule->usUserPriority[0]) && (uPriority <= pstClassifierRule->usUserPriority[1])) + if ((uPriority >= pstClassifierRule->usUserPriority[0]) && (uPriority <= pstClassifierRule->usUserPriority[1])) bClassificationSucceed = TRUE; - if(!bClassificationSucceed) + if (!bClassificationSucceed) return FALSE; } @@ -764,8 +764,8 @@ static BOOLEAN EthCSMatchVLANRules(S_CLASSIFIER_RULE *pstClassifierRule,struct s bClassificationSucceed = FALSE; - if(pstClassifierRule->usValidityBitMap & (1<<PKT_CLASSIFICATION_VLANID_VALID)) { - if(pstEthCsPktInfo->eNwpktEthFrameType!=eEth802QVLANFrame) + if (pstClassifierRule->usValidityBitMap & (1<<PKT_CLASSIFICATION_VLANID_VALID)) { + if (pstEthCsPktInfo->eNwpktEthFrameType!=eEth802QVLANFrame) return FALSE; usVLANID = ntohs(*(USHORT *)(skb->data + sizeof(ETH_HEADER_STRUC))) & 0xFFF; @@ -774,10 +774,10 @@ static BOOLEAN EthCSMatchVLANRules(S_CLASSIFIER_RULE *pstClassifierRule,struct s "%s Pkt VLANID %x Priority: %d\n", __func__, usVLANID, uPriority); - if(usVLANID == ((pstClassifierRule->usVLANID & 0xFFF0) >> 4)) + if (usVLANID == ((pstClassifierRule->usVLANID & 0xFFF0) >> 4)) bClassificationSucceed = TRUE; - if(!bClassificationSucceed) + if (!bClassificationSucceed) return FALSE; } @@ -795,18 +795,18 @@ static BOOLEAN EThCSClassifyPkt(PMINI_ADAPTER Adapter,struct sk_buff* skb, { BOOLEAN bClassificationSucceed = FALSE; bClassificationSucceed = EthCSMatchSrcMACAddress(pstClassifierRule,((ETH_HEADER_STRUC *)(skb->data))->au8SourceAddress); - if(!bClassificationSucceed) + if (!bClassificationSucceed) return FALSE; bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "ETH CS SrcMAC Matched\n"); bClassificationSucceed = EthCSMatchDestMACAddress(pstClassifierRule,((ETH_HEADER_STRUC*)(skb->data))->au8DestinationAddress); - if(!bClassificationSucceed) + if (!bClassificationSucceed) return FALSE; bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "ETH CS DestMAC Matched\n"); //classify on ETHType/802.2SAP TLV bClassificationSucceed = EthCSMatchEThTypeSAP(pstClassifierRule,skb,pstEthCsPktInfo); - if(!bClassificationSucceed) + if (!bClassificationSucceed) return FALSE; bcm_dbg(Adapter, TX, IPV4_DBG, ALL, @@ -815,7 +815,7 @@ static BOOLEAN EThCSClassifyPkt(PMINI_ADAPTER Adapter,struct sk_buff* skb, //classify on 802.1VLAN Header Parameters bClassificationSucceed = EthCSMatchVLANRules(pstClassifierRule,skb,pstEthCsPktInfo); - if(!bClassificationSucceed) + if (!bClassificationSucceed) return FALSE; bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "ETH CS 802.1 VLAN Rules Matched\n"); @@ -830,11 +830,11 @@ static void EThCSGetPktInfo(PMINI_ADAPTER Adapter,PVOID pvEthPayload, bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "EthCSGetPktInfo : Eth Hdr Type : %X\n", u16Etype); - if(u16Etype > 0x5dc) { + if (u16Etype > 0x5dc) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "EthCSGetPktInfo : ETH2 Frame\n"); //ETH2 Frame - if(u16Etype == ETHERNET_FRAMETYPE_802QVLAN) { + if (u16Etype == ETHERNET_FRAMETYPE_802QVLAN) { //802.1Q VLAN Header pstEthCsPktInfo->eNwpktEthFrameType = eEth802QVLANFrame; u16Etype = ((ETH_CS_802_Q_FRAME*)pvEthPayload)->EthType; @@ -849,15 +849,15 @@ static void EThCSGetPktInfo(PMINI_ADAPTER Adapter,PVOID pvEthPayload, bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "802.2 LLC Frame\n"); pstEthCsPktInfo->eNwpktEthFrameType = eEth802LLCFrame; pstEthCsPktInfo->ucDSAP = ((ETH_CS_802_LLC_FRAME*)pvEthPayload)->DSAP; - if(pstEthCsPktInfo->ucDSAP == 0xAA && ((ETH_CS_802_LLC_FRAME*)pvEthPayload)->SSAP == 0xAA) { + if (pstEthCsPktInfo->ucDSAP == 0xAA && ((ETH_CS_802_LLC_FRAME*)pvEthPayload)->SSAP == 0xAA) { //SNAP Frame pstEthCsPktInfo->eNwpktEthFrameType = eEth802LLCSNAPFrame; u16Etype = ((ETH_CS_802_LLC_SNAP_FRAME*)pvEthPayload)->usEtherType; } } - if(u16Etype == ETHERNET_FRAMETYPE_IPV4) + if (u16Etype == ETHERNET_FRAMETYPE_IPV4) pstEthCsPktInfo->eNwpktIPFrameType = eIPv4Packet; - else if(u16Etype == ETHERNET_FRAMETYPE_IPV6) + else if (u16Etype == ETHERNET_FRAMETYPE_IPV6) pstEthCsPktInfo->eNwpktIPFrameType = eIPv6Packet; else pstEthCsPktInfo->eNwpktIPFrameType = eNonIPPacket; diff --git a/drivers/staging/bcm/Queue.h b/drivers/staging/bcm/Queue.h index 7aede02..b387283 100644 --- a/drivers/staging/bcm/Queue.h +++ b/drivers/staging/bcm/Queue.h @@ -17,15 +17,15 @@ } \ (_Packet)->next = NULL; \ _Tail = _Packet; \ - }while(0) + }while (0) #define DEQUEUEPACKET(Head, Tail ) \ do \ - { if(Head) \ + { if (Head) \ { \ if (!Head->next) { \ Tail = NULL; \ } \ Head = Head->next; \ } \ - }while(0) + }while (0) #endif //__QUEUE_H__ diff --git a/drivers/staging/bcm/Transmit.c b/drivers/staging/bcm/Transmit.c index 7cb20b8..5b33d12 100644 --- a/drivers/staging/bcm/Transmit.c +++ b/drivers/staging/bcm/Transmit.c @@ -46,12 +46,12 @@ INT SendControlPacket(PMINI_ADAPTER Adapter, char *pControlPacket) PLEADER PLeader = (PLEADER)pControlPacket; bcm_dbg(Adapter, TX, TX_CONTROL, ALL, "Tx\n"); - if(!pControlPacket || !Adapter) { + if (!pControlPacket || !Adapter) { bcm_dbg(Adapter, TX, TX_CONTROL, ALL, "Got NULL Control Packet or Adapter\n"); return STATUS_FAILURE; } - if((atomic_read( &Adapter->CurrNumFreeTxDesc ) < + if ((atomic_read( &Adapter->CurrNumFreeTxDesc ) < ((PLeader->PLength-1)/MAX_DEVICE_DESC_SIZE)+1)) { bcm_dbg(Adapter, TX, TX_CONTROL, ALL, "NO FREE DESCRIPTORS TO SEND CONTROL PACKET\n"); @@ -66,7 +66,7 @@ INT SendControlPacket(PMINI_ADAPTER Adapter, char *pControlPacket) "Leader VCID: %x\n", PLeader->Vcid); bcm_dbg(Adapter, TX, TX_CONTROL, ALL, "Leader Length: %x\n", PLeader->PLength); - if(Adapter->device_removed) + if (Adapter->device_removed) return 0; if (netif_msg_pktdata(Adapter)) @@ -95,7 +95,7 @@ INT SetupNextSend(PMINI_ADAPTER Adapter, struct sk_buff *Packet, USHORT Vcid) u16 QueueIndex = skb_get_queue_mapping(Packet); LEADER Leader={0}; - if(Packet->len > MAX_DEVICE_DESC_SIZE) { + if (Packet->len > MAX_DEVICE_DESC_SIZE) { status = STATUS_FAILURE; goto errExit; } @@ -106,7 +106,7 @@ INT SetupNextSend(PMINI_ADAPTER Adapter, struct sk_buff *Packet, USHORT Vcid) bHeaderSupressionEnabled = Adapter->PackInfo[QueueIndex].bHeaderSuppressionEnabled & Adapter->bPHSEnabled; - if(Adapter->device_removed) { + if (Adapter->device_removed) { status = STATUS_FAILURE; goto errExit; } @@ -114,7 +114,7 @@ INT SetupNextSend(PMINI_ADAPTER Adapter, struct sk_buff *Packet, USHORT Vcid) status = PHSTransmit(Adapter, &Packet, Vcid, uiClassifierRuleID, bHeaderSupressionEnabled, (UINT *)&Packet->len, Adapter->PackInfo[QueueIndex].bEthCSSupport); - if(status != STATUS_SUCCESS) { + if (status != STATUS_SUCCESS) { bcm_dbg(Adapter, TX, NEXT_SEND, ALL, "PHS Transmit failed..\n"); goto errExit; @@ -122,15 +122,15 @@ INT SetupNextSend(PMINI_ADAPTER Adapter, struct sk_buff *Packet, USHORT Vcid) Leader.Vcid = Vcid; - if(TCP_ACK == *((UINT32*) (Packet->cb) + SKB_CB_TCPACK_OFFSET )) + if (TCP_ACK == *((UINT32*) (Packet->cb) + SKB_CB_TCPACK_OFFSET )) Leader.Status = LEADER_STATUS_TCP_ACK; else Leader.Status = LEADER_STATUS; - if(Adapter->PackInfo[QueueIndex].bEthCSSupport) { + if (Adapter->PackInfo[QueueIndex].bEthCSSupport) { Leader.PLength = Packet->len; - if(skb_headroom(Packet) < LEADER_SIZE) { - if((status = skb_cow(Packet,LEADER_SIZE))) { + if (skb_headroom(Packet) < LEADER_SIZE) { + if ((status = skb_cow(Packet,LEADER_SIZE))) { bcm_dbg(Adapter, TX, NEXT_SEND, ALL, "bcm_transmit : Failed To Increase headRoom\n"); goto errExit; @@ -145,7 +145,7 @@ INT SetupNextSend(PMINI_ADAPTER Adapter, struct sk_buff *Packet, USHORT Vcid) status = Adapter->interface_transmit(Adapter->pvInterfaceAdapter, Packet->data, (Leader.PLength + LEADER_SIZE)); - if(status) { + if (status) { ++Adapter->dev->stats.tx_errors; if (netif_msg_tx_err(Adapter)) pr_info("%s: transmit error %d\n", @@ -190,9 +190,9 @@ int tx_pkt_handler(PMINI_ADAPTER Adapter /**< pointer to adapter object*/ { int status = 0; - while(! kthread_should_stop()) { + while (! kthread_should_stop()) { /* FIXME - the timeout looks like workaround for racey usage of TxPktAvail */ - if(Adapter->LinkUpStatus) + if (Adapter->LinkUpStatus) wait_event_timeout(Adapter->tx_packet_wait_queue, tx_pending(Adapter), msecs_to_jiffies(10)); else @@ -202,28 +202,28 @@ int tx_pkt_handler(PMINI_ADAPTER Adapter /**< pointer to adapter object*/ if (Adapter->device_removed) break; - if(Adapter->downloadDDR == 1) { + if (Adapter->downloadDDR == 1) { Adapter->downloadDDR +=1; status = download_ddr_settings(Adapter); - if(status) + if (status) pr_err("DDR DOWNLOAD FAILED! %d\n", status); continue; } //Check end point for halt/stall. - if(Adapter->bEndPointHalted == TRUE) { + if (Adapter->bEndPointHalted == TRUE) { Bcm_clear_halt_of_endpoints(Adapter); Adapter->bEndPointHalted = FALSE; StartInterruptUrb((PS_INTERFACE_ADAPTER)(Adapter->pvInterfaceAdapter)); } - if(Adapter->LinkUpStatus && !Adapter->IdleMode) { - if(atomic_read(&Adapter->TotalPacketCount)) { + if (Adapter->LinkUpStatus && !Adapter->IdleMode) { + if (atomic_read(&Adapter->TotalPacketCount)) { update_per_sf_desc_cnts(Adapter); } } - if( atomic_read(&Adapter->CurrNumFreeTxDesc) && + if ( atomic_read(&Adapter->CurrNumFreeTxDesc) && Adapter->LinkStatus == SYNC_UP_REQUEST && !Adapter->bSyncUpRequestSent) { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, @@ -231,7 +231,7 @@ int tx_pkt_handler(PMINI_ADAPTER Adapter /**< pointer to adapter object*/ LinkMessage(Adapter); } - if((Adapter->IdleMode || Adapter->bShutStatus) && atomic_read(&Adapter->TotalPacketCount)) { + if ((Adapter->IdleMode || Adapter->bShutStatus) && atomic_read(&Adapter->TotalPacketCount)) { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "Device in Low Power mode...waking up\n"); Adapter->usIdleModePattern = ABORT_IDLE_MODE; diff --git a/drivers/staging/bcm/led_control.h b/drivers/staging/bcm/led_control.h index 9840302..9dacb01 100644 --- a/drivers/staging/bcm/led_control.h +++ b/drivers/staging/bcm/led_control.h @@ -31,14 +31,14 @@ (Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ? \ wrmaltWithLock(Adapter,BCM_GPIO_OUTPUT_SET_REG, &gpio_val ,sizeof(gpio_val)) : \ wrmaltWithLock(Adapter,BCM_GPIO_OUTPUT_CLR_REG, &gpio_val, sizeof(gpio_val)); \ - }while(0); + }while (0); #define TURN_OFF_LED(GPIO, index) do { \ UINT gpio_val = GPIO; \ (Adapter->LEDInfo.LEDState[index].BitPolarity == 1) ? \ wrmaltWithLock(Adapter,BCM_GPIO_OUTPUT_CLR_REG,&gpio_val ,sizeof(gpio_val)) : \ wrmaltWithLock(Adapter,BCM_GPIO_OUTPUT_SET_REG,&gpio_val ,sizeof(gpio_val)); \ - }while(0); + }while (0); #define B_ULONG32 unsigned long diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index 54ae2c3..dc369b8 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -78,7 +78,7 @@ static UCHAR ReadEEPROMStatusRegister( PMINI_ADAPTER Adapter ) value=0; uiStatus = 0 ; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); - if(Adapter->device_removed == TRUE) { + if (Adapter->device_removed == TRUE) { pr_info("Modem has got removed hence exiting....\n"); break; } @@ -105,7 +105,7 @@ static UCHAR ReadEEPROMStatusRegister( PMINI_ADAPTER Adapter ) MAX_EEPROM_RETRIES * RETRIES_PER_DELAY); return uiData; } - if( !(dwRetries%RETRIES_PER_DELAY) ) + if ( !(dwRetries%RETRIES_PER_DELAY) ) msleep(1); uiStatus = 0 ; } @@ -156,7 +156,7 @@ INT ReadBeceemEEPROMBulk( PMINI_ADAPTER Adapter, uiStatus = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); - if(Adapter->device_removed == TRUE) { + if (Adapter->device_removed == TRUE) { pr_info("Modem has got Removed.hence exiting from loop...\n"); return -ENODEV; } @@ -189,7 +189,7 @@ INT ReadBeceemEEPROMBulk( PMINI_ADAPTER Adapter, uiStatus = 0; dwRetries--; - if(dwRetries == 0) { + if (dwRetries == 0) { value=0; value1=0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); @@ -199,7 +199,7 @@ INT ReadBeceemEEPROMBulk( PMINI_ADAPTER Adapter, MAX_EEPROM_RETRIES * RETRIES_PER_DELAY); return STATUS_FAILURE; } - if( !(dwRetries%RETRIES_PER_DELAY) ) + if ( !(dwRetries%RETRIES_PER_DELAY) ) msleep(1); } @@ -285,7 +285,7 @@ INT ReadMacAddressFromNVM(PMINI_ADAPTER Adapter) INIT_PARAMS_1_MACADDRESS_ADDRESS, MAC_ADDRESS_SIZE); - if(Status == STATUS_SUCCESS) + if (Status == STATUS_SUCCESS) memcpy(Adapter->dev->dev_addr, puMacAddr, MAC_ADDRESS_SIZE); return Status; @@ -323,11 +323,11 @@ INT BeceemEEPROMBulkRead( PUCHAR pcBuff = (PUCHAR)pBuffer; - if(uiOffset%MAX_RW_SIZE&& uiBytesRemaining) { + if (uiOffset%MAX_RW_SIZE&& uiBytesRemaining) { uiTempOffset = uiOffset - (uiOffset%MAX_RW_SIZE); uiExtraBytes = uiOffset-uiTempOffset; ReadBeceemEEPROMBulk(Adapter,uiTempOffset,(PUINT)&uiData[0],4); - if(uiBytesRemaining >= (MAX_RW_SIZE - uiExtraBytes)) { + if (uiBytesRemaining >= (MAX_RW_SIZE - uiExtraBytes)) { memcpy(pBuffer,(((PUCHAR)&uiData[0])+uiExtraBytes),MAX_RW_SIZE - uiExtraBytes); uiBytesRemaining -= (MAX_RW_SIZE - uiExtraBytes); @@ -344,16 +344,16 @@ INT BeceemEEPROMBulkRead( } - while(uiBytesRemaining && uiFailureRetries != 128) { - if(Adapter->device_removed ) { + while (uiBytesRemaining && uiFailureRetries != 128) { + if (Adapter->device_removed ) { return -1; } - if(uiBytesRemaining >= MAX_RW_SIZE) { + if (uiBytesRemaining >= MAX_RW_SIZE) { /* For the requests more than or equal to 16 bytes, use bulk * read function to make the access faster. * We read 4 Dwords of data */ - if(0 == ReadBeceemEEPROMBulk(Adapter,uiOffset,&uiData[0],4)) { + if (0 == ReadBeceemEEPROMBulk(Adapter,uiOffset,&uiData[0],4)) { memcpy(pcBuff+uiIndex,&uiData[0],MAX_RW_SIZE); uiOffset += MAX_RW_SIZE; uiBytesRemaining -= MAX_RW_SIZE; @@ -362,8 +362,8 @@ INT BeceemEEPROMBulkRead( uiFailureRetries++; mdelay(3);//sleep for a while before retry... } - } else if(uiBytesRemaining >= 4) { - if(0 == ReadBeceemEEPROM(Adapter,uiOffset,&uiData[0])) { + } else if (uiBytesRemaining >= 4) { + if (0 == ReadBeceemEEPROM(Adapter,uiOffset,&uiData[0])) { memcpy(pcBuff+uiIndex,&uiData[0],4); uiOffset += 4; uiBytesRemaining -= 4; @@ -376,7 +376,7 @@ INT BeceemEEPROMBulkRead( { // Handle the reads less than 4 bytes... PUCHAR pCharBuff = (PUCHAR)pBuffer; pCharBuff += uiIndex; - if(0 == ReadBeceemEEPROM(Adapter,uiOffset,&uiData[0])) { + if (0 == ReadBeceemEEPROM(Adapter,uiOffset,&uiData[0])) { memcpy(pCharBuff,&uiData[0],uiBytesRemaining);//copy only bytes requested. uiBytesRemaining = 0; } else { @@ -418,7 +418,7 @@ static INT BeceemFlashBulkRead( UINT uiPartOffset = 0; int bytes; - if(Adapter->device_removed ) { + if (Adapter->device_removed ) { pr_info("Device Got Removed\n"); return -ENODEV; } @@ -432,7 +432,7 @@ static INT BeceemFlashBulkRead( Adapter->SelectedChip = RESET_CHIP_SELECT; - if(uiOffset % MAX_RW_SIZE) { + if (uiOffset % MAX_RW_SIZE) { BcmDoChipSelect(Adapter,uiOffset); uiPartOffset = (uiOffset & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); @@ -451,7 +451,7 @@ static INT BeceemFlashBulkRead( uiNumBytes -= uiBytesToRead; } - while(uiNumBytes) { + while (uiNumBytes) { BcmDoChipSelect(Adapter,uiOffset); uiPartOffset = (uiOffset & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); @@ -488,7 +488,7 @@ static INT BeceemFlashBulkRead( static UINT BcmGetFlashSize(PMINI_ADAPTER Adapter) { - if(IsFlash2x(Adapter)) + if (IsFlash2x(Adapter)) return (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER)); else return 32*1024; @@ -523,10 +523,10 @@ static UINT BcmGetEEPROMSize(PMINI_ADAPTER Adapter) // get 'BECM' string which is indeed at offset 0. // BeceemEEPROMBulkRead(Adapter,&uiData,0x0,4); - if(uiData == BECM) { - for(uiIndex = 2;uiIndex <=256; uiIndex*=2) { + if (uiData == BECM) { + for (uiIndex = 2;uiIndex <=256; uiIndex*=2) { BeceemEEPROMBulkRead(Adapter,&uiData,uiIndex*1024,4); - if(uiData == BECM) { + if (uiData == BECM) { return uiIndex*1024; } } @@ -536,11 +536,11 @@ static UINT BcmGetEEPROMSize(PMINI_ADAPTER Adapter) // uiData = 0xBABEFACE; - if(0 == BeceemEEPROMBulkWrite(Adapter,(PUCHAR)&uiData,0,4,TRUE)) { + if (0 == BeceemEEPROMBulkWrite(Adapter,(PUCHAR)&uiData,0,4,TRUE)) { uiData = 0; - for(uiIndex = 2;uiIndex <=256; uiIndex*=2) { + for (uiIndex = 2;uiIndex <=256; uiIndex*=2) { BeceemEEPROMBulkRead(Adapter,&uiData,uiIndex*1024,4); - if(uiData == 0xBABEFACE) { + if (uiData == 0xBABEFACE) { return uiIndex*1024; } } @@ -576,7 +576,7 @@ static INT FlashSectorErase(PMINI_ADAPTER Adapter, UINT value; int bytes; - for(iIndex=0;iIndex<numOfSectors;iIndex++) { + for (iIndex=0;iIndex<numOfSectors;iIndex++) { value = 0x06000000; wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)); @@ -587,7 +587,7 @@ static INT FlashSectorErase(PMINI_ADAPTER Adapter, do { value = (FLASH_CMD_STATUS_REG_READ << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { pr_info("Programming of FLASH_SPI_CMDQ_REG fails\n"); return STATUS_FAILURE; } @@ -603,9 +603,9 @@ static INT FlashSectorErase(PMINI_ADAPTER Adapter, //the sector erase cycle is 500 ms to 40000 msec. hence sleeping 10 ms //won't hamper performance in any case. msleep(10); - }while((uiStatus & 0x1) && (iRetries < 400)); + }while ((uiStatus & 0x1) && (iRetries < 400)); - if(uiStatus & 0x1) { + if (uiStatus & 0x1) { pr_info("iRetries crossing the limit of 80000\n"); return STATUS_FAILURE; } @@ -646,22 +646,22 @@ static INT flashByteWrite( // make whole sector 0xFF. // - if(0xFF == ulData) { + if (0xFF == ulData) { return STATUS_SUCCESS; } // DumpDebug(NVM_RW,("flashWrite ====>\n")); value = (FLASH_CMD_WRITE_ENABLE << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0) { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0) { pr_info("Write enable in FLASH_SPI_CMDQ_REG register fails\n"); return STATUS_FAILURE; } - if(wrm(Adapter,FLASH_SPI_WRITEQ_REG, (PCHAR)&ulData, 4) < 0 ) { + if (wrm(Adapter,FLASH_SPI_WRITEQ_REG, (PCHAR)&ulData, 4) < 0 ) { pr_info("DATA Write on FLASH_SPI_WRITEQ_REG fails\n"); return STATUS_FAILURE; } value = (0x02000000 | (uiOffset & 0xFFFFFF)); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0 ) { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0 ) { pr_info("Programming of FLASH_SPI_CMDQ_REG fails\n"); return STATUS_FAILURE; } @@ -671,7 +671,7 @@ static INT flashByteWrite( do { value = (FLASH_CMD_STATUS_REG_READ << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { pr_info("Programing of FLASH_SPI_CMDQ_REG fails\n"); return STATUS_FAILURE; } @@ -683,12 +683,12 @@ static INT flashByteWrite( return uiStatus; } iRetries--; - if( iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) + if ( iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) msleep(1); - }while((uiStatus & 0x1) && (iRetries >0) ); + }while ((uiStatus & 0x1) && (iRetries >0) ); - if(uiStatus & 0x1) { + if (uiStatus & 0x1) { pr_info("Flash Write fails even after checking status for 200 times\n"); return STATUS_FAILURE ; } @@ -738,11 +738,11 @@ static INT flashWrite( value = (FLASH_CMD_WRITE_ENABLE << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0 ) { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0 ) { pr_info("Write Enable of FLASH_SPI_CMDQ_REG fails\n"); return STATUS_FAILURE; } - if(wrm(Adapter, uiOffset, (PCHAR)pData, MAX_RW_SIZE) < 0) { + if (wrm(Adapter, uiOffset, (PCHAR)pData, MAX_RW_SIZE) < 0) { pr_info("Data write fails...\n"); return STATUS_FAILURE; } @@ -751,7 +751,7 @@ static INT flashWrite( do { value = (FLASH_CMD_STATUS_REG_READ << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { pr_info("Programing of FLASH_SPI_CMDQ_REG fails\n"); return STATUS_FAILURE; } @@ -768,11 +768,11 @@ static INT flashWrite( //currently one rdm/wrm takes 125 us. //Hence 125 *2 * FLASH_PER_RETRIES_DELAY > 3 ms(worst case delay) //Hence current implementation cycle will intoduce no delay in current path - if(iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) + if (iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) msleep(1); - }while((uiStatus & 0x1) && (iRetries > 0)); + }while ((uiStatus & 0x1) && (iRetries > 0)); - if(uiStatus & 0x1) { + if (uiStatus & 0x1) { pr_info("Flash Write fails even after checking status for 200 times\n"); return STATUS_FAILURE ; } @@ -809,23 +809,23 @@ static INT flashByteWriteStatus( // make whole sector 0xFFFFFFFF. // - if(0xFF == ulData) { + if (0xFF == ulData) { return STATUS_SUCCESS; } // DumpDebug(NVM_RW,("flashWrite ====>\n")); value = (FLASH_CMD_WRITE_ENABLE << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0) { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0) { pr_info("Write enable in FLASH_SPI_CMDQ_REG register fails\n"); return STATUS_SUCCESS; } - if(wrm(Adapter,FLASH_SPI_WRITEQ_REG, (PCHAR)&ulData, 4) < 0) { + if (wrm(Adapter,FLASH_SPI_WRITEQ_REG, (PCHAR)&ulData, 4) < 0) { pr_info("DATA Write on FLASH_SPI_WRITEQ_REG fails\n"); return STATUS_FAILURE; } value = (0x02000000 | (uiOffset & 0xFFFFFF)); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0) { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0) { pr_info("Programming of FLASH_SPI_CMDQ_REG fails\n"); return STATUS_FAILURE; } @@ -835,7 +835,7 @@ static INT flashByteWriteStatus( do { value = (FLASH_CMD_STATUS_REG_READ << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { pr_info("Programing of FLASH_SPI_CMDQ_REG fails\n"); return STATUS_FAILURE; } @@ -848,11 +848,11 @@ static INT flashByteWriteStatus( } iRetries--; - if( iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) + if ( iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) msleep(1); - }while((uiStatus & 0x1) && (iRetries > 0)); + }while ((uiStatus & 0x1) && (iRetries > 0)); - if(uiStatus & 0x1) { + if (uiStatus & 0x1) { pr_info("Flash Write fails even after checking status for 200 times\n"); return STATUS_FAILURE ; } @@ -895,11 +895,11 @@ static INT flashWriteStatus( } value = (FLASH_CMD_WRITE_ENABLE << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0) { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG,&value, sizeof(value)) < 0) { pr_info("Write Enable of FLASH_SPI_CMDQ_REG fails\n"); return STATUS_FAILURE; } - if(wrm(Adapter, uiOffset, (PCHAR)pData, MAX_RW_SIZE) < 0) { + if (wrm(Adapter, uiOffset, (PCHAR)pData, MAX_RW_SIZE) < 0) { pr_info("Data write fails...\n"); return STATUS_FAILURE; } @@ -908,7 +908,7 @@ static INT flashWriteStatus( do { value = (FLASH_CMD_STATUS_REG_READ << 24); - if(wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { + if (wrmalt(Adapter, FLASH_SPI_CMDQ_REG, &value, sizeof(value)) < 0) { pr_info("Programming of FLASH_SPI_CMDQ_REG fails\n"); return STATUS_FAILURE; } @@ -924,11 +924,11 @@ static INT flashWriteStatus( //currently one rdm/wrm takes 125 us. //Hence 125 *2 * FLASH_PER_RETRIES_DELAY >3 ms(worst case delay) //Hence current implementation cycle will intoduce no delay in current path - if(iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) + if (iRetries && ((iRetries % FLASH_PER_RETRIES_DELAY) == 0)) msleep(1); - }while((uiStatus & 0x1) && (iRetries >0)); + }while ((uiStatus & 0x1) && (iRetries >0)); - if(uiStatus & 0x1) { + if (uiStatus & 0x1) { pr_info("Flash Write fails even after checking status for 200 times\n"); return STATUS_FAILURE ; } @@ -982,7 +982,7 @@ static ULONG BcmFlashUnProtectBlock(PMINI_ADAPTER Adapter,UINT uiOffset, UINT ui // // Implemented only for 1MB Flash parts. // - if(FLASH_PART_SST25VF080B == Adapter->ulFlashID) { + if (FLASH_PART_SST25VF080B == Adapter->ulFlashID) { // // Get Current BP status. // @@ -1003,22 +1003,22 @@ static ULONG BcmFlashUnProtectBlock(PMINI_ADAPTER Adapter,UINT uiOffset, UINT ui // 4 - UPPER 1/2. 5 to 7 - ALL BLOCKS // - if(ulStatus) { - if((uiOffset+uiLength) <= 0x80000) { + if (ulStatus) { + if ((uiOffset+uiLength) <= 0x80000) { // // Offset comes in lower half of 1MB. Protect the upper half. // Clear BP1 and BP0 and set BP2. // ulWriteStatus |= (0x4<<2); ulWriteStatus &= ~(0x3<<2); - } else if((uiOffset+uiLength) <= 0xC0000) { + } else if ((uiOffset+uiLength) <= 0xC0000) { // // Offset comes below Upper 1/4. Upper 1/4 can be protected. // Clear BP2 and set BP1 and BP0. // ulWriteStatus |= (0x3<<2); ulWriteStatus &= ~(0x1<<4); - } else if((uiOffset+uiLength) <= 0xE0000) { + } else if ((uiOffset+uiLength) <= 0xE0000) { // // Offset comes below Upper 1/8. Upper 1/8 can be protected. // Clear BP2 and BP0 and set BP1 @@ -1026,7 +1026,7 @@ static ULONG BcmFlashUnProtectBlock(PMINI_ADAPTER Adapter,UINT uiOffset, UINT ui ulWriteStatus |= (0x1<<3); ulWriteStatus &= ~(0x5<<2); - } else if((uiOffset+uiLength) <= 0xF0000) { + } else if ((uiOffset+uiLength) <= 0xF0000) { // // Offset comes below Upper 1/16. Only upper 1/16 can be protected. // Set BP0 and Clear BP2,BP1. @@ -1106,28 +1106,28 @@ static INT BeceemFlashBulkWrite( uiSectBoundary = uiSectAlignAddr + Adapter->uiSectorSize; pTempBuff = kmalloc(Adapter->uiSectorSize, GFP_KERNEL); - if(NULL == pTempBuff) + if (NULL == pTempBuff) goto BeceemFlashBulkWrite_EXIT; // // check if the data to be written is overlapped across sectors // - if(uiOffset+uiNumBytes < uiSectBoundary) { + if (uiOffset+uiNumBytes < uiSectBoundary) { uiNumSectTobeRead = 1; } else { // Number of sectors = Last sector start address/First sector start address uiNumSectTobeRead = (uiCurrSectOffsetAddr+uiNumBytes)/Adapter->uiSectorSize; - if((uiCurrSectOffsetAddr+uiNumBytes)%Adapter->uiSectorSize) { + if ((uiCurrSectOffsetAddr+uiNumBytes)%Adapter->uiSectorSize) { uiNumSectTobeRead++; } } //Check whether Requested sector is writable or not in case of flash2x write. But if write call is // for DSD calibration, allow it without checking of sector permission - if(IsFlash2x(Adapter) && (Adapter->bAllDSDWriteAllow == FALSE)) { + if (IsFlash2x(Adapter) && (Adapter->bAllDSDWriteAllow == FALSE)) { index = 0; uiTemp = uiNumSectTobeRead ; - while(uiTemp) { - if(IsOffsetWritable(Adapter, uiOffsetFromSectStart + index * Adapter->uiSectorSize ) == FALSE) { + while (uiTemp) { + if (IsOffsetWritable(Adapter, uiOffsetFromSectStart + index * Adapter->uiSectorSize ) == FALSE) { pr_info("Sector Starting at offset <0X%X> is not writable\n", uiOffsetFromSectStart + index * Adapter->uiSectorSize); @@ -1139,7 +1139,7 @@ static INT BeceemFlashBulkWrite( } } Adapter->SelectedChip = RESET_CHIP_SELECT; - while(uiNumSectTobeRead) { + while (uiNumSectTobeRead) { //do_gettimeofday(&tv1); /* pr_info("\nTime In start of write :%ld ms\n", @@ -1149,7 +1149,7 @@ static INT BeceemFlashBulkWrite( BcmDoChipSelect(Adapter,uiSectAlignAddr); - if(0 != BeceemFlashBulkRead(Adapter, + if (0 != BeceemFlashBulkRead(Adapter, (PUINT)pTempBuff, uiOffsetFromSectStart, Adapter->uiSectorSize)) { @@ -1167,7 +1167,7 @@ static INT BeceemFlashBulkWrite( ulStatus = BcmFlashUnProtectBlock(Adapter,uiSectAlignAddr,Adapter->uiSectorSize); - if(uiNumSectTobeRead > 1) { + if (uiNumSectTobeRead > 1) { memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)); pcBuffer += ((uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr))); @@ -1176,7 +1176,7 @@ static INT BeceemFlashBulkWrite( memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiNumBytes); } - if(IsFlash2x(Adapter)) { + if (IsFlash2x(Adapter)) { SaveHeaderIfPresent(Adapter,(PUCHAR)pTempBuff,uiOffsetFromSectStart); } @@ -1187,12 +1187,12 @@ static INT BeceemFlashBulkWrite( (te.tv_sec *1000 + te.tv_usec/1000) - (tr.tv_sec *1000 + tr.tv_usec/1000)); */ - for(uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex +=Adapter->ulFlashWriteSize) { - if(Adapter->device_removed) { + for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex +=Adapter->ulFlashWriteSize) { + if (Adapter->device_removed) { Status = -1; goto BeceemFlashBulkWrite_EXIT; } - if(STATUS_SUCCESS != (*Adapter->fpFlashWrite)(Adapter,uiPartOffset+uiIndex,(&pTempBuff[uiIndex]))) { + if (STATUS_SUCCESS != (*Adapter->fpFlashWrite)(Adapter,uiPartOffset+uiIndex,(&pTempBuff[uiIndex]))) { Status = -1; goto BeceemFlashBulkWrite_EXIT; } @@ -1204,21 +1204,21 @@ static INT BeceemFlashBulkWrite( (tw.tv_sec *1000 + tw.tv_usec/1000) - (te.tv_sec *1000 + te.tv_usec/1000)); */ - for(uiIndex = 0;uiIndex < Adapter->uiSectorSize;uiIndex += MAX_RW_SIZE) { - if(STATUS_SUCCESS == BeceemFlashBulkRead(Adapter,(PUINT)ucReadBk,uiOffsetFromSectStart+uiIndex,MAX_RW_SIZE)) { - if(Adapter->ulFlashWriteSize == 1) { + for (uiIndex = 0;uiIndex < Adapter->uiSectorSize;uiIndex += MAX_RW_SIZE) { + if (STATUS_SUCCESS == BeceemFlashBulkRead(Adapter,(PUINT)ucReadBk,uiOffsetFromSectStart+uiIndex,MAX_RW_SIZE)) { + if (Adapter->ulFlashWriteSize == 1) { UINT uiReadIndex = 0; - for(uiReadIndex = 0; uiReadIndex < 16; uiReadIndex++) { - if(ucReadBk[uiReadIndex] != pTempBuff[uiIndex+uiReadIndex]) { - if(STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter,uiPartOffset+uiIndex+uiReadIndex,&pTempBuff[uiIndex+uiReadIndex])) { + for (uiReadIndex = 0; uiReadIndex < 16; uiReadIndex++) { + if (ucReadBk[uiReadIndex] != pTempBuff[uiIndex+uiReadIndex]) { + if (STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter,uiPartOffset+uiIndex+uiReadIndex,&pTempBuff[uiIndex+uiReadIndex])) { Status = STATUS_FAILURE; goto BeceemFlashBulkWrite_EXIT; } } } } else { - if(memcmp(ucReadBk,&pTempBuff[uiIndex],MAX_RW_SIZE)) { - if(STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter,uiPartOffset+uiIndex,&pTempBuff[uiIndex])) { + if (memcmp(ucReadBk,&pTempBuff[uiIndex],MAX_RW_SIZE)) { + if (STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter,uiPartOffset+uiIndex,&pTempBuff[uiIndex])) { Status = STATUS_FAILURE; goto BeceemFlashBulkWrite_EXIT; } @@ -1233,7 +1233,7 @@ static INT BeceemFlashBulkWrite( (tw.tv_sec *1000 + tw.tv_usec/1000)); */ - if(ulStatus) { + if (ulStatus) { BcmRestoreBlockProtectStatus(Adapter,ulStatus); ulStatus = 0; } @@ -1256,7 +1256,7 @@ static INT BeceemFlashBulkWrite( // Cleanup. // BeceemFlashBulkWrite_EXIT: - if(ulStatus) { + if (ulStatus) { BcmRestoreBlockProtectStatus(Adapter,ulStatus); } @@ -1316,27 +1316,27 @@ static INT BeceemFlashBulkWriteStatus( uiSectBoundary = uiSectAlignAddr + Adapter->uiSectorSize; pTempBuff = kmalloc(Adapter->uiSectorSize, GFP_KERNEL); - if(NULL == pTempBuff) + if (NULL == pTempBuff) goto BeceemFlashBulkWriteStatus_EXIT; // // check if the data to be written is overlapped across sectors // - if(uiOffset+uiNumBytes < uiSectBoundary) { + if (uiOffset+uiNumBytes < uiSectBoundary) { uiNumSectTobeRead = 1; } else { // Number of sectors = Last sector start address/First sector start address uiNumSectTobeRead = (uiCurrSectOffsetAddr+uiNumBytes)/Adapter->uiSectorSize; - if((uiCurrSectOffsetAddr+uiNumBytes)%Adapter->uiSectorSize) { + if ((uiCurrSectOffsetAddr+uiNumBytes)%Adapter->uiSectorSize) { uiNumSectTobeRead++; } } - if(IsFlash2x(Adapter) && (Adapter->bAllDSDWriteAllow == FALSE)) { + if (IsFlash2x(Adapter) && (Adapter->bAllDSDWriteAllow == FALSE)) { index = 0; uiTemp = uiNumSectTobeRead ; - while(uiTemp) { - if(IsOffsetWritable(Adapter,uiOffsetFromSectStart + index * Adapter->uiSectorSize ) == FALSE) { + while (uiTemp) { + if (IsOffsetWritable(Adapter,uiOffsetFromSectStart + index * Adapter->uiSectorSize ) == FALSE) { pr_info("Sector Starting at offset <0X%x> is not writable\n", uiOffsetFromSectStart + index * Adapter->uiSectorSize); @@ -1349,11 +1349,11 @@ static INT BeceemFlashBulkWriteStatus( } Adapter->SelectedChip = RESET_CHIP_SELECT; - while(uiNumSectTobeRead) { + while (uiNumSectTobeRead) { uiPartOffset = (uiSectAlignAddr & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); BcmDoChipSelect(Adapter,uiSectAlignAddr); - if(0 != BeceemFlashBulkRead(Adapter, + if (0 != BeceemFlashBulkRead(Adapter, (PUINT)pTempBuff, uiOffsetFromSectStart, Adapter->uiSectorSize)) { @@ -1363,7 +1363,7 @@ static INT BeceemFlashBulkWriteStatus( ulStatus = BcmFlashUnProtectBlock(Adapter,uiOffsetFromSectStart,Adapter->uiSectorSize); - if(uiNumSectTobeRead > 1) { + if (uiNumSectTobeRead > 1) { memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)); pcBuffer += ((uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr))); @@ -1372,31 +1372,31 @@ static INT BeceemFlashBulkWriteStatus( memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiNumBytes); } - if(IsFlash2x(Adapter)) { + if (IsFlash2x(Adapter)) { SaveHeaderIfPresent(Adapter,(PUCHAR)pTempBuff,uiOffsetFromSectStart); } FlashSectorErase(Adapter,uiPartOffset,1); - for(uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex +=Adapter->ulFlashWriteSize) + for (uiIndex = 0; uiIndex < Adapter->uiSectorSize; uiIndex +=Adapter->ulFlashWriteSize) { - if(Adapter->device_removed) { + if (Adapter->device_removed) { Status = -1; goto BeceemFlashBulkWriteStatus_EXIT; } - if(STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter,uiPartOffset+uiIndex,&pTempBuff[uiIndex])) { + if (STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter,uiPartOffset+uiIndex,&pTempBuff[uiIndex])) { Status = -1; goto BeceemFlashBulkWriteStatus_EXIT; } } - if(bVerify) { - for(uiIndex = 0;uiIndex < Adapter->uiSectorSize;uiIndex += MAX_RW_SIZE) { + if (bVerify) { + for (uiIndex = 0;uiIndex < Adapter->uiSectorSize;uiIndex += MAX_RW_SIZE) { - if(STATUS_SUCCESS == BeceemFlashBulkRead(Adapter,(PUINT)ucReadBk,uiOffsetFromSectStart+uiIndex,MAX_RW_SIZE)) { - if(memcmp(ucReadBk,&pTempBuff[uiIndex],MAX_RW_SIZE)) { + if (STATUS_SUCCESS == BeceemFlashBulkRead(Adapter,(PUINT)ucReadBk,uiOffsetFromSectStart+uiIndex,MAX_RW_SIZE)) { + if (memcmp(ucReadBk,&pTempBuff[uiIndex],MAX_RW_SIZE)) { Status = STATUS_FAILURE; goto BeceemFlashBulkWriteStatus_EXIT; } @@ -1406,7 +1406,7 @@ static INT BeceemFlashBulkWriteStatus( } } - if(ulStatus) { + if (ulStatus) { BcmRestoreBlockProtectStatus(Adapter,ulStatus); ulStatus = 0; } @@ -1421,7 +1421,7 @@ static INT BeceemFlashBulkWriteStatus( // Cleanup. // BeceemFlashBulkWriteStatus_EXIT: - if(ulStatus) { + if (ulStatus) { BcmRestoreBlockProtectStatus(Adapter,ulStatus); } @@ -1454,18 +1454,18 @@ INT PropagateCalParamsFromEEPROMToMemory(PMINI_ADAPTER Adapter) UINT uiMemoryLoc = EEPROM_CAL_DATA_INTERNAL_LOC; UINT value; INT Status = 0; - if(pBuff == NULL) { + if (pBuff == NULL) { return -1; } - if(0 != BeceemEEPROMBulkRead(Adapter,&uiEepromSize,EEPROM_SIZE_OFFSET,4)) { + if (0 != BeceemEEPROMBulkRead(Adapter,&uiEepromSize,EEPROM_SIZE_OFFSET,4)) { kfree(pBuff); return -1; } uiEepromSize >>= 16; - if(uiEepromSize > 1024*1024) { + if (uiEepromSize > 1024*1024) { kfree(pBuff); return -1; } @@ -1473,8 +1473,8 @@ INT PropagateCalParamsFromEEPROMToMemory(PMINI_ADAPTER Adapter) uiBytesToCopy = MIN(BUFFER_4K,uiEepromSize); - while(uiBytesToCopy) { - if(0 != BeceemEEPROMBulkRead(Adapter,(PUINT)pBuff,uiCalStartAddr,uiBytesToCopy)) { + while (uiBytesToCopy) { + if (0 != BeceemEEPROMBulkRead(Adapter,(PUINT)pBuff,uiCalStartAddr,uiBytesToCopy)) { Status = -1; break; } @@ -1526,7 +1526,7 @@ INT PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter) value = 0xbeadbead; wrmalt(Adapter, EEPROM_CAL_DATA_INTERNAL_LOC - 8, &value, sizeof(value)); - if(0 != BeceemNVMRead(Adapter,&uiEepromSize,EEPROM_SIZE_OFFSET, 4)) { + if (0 != BeceemNVMRead(Adapter,&uiEepromSize,EEPROM_SIZE_OFFSET, 4)) { return -1; } uiEepromSize = ntohl(uiEepromSize); @@ -1537,7 +1537,7 @@ INT PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter) // uiEepromSize -= EEPROM_CALPARAM_START; - if(uiEepromSize > 1024*1024) { + if (uiEepromSize > 1024*1024) { return -1; } @@ -1545,7 +1545,7 @@ INT PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter) if ( pBuff == NULL ) return -1; - if(0 != BeceemNVMRead(Adapter,(PUINT)pBuff,uiCalStartAddr, uiEepromSize)) { + if (0 != BeceemNVMRead(Adapter,(PUINT)pBuff,uiCalStartAddr, uiEepromSize)) { kfree(pBuff); return -1; } @@ -1554,9 +1554,9 @@ INT PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter) uiBytesToCopy = MIN(BUFFER_4K,uiEepromSize); - while(uiBytesToCopy) { + while (uiBytesToCopy) { Status = wrm(Adapter,uiMemoryLoc,(PCHAR)pPtr,uiBytesToCopy); - if(Status) { + if (Status) { pr_info("wrm failed with status :%d\n", Status); break; } @@ -1598,22 +1598,22 @@ static INT BeceemEEPROMReadBackandVerify( UINT uiData = 0; UINT auiData[4] = {0}; - while(uiNumBytes) { - if(Adapter->device_removed ) { + while (uiNumBytes) { + if (Adapter->device_removed ) { return -1; } - if(uiNumBytes >= MAX_RW_SIZE) + if (uiNumBytes >= MAX_RW_SIZE) {// for the requests more than or equal to MAX_RW_SIZE bytes, use bulk read function to make the access faster. BeceemEEPROMBulkRead(Adapter,&auiData[0],uiOffset,MAX_RW_SIZE); - if(memcmp(&pBuffer[uiIndex],&auiData[0],MAX_RW_SIZE)) { + if (memcmp(&pBuffer[uiIndex],&auiData[0],MAX_RW_SIZE)) { // re-write BeceemEEPROMBulkWrite(Adapter,(PUCHAR)(pBuffer+uiIndex),uiOffset,MAX_RW_SIZE,FALSE); mdelay(3); BeceemEEPROMBulkRead(Adapter,&auiData[0],uiOffset,MAX_RW_SIZE); - if(memcmp(&pBuffer[uiIndex],&auiData[0],MAX_RW_SIZE)) { + if (memcmp(&pBuffer[uiIndex],&auiData[0],MAX_RW_SIZE)) { return -1; } } @@ -1621,14 +1621,14 @@ static INT BeceemEEPROMReadBackandVerify( uiNumBytes -= MAX_RW_SIZE; uiIndex += 4; - } else if(uiNumBytes >= 4) { + } else if (uiNumBytes >= 4) { BeceemEEPROMBulkRead(Adapter,&uiData,uiOffset,4); - if(uiData != pBuffer[uiIndex]) { + if (uiData != pBuffer[uiIndex]) { //re-write BeceemEEPROMBulkWrite(Adapter,(PUCHAR)(pBuffer+uiIndex),uiOffset,4,FALSE); mdelay(3); BeceemEEPROMBulkRead(Adapter,&uiData,uiOffset,4); - if(uiData != pBuffer[uiIndex]) { + if (uiData != pBuffer[uiIndex]) { return -1; } } @@ -1642,7 +1642,7 @@ static INT BeceemEEPROMReadBackandVerify( memcpy(&uiData,((PUCHAR)pBuffer)+(uiIndex*sizeof(UINT)),uiNumBytes); BeceemEEPROMBulkRead(Adapter,&uiRdbk,uiOffset,4); - if(memcmp(&uiData, &uiRdbk, uiNumBytes)) + if (memcmp(&uiData, &uiRdbk, uiNumBytes)) return -1; uiNumBytes = 0; @@ -1742,12 +1742,12 @@ static INT BeceemEEPROMWritePage( PMINI_ADAPTER Adapter, UINT uiData[], UINT uiO return STATUS_FAILURE ; } - if( !(uiRetries%RETRIES_PER_DELAY) ) + if ( !(uiRetries%RETRIES_PER_DELAY) ) msleep(1); uiStatus = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); - if(Adapter->device_removed == TRUE) { + if (Adapter->device_removed == TRUE) { pr_info("Modem got removed hence exiting from loop....\n"); return -ENODEV; } @@ -1769,7 +1769,7 @@ static INT BeceemEEPROMWritePage( PMINI_ADAPTER Adapter, UINT uiData[], UINT uiO uiEpromStatus = 0; while ( uiRetries != 0 ) { uiEpromStatus = ReadEEPROMStatusRegister( Adapter) ; - if(Adapter->device_removed == TRUE) { + if (Adapter->device_removed == TRUE) { pr_info("Modem has got removed hence exiting from loop...\n"); return -ENODEV; } @@ -1788,7 +1788,7 @@ static INT BeceemEEPROMWritePage( PMINI_ADAPTER Adapter, UINT uiData[], UINT uiO return STATUS_FAILURE ; } uiEpromStatus = 0; - if( !(uiRetries%RETRIES_PER_DELAY) ) + if ( !(uiRetries%RETRIES_PER_DELAY) ) msleep(1); } @@ -1828,14 +1828,14 @@ INT BeceemEEPROMBulkWrite( //PUINT puiBuffer = (PUINT)pBuffer; //INT value; - if(uiOffset%MAX_RW_SIZE && uiBytesToCopy) { + if (uiOffset%MAX_RW_SIZE && uiBytesToCopy) { uiTempOffset = uiOffset - (uiOffset%MAX_RW_SIZE); uiExtraBytes = uiOffset-uiTempOffset; BeceemEEPROMBulkRead(Adapter,&uiData[0],uiTempOffset,MAX_RW_SIZE); - if(uiBytesToCopy >= (16 -uiExtraBytes)) { + if (uiBytesToCopy >= (16 -uiExtraBytes)) { memcpy((((PUCHAR)&uiData[0])+uiExtraBytes),pBuffer,MAX_RW_SIZE- uiExtraBytes); if ( STATUS_FAILURE == BeceemEEPROMWritePage( Adapter, uiData, uiTempOffset ) ) @@ -1858,12 +1858,12 @@ INT BeceemEEPROMBulkWrite( } - while(uiBytesToCopy) { - if(Adapter->device_removed) { + while (uiBytesToCopy) { + if (Adapter->device_removed) { return -1; } - if(uiBytesToCopy >= MAX_RW_SIZE) { + if (uiBytesToCopy >= MAX_RW_SIZE) { if (STATUS_FAILURE == BeceemEEPROMWritePage( Adapter, (PUINT) &pBuffer[uiIndex], uiOffset ) ) return STATUS_FAILURE; @@ -1916,8 +1916,8 @@ INT BeceemNVMRead( UINT uiTemp = 0, value; #endif - if(Adapter->eNVMType == NVM_FLASH) { - if(Adapter->bFlashRawRead == FALSE) { + if (Adapter->eNVMType == NVM_FLASH) { + if (Adapter->bFlashRawRead == FALSE) { if (IsSectionExistInVendorInfo(Adapter,Adapter->eActiveDSD)) return vendorextnReadSection(Adapter,(PUCHAR)pBuffer,Adapter->eActiveDSD,uiOffset,uiNumBytes); uiOffset = uiOffset+ Adapter->ulFlashCalStart ; @@ -1935,7 +1935,7 @@ INT BeceemNVMRead( uiNumBytes); wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); #endif - } else if(Adapter->eNVMType == NVM_EEPROM) { + } else if (Adapter->eNVMType == NVM_EEPROM) { Status = BeceemEEPROMBulkRead(Adapter, pBuffer, uiOffset, @@ -1978,7 +1978,7 @@ INT BeceemNVMWrite( #endif UINT uiFlashOffset = 0; - if(Adapter->eNVMType == NVM_FLASH) { + if (Adapter->eNVMType == NVM_FLASH) { if (IsSectionExistInVendorInfo(Adapter,Adapter->eActiveDSD)) Status = vendorextnWriteSection(Adapter,(PUCHAR)pBuffer,Adapter->eActiveDSD,uiOffset,uiNumBytes,bVerify); else { @@ -1991,7 +1991,7 @@ INT BeceemNVMWrite( value = 0; wrmalt(Adapter, 0x0f000C80, &value, sizeof(value)); - if(Adapter->bStatusWrite == TRUE) { + if (Adapter->bStatusWrite == TRUE) { Status = BeceemFlashBulkWriteStatus(Adapter, pBuffer, uiFlashOffset, @@ -2009,10 +2009,10 @@ INT BeceemNVMWrite( } - if(uiOffset >= EEPROM_CALPARAM_START) { + if (uiOffset >= EEPROM_CALPARAM_START) { uiMemoryLoc += (uiOffset - EEPROM_CALPARAM_START); - while(uiNumBytes) { - if(uiNumBytes > BUFFER_4K) { + while (uiNumBytes) { + if (uiNumBytes > BUFFER_4K) { wrm(Adapter,(uiMemoryLoc+uiIndex),(PCHAR)(pBuffer+(uiIndex/4)),BUFFER_4K); uiNumBytes -= BUFFER_4K; uiIndex += BUFFER_4K; @@ -2023,14 +2023,14 @@ INT BeceemNVMWrite( } } } else { - if((uiOffset+uiNumBytes) > EEPROM_CALPARAM_START) { + if ((uiOffset+uiNumBytes) > EEPROM_CALPARAM_START) { ULONG ulBytesTobeSkipped = 0; PUCHAR pcBuffer = (PUCHAR)pBuffer;// char pointer to take care of odd byte cases. uiNumBytes -= (EEPROM_CALPARAM_START - uiOffset); ulBytesTobeSkipped += (EEPROM_CALPARAM_START - uiOffset); uiOffset += (EEPROM_CALPARAM_START - uiOffset); - while(uiNumBytes) { - if(uiNumBytes > BUFFER_4K) { + while (uiNumBytes) { + if (uiNumBytes > BUFFER_4K) { wrm(Adapter,uiMemoryLoc+uiIndex,(PCHAR )&pcBuffer[ulBytesTobeSkipped+uiIndex],BUFFER_4K); uiNumBytes -= BUFFER_4K; uiIndex += BUFFER_4K; @@ -2046,13 +2046,13 @@ INT BeceemNVMWrite( // restore the values. wrmalt(Adapter,0x0f000C80,&uiTemp, sizeof(uiTemp)); - } else if(Adapter->eNVMType == NVM_EEPROM) { + } else if (Adapter->eNVMType == NVM_EEPROM) { Status = BeceemEEPROMBulkWrite(Adapter, (PUCHAR)pBuffer, uiOffset, uiNumBytes, bVerify); - if(bVerify) { + if (bVerify) { Status = BeceemEEPROMReadBackandVerify(Adapter,(PUINT)pBuffer,uiOffset,uiNumBytes); } } else { @@ -2099,10 +2099,10 @@ INT BcmUpdateSectorSize(PMINI_ADAPTER Adapter,UINT uiSectorSize) uiSectorSig = ntohl(sFlashCsInfo.FlashSectorSizeSig); uiCurrentSectorSize = ntohl(sFlashCsInfo.FlashSectorSize); - if(uiSectorSig == FLASH_SECTOR_SIZE_SIG) { + if (uiSectorSig == FLASH_SECTOR_SIZE_SIG) { - if((uiCurrentSectorSize <= MAX_SECTOR_SIZE) && (uiCurrentSectorSize >= MIN_SECTOR_SIZE)) { - if(uiSectorSize == uiCurrentSectorSize) { + if ((uiCurrentSectorSize <= MAX_SECTOR_SIZE) && (uiCurrentSectorSize >= MIN_SECTOR_SIZE)) { + if (uiSectorSize == uiCurrentSectorSize) { bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Provided sector size is same as programmed in Flash\n"); Status = STATUS_SUCCESS; @@ -2111,7 +2111,7 @@ INT BcmUpdateSectorSize(PMINI_ADAPTER Adapter,UINT uiSectorSize) } } - if((uiSectorSize <= MAX_SECTOR_SIZE) && (uiSectorSize >= MIN_SECTOR_SIZE)) { + if ((uiSectorSize <= MAX_SECTOR_SIZE) && (uiSectorSize >= MIN_SECTOR_SIZE)) { sFlashCsInfo.FlashSectorSize = htonl(uiSectorSize); sFlashCsInfo.FlashSectorSizeSig = htonl(FLASH_SECTOR_SIZE_SIG); @@ -2152,7 +2152,7 @@ static UINT BcmGetFlashSectorSize(PMINI_ADAPTER Adapter, UINT FlashSectorSizeSig UINT uiSectorSize = 0; UINT uiSectorSig = 0; - if(Adapter->bSectorSizeOverride && + if (Adapter->bSectorSizeOverride && (Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE)) { Adapter->uiSectorSize = Adapter->uiSectorSizeInCFG; @@ -2160,16 +2160,16 @@ static UINT BcmGetFlashSectorSize(PMINI_ADAPTER Adapter, UINT FlashSectorSizeSig uiSectorSig = FlashSectorSizeSig; - if(uiSectorSig == FLASH_SECTOR_SIZE_SIG) { + if (uiSectorSig == FLASH_SECTOR_SIZE_SIG) { uiSectorSize = FlashSectorSize; // // If the sector size stored in the FLASH makes sense then use it. // - if(uiSectorSize <= MAX_SECTOR_SIZE && uiSectorSize >= MIN_SECTOR_SIZE) { + if (uiSectorSize <= MAX_SECTOR_SIZE && uiSectorSize >= MIN_SECTOR_SIZE) { Adapter->uiSectorSize = uiSectorSize; } //No valid size in FLASH, check if Config file has it. - else if(Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && + else if (Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) { Adapter->uiSectorSize = Adapter->uiSectorSizeInCFG; } @@ -2179,7 +2179,7 @@ static UINT BcmGetFlashSectorSize(PMINI_ADAPTER Adapter, UINT FlashSectorSizeSig } } else { - if(Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && + if (Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) { Adapter->uiSectorSize = Adapter->uiSectorSizeInCFG; } else { @@ -2249,12 +2249,12 @@ INT BcmInitNVM(PMINI_ADAPTER ps_adapter) BcmValidateNvmType(ps_adapter); BcmInitEEPROMQueues(ps_adapter); - if(ps_adapter->eNVMType == NVM_AUTODETECT) { + if (ps_adapter->eNVMType == NVM_AUTODETECT) { ps_adapter->eNVMType = BcmGetNvmType(ps_adapter); - if(ps_adapter->eNVMType == NVM_UNKNOWN) { + if (ps_adapter->eNVMType == NVM_UNKNOWN) { pr_info("NVM Type is unknown!!\n"); } - } else if(ps_adapter->eNVMType == NVM_FLASH) { + } else if (ps_adapter->eNVMType == NVM_FLASH) { BcmGetFlashCSInfo(ps_adapter); } @@ -2274,9 +2274,9 @@ INT BcmInitNVM(PMINI_ADAPTER ps_adapter) static INT BcmGetNvmSize(PMINI_ADAPTER Adapter) { - if(Adapter->eNVMType == NVM_EEPROM) { + if (Adapter->eNVMType == NVM_EEPROM) { Adapter->uiNVMDSDSize = BcmGetEEPROMSize(Adapter); - } else if(Adapter->eNVMType == NVM_FLASH) { + } else if (Adapter->eNVMType == NVM_FLASH) { Adapter->uiNVMDSDSize = BcmGetFlashSize(Adapter); } return 0; @@ -2302,7 +2302,7 @@ static VOID BcmValidateNvmType(PMINI_ADAPTER Adapter) // So if NVM_FLASH is selected for older chipsets, change it to AUTODETECT where EEPROM is 1st choice. // - if(Adapter->eNVMType == NVM_FLASH && + if (Adapter->eNVMType == NVM_FLASH && Adapter->chip_id < 0xBECE3300) { Adapter->eNVMType = NVM_AUTODETECT; } @@ -2343,25 +2343,25 @@ static ULONG BcmReadFlashRDID(PMINI_ADAPTER Adapter) INT BcmAllocFlashCSStructure(PMINI_ADAPTER psAdapter) { - if(psAdapter == NULL) { + if (psAdapter == NULL) { pr_info("Adapter structure point is NULL\n"); return -EINVAL; } psAdapter->psFlashCSInfo = (PFLASH_CS_INFO)kzalloc(sizeof(FLASH_CS_INFO), GFP_KERNEL); - if(psAdapter->psFlashCSInfo == NULL) { + if (psAdapter->psFlashCSInfo == NULL) { pr_info("Can't Allocate memory for Flash 1.x\n"); return -ENOMEM; } psAdapter->psFlash2xCSInfo = (PFLASH2X_CS_INFO)kzalloc(sizeof(FLASH2X_CS_INFO), GFP_KERNEL); - if(psAdapter->psFlash2xCSInfo == NULL) { + if (psAdapter->psFlash2xCSInfo == NULL) { pr_info("Can't Allocate memory for Flash 2.x\n"); kfree(psAdapter->psFlashCSInfo); return -ENOMEM; } psAdapter->psFlash2xVendorInfo = (PFLASH2X_VENDORSPECIFIC_INFO)kzalloc(sizeof(FLASH2X_VENDORSPECIFIC_INFO), GFP_KERNEL); - if(psAdapter->psFlash2xVendorInfo == NULL) { + if (psAdapter->psFlash2xVendorInfo == NULL) { pr_info("Can't Allocate Vendor Info Memory for Flash 2.x\n"); kfree(psAdapter->psFlashCSInfo); kfree(psAdapter->psFlash2xCSInfo); @@ -2373,7 +2373,7 @@ INT BcmAllocFlashCSStructure(PMINI_ADAPTER psAdapter) INT BcmDeAllocFlashCSStructure(PMINI_ADAPTER psAdapter) { - if(psAdapter == NULL) { + if (psAdapter == NULL) { pr_info("Adapter structure point is NULL\n"); return -EINVAL; } @@ -2513,7 +2513,7 @@ static INT BcmDumpFlash2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo,PMINI_ADAP psFlash2xCSInfo->OffsetFromZeroForVSA2End); bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Sector Access Bit Map is Defined as :\n"); - for(Index =0; Index <(FLASH2X_TOTAL_SIZE/(DEFAULT_SECTOR_SIZE *16)); Index++) { + for (Index =0; Index <(FLASH2X_TOTAL_SIZE/(DEFAULT_SECTOR_SIZE *16)); Index++) { bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "SectorAccessBitMap[%d] :0x%x\n", Index, psFlash2xCSInfo->SectorAccessBitMap[Index]); @@ -2572,7 +2572,7 @@ static INT ConvertEndianOf2XCSStructure(PFLASH2X_CS_INFO psFlash2xCSInfo) psFlash2xCSInfo->OffsetFromZeroForVSA1End = ntohl(psFlash2xCSInfo->OffsetFromZeroForVSA1End); psFlash2xCSInfo->OffsetFromZeroForVSA2Start = ntohl(psFlash2xCSInfo->OffsetFromZeroForVSA2Start); psFlash2xCSInfo->OffsetFromZeroForVSA2End = ntohl(psFlash2xCSInfo->OffsetFromZeroForVSA2End); - for(Index =0; Index <(FLASH2X_TOTAL_SIZE/(DEFAULT_SECTOR_SIZE *16)); Index++) { + for (Index =0; Index <(FLASH2X_TOTAL_SIZE/(DEFAULT_SECTOR_SIZE *16)); Index++) { psFlash2xCSInfo->SectorAccessBitMap[Index] = ntohl(psFlash2xCSInfo->SectorAccessBitMap[Index]); } return STATUS_SUCCESS; @@ -2625,15 +2625,15 @@ static VOID UpdateVendorInfo(PMINI_ADAPTER Adapter) Adapter->uiVendorExtnFlag = FALSE; - for(i = 0;i < TOTAL_SECTIONS;i++) + for (i = 0;i < TOTAL_SECTIONS;i++) Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart = UNINIT_PTR_IN_CS; - if(STATUS_SUCCESS != vendorextnGetSectionInfo(Adapter, Adapter->psFlash2xVendorInfo)) + if (STATUS_SUCCESS != vendorextnGetSectionInfo(Adapter, Adapter->psFlash2xVendorInfo)) return; i = 0; - while(i < TOTAL_SECTIONS) { - if(!(Adapter->psFlash2xVendorInfo->VendorSection[i].AccessFlags & FLASH2X_SECTION_PRESENT)) { + while (i < TOTAL_SECTIONS) { + if (!(Adapter->psFlash2xVendorInfo->VendorSection[i].AccessFlags & FLASH2X_SECTION_PRESENT)) { i++; continue; } @@ -2642,9 +2642,9 @@ static VOID UpdateVendorInfo(PMINI_ADAPTER Adapter) uiSizeSection = (Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionEnd - Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart); - switch(i) { + switch (i) { case DSD0: - if(( uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && + if (( uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd = VENDOR_PTR_IN_CS; else @@ -2652,7 +2652,7 @@ static VOID UpdateVendorInfo(PMINI_ADAPTER Adapter) break; case DSD1: - if(( uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && + if (( uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End = VENDOR_PTR_IN_CS; else @@ -2660,27 +2660,27 @@ static VOID UpdateVendorInfo(PMINI_ADAPTER Adapter) break; case DSD2: - if(( uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && + if (( uiSizeSection >= (Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + sizeof(DSD_HEADER))) && (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End = VENDOR_PTR_IN_CS; else Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End = UNINIT_PTR_IN_CS; break; case VSA0: - if(UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) + if (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd = VENDOR_PTR_IN_CS; else Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd = UNINIT_PTR_IN_CS; break; case VSA1: - if(UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) + if (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End = VENDOR_PTR_IN_CS; else Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End = UNINIT_PTR_IN_CS; break; case VSA2: - if(UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) + if (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart) Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End = VENDOR_PTR_IN_CS; else Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start = Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End = UNINIT_PTR_IN_CS; @@ -2724,7 +2724,7 @@ static INT BcmGetFlashCSInfo(PMINI_ADAPTER Adapter) memset(Adapter->psFlashCSInfo, 0 ,sizeof(FLASH_CS_INFO)); memset(Adapter->psFlash2xCSInfo, 0 ,sizeof(FLASH2X_CS_INFO)); - if(!Adapter->bDDRInitDone) { + if (!Adapter->bDDRInitDone) { { value = FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT; wrmalt(Adapter, 0xAF00A080, &value, sizeof(value)); @@ -2743,7 +2743,7 @@ static INT BcmGetFlashCSInfo(PMINI_ADAPTER Adapter) bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Signature is :%x\n", ntohl(Adapter->psFlashCSInfo->MagicNumber)); - if(FLASH_CONTROL_STRUCT_SIGNATURE == ntohl(Adapter->psFlashCSInfo->MagicNumber)) { + if (FLASH_CONTROL_STRUCT_SIGNATURE == ntohl(Adapter->psFlashCSInfo->MagicNumber)) { uiFlashLayoutMajorVersion = MAJOR_VERSION((Adapter->psFlashCSInfo->FlashLayoutVersion)); Adapter->uiFlashLayoutMinorVersion = MINOR_VERSION((Adapter->psFlashCSInfo->FlashLayoutVersion)); } else { @@ -2754,16 +2754,16 @@ static INT BcmGetFlashCSInfo(PMINI_ADAPTER Adapter) bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "FLASH LAYOUT MAJOR VERSION :%X\n", uiFlashLayoutMajorVersion); - if(uiFlashLayoutMajorVersion < FLASH_2X_MAJOR_NUMBER) { + if (uiFlashLayoutMajorVersion < FLASH_2X_MAJOR_NUMBER) { BeceemFlashBulkRead(Adapter,(PUINT)Adapter->psFlashCSInfo,Adapter->ulFlashControlSectionStart,sizeof(FLASH_CS_INFO)); ConvertEndianOfCSStructure(Adapter->psFlashCSInfo); Adapter->ulFlashCalStart = (Adapter->psFlashCSInfo->OffsetFromZeroForCalibrationStart); - if(!((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1))) { + if (!((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1))) { Adapter->ulFlashControlSectionStart = Adapter->psFlashCSInfo->OffsetFromZeroForControlSectionStart; } - if((FLASH_CONTROL_STRUCT_SIGNATURE == (Adapter->psFlashCSInfo->MagicNumber)) && + if ((FLASH_CONTROL_STRUCT_SIGNATURE == (Adapter->psFlashCSInfo->MagicNumber)) && (SCSI_FIRMWARE_MINOR_VERSION <= MINOR_VERSION(Adapter->psFlashCSInfo->SCSIFirmwareVersion)) && (FLASH_SECTOR_SIZE_SIG == (Adapter->psFlashCSInfo->FlashSectorSizeSig)) && (BYTE_WRITE_SUPPORT == (Adapter->psFlashCSInfo->FlashWriteSupportSize))) { @@ -2784,14 +2784,14 @@ static INT BcmGetFlashCSInfo(PMINI_ADAPTER Adapter) } else { - if(BcmFlash2xBulkRead(Adapter,(PUINT)Adapter->psFlash2xCSInfo,NO_SECTION_VAL, + if (BcmFlash2xBulkRead(Adapter,(PUINT)Adapter->psFlash2xCSInfo,NO_SECTION_VAL, Adapter->ulFlashControlSectionStart,sizeof(FLASH2X_CS_INFO))) { pr_info("Unable to read CS structure\n"); return STATUS_FAILURE; } ConvertEndianOf2XCSStructure(Adapter->psFlash2xCSInfo); BcmDumpFlash2XCSStructure(Adapter->psFlash2xCSInfo,Adapter); - if((FLASH_CONTROL_STRUCT_SIGNATURE == Adapter->psFlash2xCSInfo->MagicNumber) && + if ((FLASH_CONTROL_STRUCT_SIGNATURE == Adapter->psFlash2xCSInfo->MagicNumber) && (SCSI_FIRMWARE_MINOR_VERSION <= MINOR_VERSION(Adapter->psFlash2xCSInfo->SCSIFirmwareVersion)) && (FLASH_SECTOR_SIZE_SIG == Adapter->psFlash2xCSInfo->FlashSectorSizeSig) && (BYTE_WRITE_SUPPORT == Adapter->psFlash2xCSInfo->FlashWriteSupportSize)) { @@ -2846,7 +2846,7 @@ static NVM_TYPE BcmGetNvmType(PMINI_ADAPTER Adapter) UINT uiData = 0; BeceemEEPROMBulkRead(Adapter,&uiData,0x0,4); - if(uiData == BECM) { + if (uiData == BECM) { return NVM_EEPROM; } // @@ -2855,14 +2855,14 @@ static NVM_TYPE BcmGetNvmType(PMINI_ADAPTER Adapter) BcmGetFlashCSInfo(Adapter); BeceemFlashBulkRead(Adapter,&uiData,0x0 + Adapter->ulFlashCalStart,4); - if(uiData == BECM) { + if (uiData == BECM) { return NVM_FLASH; } // // even if there is no valid signature on EEPROM/FLASH find out if they really exist. // if exist select it. // - if(BcmGetEEPROMSize(Adapter)) { + if (BcmGetEEPROMSize(Adapter)) { return NVM_EEPROM; } @@ -2894,67 +2894,67 @@ INT BcmGetSectionValStartOffset(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlas SectStartOffset = INVALID_OFFSET ; - if(IsSectionExistInVendorInfo(Adapter,eFlashSectionVal)) { + if (IsSectionExistInVendorInfo(Adapter,eFlashSectionVal)) { return Adapter->psFlash2xVendorInfo->VendorSection[eFlashSectionVal].OffsetFromZeroForSectionStart; } - switch(eFlashSectionVal) { + switch (eFlashSectionVal) { case ISO_IMAGE1 : - if((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start != UNINIT_PTR_IN_CS) && + if ((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start != UNINIT_PTR_IN_CS) && (IsNonCDLessDevice(Adapter) == FALSE)) SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start); break; case ISO_IMAGE2 : - if((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start != UNINIT_PTR_IN_CS) && + if ((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start != UNINIT_PTR_IN_CS) && (IsNonCDLessDevice(Adapter) == FALSE)) SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start); break; case DSD0 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart != UNINIT_PTR_IN_CS) SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart); break; case DSD1 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start != UNINIT_PTR_IN_CS) SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start); break; case DSD2 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start != UNINIT_PTR_IN_CS) SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start); break; case VSA0 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart != UNINIT_PTR_IN_CS) SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart); break; case VSA1 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start != UNINIT_PTR_IN_CS) SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start); break; case VSA2 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start != UNINIT_PTR_IN_CS) SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start); break; case SCSI : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware); break; case CONTROL_SECTION : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart != UNINIT_PTR_IN_CS) SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart); break; case ISO_IMAGE1_PART2 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start != UNINIT_PTR_IN_CS) SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start); break; case ISO_IMAGE1_PART3 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start != UNINIT_PTR_IN_CS) SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start); break; case ISO_IMAGE2_PART2 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start != UNINIT_PTR_IN_CS) SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start); break; case ISO_IMAGE2_PART3 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start != UNINIT_PTR_IN_CS) SectStartOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start); break; default : @@ -2979,47 +2979,47 @@ INT BcmGetSectionValEndOffset(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2 INT SectEndOffset = 0 ; SectEndOffset = INVALID_OFFSET; - if(IsSectionExistInVendorInfo(Adapter,eFlash2xSectionVal)) { + if (IsSectionExistInVendorInfo(Adapter,eFlash2xSectionVal)) { return Adapter->psFlash2xVendorInfo->VendorSection[eFlash2xSectionVal].OffsetFromZeroForSectionEnd; } - switch(eFlash2xSectionVal) { + switch (eFlash2xSectionVal) { case ISO_IMAGE1 : - if((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End!= UNINIT_PTR_IN_CS) && + if ((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End!= UNINIT_PTR_IN_CS) && (IsNonCDLessDevice(Adapter) == FALSE)) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End); break; case ISO_IMAGE2 : - if((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End!= UNINIT_PTR_IN_CS) && + if ((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End!= UNINIT_PTR_IN_CS) && (IsNonCDLessDevice(Adapter) == FALSE)) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End); break; case DSD0 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd != UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDEnd); break; case DSD1 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End != UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1End); break; case DSD2 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End != UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2End); break; case VSA0 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd != UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAEnd); break; case VSA1 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End != UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1End); break; case VSA2 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End != UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2End); break; case SCSI : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) SectEndOffset = ((Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware) + (Adapter->psFlash2xCSInfo->SizeOfScsiFirmware)); break; @@ -3027,19 +3027,19 @@ INT BcmGetSectionValEndOffset(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2 //Not Clear So Putting failure. confirm and fix it. SectEndOffset = STATUS_FAILURE; case ISO_IMAGE1_PART2 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End!= UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End!= UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End); break; case ISO_IMAGE1_PART3 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End!= UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End!= UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End); break; case ISO_IMAGE2_PART2 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End != UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End); break; case ISO_IMAGE2_PART3 : - if(Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End!= UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End!= UNINIT_PTR_IN_CS) SectEndOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End); break; @@ -3073,28 +3073,28 @@ INT BcmFlash2xBulkRead( INT SectionStartOffset = 0; UINT uiAbsoluteOffset = 0 ; UINT uiTemp =0, value =0 ; - if(Adapter == NULL) { + if (Adapter == NULL) { pr_info("Adapter structure is NULL\n"); return -EINVAL; } - if(Adapter->device_removed ) { + if (Adapter->device_removed ) { pr_info("Device has been removed\n"); return -ENODEV; } //NO_SECTION_VAL means absolute offset is given. - if(eFlash2xSectionVal == NO_SECTION_VAL) + if (eFlash2xSectionVal == NO_SECTION_VAL) SectionStartOffset = 0; else SectionStartOffset = BcmGetSectionValStartOffset(Adapter,eFlash2xSectionVal); - if(SectionStartOffset == STATUS_FAILURE ) { + if (SectionStartOffset == STATUS_FAILURE ) { pr_info("This Section<%d> does not exixt in Flash 2.x Map\n", eFlash2xSectionVal); return -EINVAL; } - if(IsSectionExistInVendorInfo(Adapter,eFlash2xSectionVal)) + if (IsSectionExistInVendorInfo(Adapter,eFlash2xSectionVal)) return vendorextnReadSection(Adapter,(PUCHAR)pBuffer, eFlash2xSectionVal, uiOffsetWithinSectionVal, uiNumBytes); //calculating the absolute offset from FLASH; @@ -3106,7 +3106,7 @@ INT BcmFlash2xBulkRead( Status= BeceemFlashBulkRead(Adapter, pBuffer,uiAbsoluteOffset,uiNumBytes) ; wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); - if(Status) { + if (Status) { pr_info("Flash Read Failed with Status :%d\n", Status); return Status ; } @@ -3139,28 +3139,28 @@ INT BcmFlash2xBulkWrite( INT Status = STATUS_SUCCESS; UINT FlashSectValStartOffset = 0; UINT uiTemp = 0, value = 0; - if(Adapter == NULL) { + if (Adapter == NULL) { pr_info("Adapter structure is NULL\n"); return -EINVAL; } - if(Adapter->device_removed ) { + if (Adapter->device_removed ) { pr_info("Device has been removed\n"); return -ENODEV; } //NO_SECTION_VAL means absolute offset is given. - if(eFlash2xSectVal == NO_SECTION_VAL) + if (eFlash2xSectVal == NO_SECTION_VAL) FlashSectValStartOffset = 0; else FlashSectValStartOffset = BcmGetSectionValStartOffset(Adapter,eFlash2xSectVal); - if(FlashSectValStartOffset == STATUS_FAILURE ) { + if (FlashSectValStartOffset == STATUS_FAILURE ) { pr_info("This Section<%d> does not exixt in Flash Map 2.x\n", eFlash2xSectVal); return -EINVAL; } - if(IsSectionExistInVendorInfo(Adapter,eFlash2xSectVal)) + if (IsSectionExistInVendorInfo(Adapter,eFlash2xSectVal)) return vendorextnWriteSection(Adapter, (PUCHAR)pBuffer, eFlash2xSectVal, uiOffset, uiNumBytes, bVerify); //calculating the absolute offset from FLASH; @@ -3173,7 +3173,7 @@ INT BcmFlash2xBulkWrite( Status = BeceemFlashBulkWrite(Adapter, pBuffer,uiOffset,uiNumBytes,bVerify); wrmalt(Adapter, 0x0f000C80, &uiTemp, sizeof(uiTemp)); - if(Status) { + if (Status) { pr_info("Flash Write failed with Status :%d\n", Status); return Status ; } @@ -3197,24 +3197,24 @@ static INT BcmGetActiveDSD(PMINI_ADAPTER Adapter) uiHighestPriDSD = getHighestPriDSD(Adapter); Adapter->eActiveDSD = uiHighestPriDSD; - if(DSD0 == uiHighestPriDSD) + if (DSD0 == uiHighestPriDSD) Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart; - if(DSD1 == uiHighestPriDSD) + if (DSD1 == uiHighestPriDSD) Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start; - if(DSD2 == uiHighestPriDSD) + if (DSD2 == uiHighestPriDSD) Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start; - if(Adapter->eActiveDSD) + if (Adapter->eActiveDSD) bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Active DSD :%d\n", Adapter->eActiveDSD); - if(Adapter->eActiveDSD == 0) { + if (Adapter->eActiveDSD == 0) { //if No DSD gets Active, Make Active the DSD with WR permission - if(IsSectionWritable(Adapter,DSD2)) { + if (IsSectionWritable(Adapter,DSD2)) { Adapter->eActiveDSD = DSD2; Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start; - } else if(IsSectionWritable(Adapter,DSD1)) { + } else if (IsSectionWritable(Adapter,DSD1)) { Adapter->eActiveDSD = DSD1; Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start; - } else if(IsSectionWritable(Adapter,DSD0)) { + } else if (IsSectionWritable(Adapter,DSD0)) { Adapter->eActiveDSD = DSD0; Adapter->ulFlashCalStart = Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart; } @@ -3241,12 +3241,12 @@ static INT BcmGetActiveISO(PMINI_ADAPTER Adapter) HighestPriISO = getHighestPriISO(Adapter); Adapter->eActiveISO = HighestPriISO ; - if(Adapter->eActiveISO == ISO_IMAGE2) + if (Adapter->eActiveISO == ISO_IMAGE2) Adapter->uiActiveISOOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start); - else if(Adapter->eActiveISO == ISO_IMAGE1) + else if (Adapter->eActiveISO == ISO_IMAGE1) Adapter->uiActiveISOOffset = (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start); - if(Adapter->eActiveISO) + if (Adapter->eActiveISO) bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Active ISO :%x\n", Adapter->eActiveISO); @@ -3280,7 +3280,7 @@ B_UINT8 IsOffsetWritable(PMINI_ADAPTER Adapter, UINT uiOffset) //Setting Access permission permissionBits = uiWordOfSectorPermission & (0x3 << uiBitofSectorePermission) ; permissionBits = (permissionBits >> uiBitofSectorePermission) & 0x3; - if(permissionBits == SECTOR_READWRITE_PERMISSION) + if (permissionBits == SECTOR_READWRITE_PERMISSION) return TRUE; else return FALSE; @@ -3343,7 +3343,7 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 //For 1.x map all the section except DSD0 will be shown as not present //This part will be used by calibration tool to detect the number of DSD present in Flash. - if(IsFlash2x(Adapter) == FALSE) { + if (IsFlash2x(Adapter) == FALSE) { psFlash2xBitMap->ISO_IMAGE2 = 0; psFlash2xBitMap->ISO_IMAGE1 = 0; psFlash2xBitMap->DSD0 = FLASH2X_SECTION_VALID | FLASH2X_SECTION_ACT | FLASH2X_SECTION_PRESENT; //0xF; //0000(Reseved)1(Active)0(RW)1(valid)1(present) @@ -3367,20 +3367,20 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 /// // IS0 IMAGE 2 /// - if((psFlash2xCSInfo->OffsetISOImage2Part1Start) != UNINIT_PTR_IN_CS) { + if ((psFlash2xCSInfo->OffsetISOImage2Part1Start) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->ISO_IMAGE2= psFlash2xBitMap->ISO_IMAGE2 | FLASH2X_SECTION_PRESENT; - if(ReadISOSignature(Adapter,ISO_IMAGE2)== ISO_IMAGE_MAGIC_NUMBER) + if (ReadISOSignature(Adapter,ISO_IMAGE2)== ISO_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->ISO_IMAGE2 |= FLASH2X_SECTION_VALID; //Calculation for extrating the Access permission - if(IsSectionWritable(Adapter, ISO_IMAGE2) == FALSE) + if (IsSectionWritable(Adapter, ISO_IMAGE2) == FALSE) psFlash2xBitMap->ISO_IMAGE2 |= FLASH2X_SECTION_RO; - if(SetActiveISODone == FALSE && uiHighestPriISO == ISO_IMAGE2) { + if (SetActiveISODone == FALSE && uiHighestPriISO == ISO_IMAGE2) { psFlash2xBitMap->ISO_IMAGE2 |= FLASH2X_SECTION_ACT ; SetActiveISODone = TRUE; } @@ -3390,18 +3390,18 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 /// // IS0 IMAGE 1 /// - if((psFlash2xCSInfo->OffsetISOImage1Part1Start) != UNINIT_PTR_IN_CS) { + if ((psFlash2xCSInfo->OffsetISOImage1Part1Start) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->ISO_IMAGE1 = psFlash2xBitMap->ISO_IMAGE1 | FLASH2X_SECTION_PRESENT; - if(ReadISOSignature(Adapter,ISO_IMAGE1) == ISO_IMAGE_MAGIC_NUMBER) + if (ReadISOSignature(Adapter,ISO_IMAGE1) == ISO_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->ISO_IMAGE1 |= FLASH2X_SECTION_VALID; // Calculation for extrating the Access permission - if(IsSectionWritable(Adapter, ISO_IMAGE1) == FALSE) + if (IsSectionWritable(Adapter, ISO_IMAGE1) == FALSE) psFlash2xBitMap->ISO_IMAGE1 |= FLASH2X_SECTION_RO; - if(SetActiveISODone == FALSE && uiHighestPriISO == ISO_IMAGE1) { + if (SetActiveISODone == FALSE && uiHighestPriISO == ISO_IMAGE1) { psFlash2xBitMap->ISO_IMAGE1 |= FLASH2X_SECTION_ACT ; SetActiveISODone = TRUE; } @@ -3412,20 +3412,20 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 /// // DSD2 /// - if((psFlash2xCSInfo->OffsetFromZeroForDSD2Start) != UNINIT_PTR_IN_CS) { + if ((psFlash2xCSInfo->OffsetFromZeroForDSD2Start) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->DSD2= psFlash2xBitMap->DSD2 | FLASH2X_SECTION_PRESENT; - if(ReadDSDSignature(Adapter,DSD2)== DSD_IMAGE_MAGIC_NUMBER) + if (ReadDSDSignature(Adapter,DSD2)== DSD_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_VALID; //Calculation for extrating the Access permission - if(IsSectionWritable(Adapter, DSD2) == FALSE) { + if (IsSectionWritable(Adapter, DSD2) == FALSE) { psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_RO; } else { //Means section is writable - if((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD2)) { + if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD2)) { psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_ACT ; SetActiveDSDDone =TRUE ; } @@ -3435,20 +3435,20 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 /// // DSD 1 /// - if((psFlash2xCSInfo->OffsetFromZeroForDSD1Start) != UNINIT_PTR_IN_CS) { + if ((psFlash2xCSInfo->OffsetFromZeroForDSD1Start) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->DSD1= psFlash2xBitMap->DSD1 | FLASH2X_SECTION_PRESENT; - if(ReadDSDSignature(Adapter,DSD1)== DSD_IMAGE_MAGIC_NUMBER) + if (ReadDSDSignature(Adapter,DSD1)== DSD_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_VALID; //Calculation for extrating the Access permission - if(IsSectionWritable(Adapter, DSD1) == FALSE) { + if (IsSectionWritable(Adapter, DSD1) == FALSE) { psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_RO; } else { //Means section is writable - if((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD1)) { + if ((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD1)) { psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_ACT ; SetActiveDSDDone =TRUE ; } @@ -3459,19 +3459,19 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 /// //For DSD 0 // - if((psFlash2xCSInfo->OffsetFromZeroForDSDStart) != UNINIT_PTR_IN_CS) { + if ((psFlash2xCSInfo->OffsetFromZeroForDSDStart) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->DSD0 = psFlash2xBitMap->DSD0 | FLASH2X_SECTION_PRESENT; - if(ReadDSDSignature(Adapter,DSD0) == DSD_IMAGE_MAGIC_NUMBER) + if (ReadDSDSignature(Adapter,DSD0) == DSD_IMAGE_MAGIC_NUMBER) psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_VALID; //Setting Access permission - if(IsSectionWritable(Adapter, DSD0) == FALSE) { + if (IsSectionWritable(Adapter, DSD0) == FALSE) { psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_RO; } else { //Means section is writable - if((SetActiveDSDDone == FALSE) &&(uiHighestPriDSD == DSD0)) { + if ((SetActiveDSDDone == FALSE) &&(uiHighestPriDSD == DSD0)) { psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_ACT ; SetActiveDSDDone =TRUE ; } @@ -3481,7 +3481,7 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 /// // VSA 0 /// - if((psFlash2xCSInfo->OffsetFromZeroForVSAStart) != UNINIT_PTR_IN_CS) { + if ((psFlash2xCSInfo->OffsetFromZeroForVSAStart) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->VSA0= psFlash2xBitMap->VSA0 | FLASH2X_SECTION_PRESENT; @@ -3489,7 +3489,7 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 psFlash2xBitMap->VSA0 |= FLASH2X_SECTION_VALID; //Calculation for extrating the Access permission - if(IsSectionWritable(Adapter, VSA0) == FALSE) + if (IsSectionWritable(Adapter, VSA0) == FALSE) psFlash2xBitMap->VSA0 |= FLASH2X_SECTION_RO; //By Default section is Active @@ -3502,7 +3502,7 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 // VSA 1 /// - if((psFlash2xCSInfo->OffsetFromZeroForVSA1Start) != UNINIT_PTR_IN_CS) { + if ((psFlash2xCSInfo->OffsetFromZeroForVSA1Start) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->VSA1= psFlash2xBitMap->VSA1 | FLASH2X_SECTION_PRESENT; @@ -3510,7 +3510,7 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 psFlash2xBitMap->VSA1|= FLASH2X_SECTION_VALID; //Checking For Access permission - if(IsSectionWritable(Adapter, VSA1) == FALSE) + if (IsSectionWritable(Adapter, VSA1) == FALSE) psFlash2xBitMap->VSA1 |= FLASH2X_SECTION_RO; //By Default section is Active @@ -3523,7 +3523,7 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 // VSA 2 /// - if((psFlash2xCSInfo->OffsetFromZeroForVSA2Start) != UNINIT_PTR_IN_CS) { + if ((psFlash2xCSInfo->OffsetFromZeroForVSA2Start) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->VSA2= psFlash2xBitMap->VSA2 | FLASH2X_SECTION_PRESENT; @@ -3532,7 +3532,7 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 psFlash2xBitMap->VSA2 |= FLASH2X_SECTION_VALID; //Checking For Access permission - if(IsSectionWritable(Adapter, VSA2) == FALSE) + if (IsSectionWritable(Adapter, VSA2) == FALSE) psFlash2xBitMap->VSA2 |= FLASH2X_SECTION_RO; //By Default section is Active @@ -3542,7 +3542,7 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 /// // SCSI Section /// - if((psFlash2xCSInfo->OffsetFromZeroForScsiFirmware) != UNINIT_PTR_IN_CS) { + if ((psFlash2xCSInfo->OffsetFromZeroForScsiFirmware) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->SCSI= psFlash2xBitMap->SCSI | FLASH2X_SECTION_PRESENT; @@ -3551,7 +3551,7 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 psFlash2xBitMap->SCSI|= FLASH2X_SECTION_VALID; //Checking For Access permission - if(IsSectionWritable(Adapter, SCSI) == FALSE) + if (IsSectionWritable(Adapter, SCSI) == FALSE) psFlash2xBitMap->SCSI |= FLASH2X_SECTION_RO; //By Default section is Active @@ -3563,7 +3563,7 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 /// // Control Section /// - if((psFlash2xCSInfo->OffsetFromZeroForControlSectionStart) != UNINIT_PTR_IN_CS) { + if ((psFlash2xCSInfo->OffsetFromZeroForControlSectionStart) != UNINIT_PTR_IN_CS) { //Setting the 0th Bit representing the Section is present or not. psFlash2xBitMap->CONTROL_SECTION = psFlash2xBitMap->CONTROL_SECTION | (FLASH2X_SECTION_PRESENT); @@ -3572,7 +3572,7 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 psFlash2xBitMap->CONTROL_SECTION |= FLASH2X_SECTION_VALID; //Checking For Access permission - if(IsSectionWritable(Adapter, CONTROL_SECTION) == FALSE) + if (IsSectionWritable(Adapter, CONTROL_SECTION) == FALSE) psFlash2xBitMap->CONTROL_SECTION |= FLASH2X_SECTION_RO; //By Default section is Active @@ -3615,20 +3615,20 @@ INT BcmSetActiveSection(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectV Status = IsSectionWritable(Adapter,eFlash2xSectVal) ; - if(Status != TRUE ) { + if (Status != TRUE ) { pr_info("Provided Section <%d> is not writable\n", eFlash2xSectVal); return STATUS_FAILURE; } Adapter->bHeaderChangeAllowed = TRUE ; - switch(eFlash2xSectVal) { + switch (eFlash2xSectVal) { case ISO_IMAGE1 : case ISO_IMAGE2 : - if(ReadISOSignature(Adapter,eFlash2xSectVal)== ISO_IMAGE_MAGIC_NUMBER ) { + if (ReadISOSignature(Adapter,eFlash2xSectVal)== ISO_IMAGE_MAGIC_NUMBER ) { HighestPriISO = getHighestPriISO(Adapter); - if(HighestPriISO == eFlash2xSectVal ) { + if (HighestPriISO == eFlash2xSectVal ) { bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Given ISO<%x> already has highest priority\n", eFlash2xSectVal); @@ -3638,7 +3638,7 @@ INT BcmSetActiveSection(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectV SectImagePriority = ReadISOPriority(Adapter, HighestPriISO) + 1; - if((SectImagePriority <= 0) && IsSectionWritable(Adapter,HighestPriISO)) { + if ((SectImagePriority <= 0) && IsSectionWritable(Adapter,HighestPriISO)) { // This is a SPECIAL Case which will only happen if the current highest priority ISO has priority value = 0x7FFFFFFF. // We will write 1 to the current Highest priority ISO And then shall increase the priority of the requested ISO // by user @@ -3653,7 +3653,7 @@ INT BcmSetActiveSection(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectV SIGNATURE_SIZE, TRUE); - if(Status) { + if (Status) { pr_info("Priority has not been written properly\n"); Status = STATUS_FAILURE; break ; @@ -3661,7 +3661,7 @@ INT BcmSetActiveSection(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectV HighestPriISO = getHighestPriISO(Adapter); - if(HighestPriISO == eFlash2xSectVal ) { + if (HighestPriISO == eFlash2xSectVal ) { bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Given ISO<%x> already has highest priority\n", eFlash2xSectVal); @@ -3681,7 +3681,7 @@ INT BcmSetActiveSection(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectV 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER, ISOImagePriority), SIGNATURE_SIZE, TRUE); - if(Status) { + if (Status) { pr_info("Priority has not been written properly\n"); break ; } @@ -3694,10 +3694,10 @@ INT BcmSetActiveSection(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectV case DSD0 : case DSD1 : case DSD2 : - if(ReadDSDSignature(Adapter,eFlash2xSectVal)== DSD_IMAGE_MAGIC_NUMBER) { + if (ReadDSDSignature(Adapter,eFlash2xSectVal)== DSD_IMAGE_MAGIC_NUMBER) { HighestPriDSD = getHighestPriDSD(Adapter); - if((HighestPriDSD == eFlash2xSectVal)) { + if ((HighestPriDSD == eFlash2xSectVal)) { bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Given DSD<%x> already has highest priority\n", eFlash2xSectVal); @@ -3706,7 +3706,7 @@ INT BcmSetActiveSection(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectV } SectImagePriority = ReadDSDPriority(Adapter, HighestPriDSD) + 1 ; - if(SectImagePriority <= 0) { + if (SectImagePriority <= 0) { // This is a SPECIAL Case which will only happen if the current highest priority DSD has priority value = 0x7FFFFFFF. // We will write 1 to the current Highest priority DSD And then shall increase the priority of the requested DSD // by user @@ -3721,14 +3721,14 @@ INT BcmSetActiveSection(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectV SIGNATURE_SIZE, TRUE); - if(Status) { + if (Status) { pr_info("Priority has not been written properly\n"); break ; } HighestPriDSD = getHighestPriDSD(Adapter); - if((HighestPriDSD == eFlash2xSectVal)) { + if ((HighestPriDSD == eFlash2xSectVal)) { bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Made the DSD: %x highest by reducing priority of other\n", eFlash2xSectVal); @@ -3744,14 +3744,14 @@ INT BcmSetActiveSection(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectV SIGNATURE_SIZE, TRUE); - if(Status) { + if (Status) { pr_info("Priority has not been written properly\n"); break ; } HighestPriDSD = getHighestPriDSD(Adapter); - if((HighestPriDSD == eFlash2xSectVal)) { + if ((HighestPriDSD == eFlash2xSectVal)) { Status = STATUS_SUCCESS ; break; } @@ -3765,7 +3765,7 @@ INT BcmSetActiveSection(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectV Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader + FIELD_OFFSET_IN_HEADER(PDSD_HEADER, DSDImagePriority), SIGNATURE_SIZE , TRUE); - if(Status) { + if (Status) { pr_info("Priority has not been written properly\n"); Status = STATUS_FAILURE ; break ; @@ -3814,7 +3814,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) UINT SigBuff[MAX_RW_SIZE]; UINT i = 0; - if(ReadISOSignature(Adapter,sCopySectStrut.SrcSection) != ISO_IMAGE_MAGIC_NUMBER) { + if (ReadISOSignature(Adapter,sCopySectStrut.SrcSection) != ISO_IMAGE_MAGIC_NUMBER) { pr_info("error as Source ISO Section does not have valid signature\n"); return STATUS_FAILURE; } @@ -3825,14 +3825,14 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) 0 + FIELD_OFFSET_IN_HEADER(PISO_HEADER,ISOImageSize), 4); - if(Status) { + if (Status) { pr_info("Read failed while copying ISO\n"); return Status; } ISOLength = htonl(ISOLength); - if(ISOLength % Adapter->uiSectorSize) { + if (ISOLength % Adapter->uiSectorSize) { ISOLength = Adapter->uiSectorSize*(1 + ISOLength/Adapter->uiSectorSize); } @@ -3840,12 +3840,12 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) Buff = kzalloc(Adapter->uiSectorSize, GFP_KERNEL); - if(Buff == NULL) { + if (Buff == NULL) { pr_info("Memory allocation failed for section size\n"); return -ENOMEM; } - if(sCopySectStrut.SrcSection ==ISO_IMAGE1 && sCopySectStrut.DstSection ==ISO_IMAGE2) { + if (sCopySectStrut.SrcSection ==ISO_IMAGE1 && sCopySectStrut.DstSection ==ISO_IMAGE2) { eISOReadPart = ISO_IMAGE1 ; eISOWritePart = ISO_IMAGE2 ; uiReadOffsetWithinPart = 0; @@ -3858,7 +3858,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End) - (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start); - if(uiTotalDataToCopy < ISOLength) { + if (uiTotalDataToCopy < ISOLength) { pr_info("error as Source ISO Section does not have valid signature\n"); Status = STATUS_FAILURE; goto out; @@ -3871,7 +3871,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End) - (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start); - if(uiTotalDataToCopy < ISOLength) { + if (uiTotalDataToCopy < ISOLength) { pr_info("error as Dest ISO Section does not have enough section size\n"); Status = STATUS_FAILURE; goto out; @@ -3881,8 +3881,8 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) CorruptISOSig(Adapter,ISO_IMAGE2); - while(uiTotalDataToCopy) { - if(uiTotalDataToCopy == Adapter->uiSectorSize) { + while (uiTotalDataToCopy) { + if (uiTotalDataToCopy == Adapter->uiSectorSize) { //Setting for write of first sector. First sector is assumed to be written in last bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Writing the signature sector\n"); @@ -3896,19 +3896,19 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) uiReadOffsetWithinPart = uiReadOffsetWithinPart + Adapter->uiSectorSize ; uiWriteOffsetWithinPart = uiWriteOffsetWithinPart + Adapter->uiSectorSize ; - if((eISOReadPart == ISO_IMAGE1) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start) )) { + if ((eISOReadPart == ISO_IMAGE1) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start) )) { eISOReadPart = ISO_IMAGE1_PART2 ; uiReadOffsetWithinPart = 0; } - if((eISOReadPart == ISO_IMAGE1_PART2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start))) { + if ((eISOReadPart == ISO_IMAGE1_PART2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start))) { eISOReadPart = ISO_IMAGE1_PART3 ; uiReadOffsetWithinPart = 0; } - if((eISOWritePart == ISO_IMAGE2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start))) { + if ((eISOWritePart == ISO_IMAGE2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start))) { eISOWritePart = ISO_IMAGE2_PART2 ; uiWriteOffsetWithinPart = 0; } - if((eISOWritePart == ISO_IMAGE2_PART2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start))) { + if ((eISOWritePart == ISO_IMAGE2_PART2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start))) { eISOWritePart = ISO_IMAGE2_PART3 ; uiWriteOffsetWithinPart = 0; } @@ -3921,17 +3921,17 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) Adapter->uiSectorSize ); - if(Status) { + if (Status) { pr_info("Read failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOReadPart, uiReadOffsetWithinPart); break; } - if(IsThisHeaderSector == TRUE) { + if (IsThisHeaderSector == TRUE) { //If this is header sector write 0xFFFFFFFF at the sig time and in last write sig memcpy(SigBuff, Buff + sigOffset, MAX_RW_SIZE); - for(i = 0; i < MAX_RW_SIZE;i++) + for (i = 0; i < MAX_RW_SIZE;i++) *(Buff + sigOffset + i) = 0xFF; } Adapter->bHeaderChangeAllowed = TRUE ; @@ -3942,7 +3942,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) uiWriteOffsetWithinPart, Adapter->uiSectorSize, TRUE); - if(Status) { + if (Status) { pr_info("Write failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOWritePart, uiWriteOffsetWithinPart); break; @@ -3950,7 +3950,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) Adapter->bHeaderChangeAllowed = FALSE; - if(IsThisHeaderSector == TRUE) { + if (IsThisHeaderSector == TRUE) { WriteToFlashWithoutSectorErase(Adapter, SigBuff, eISOWritePart, @@ -3965,7 +3965,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) } - if(sCopySectStrut.SrcSection ==ISO_IMAGE2 && sCopySectStrut.DstSection ==ISO_IMAGE1) { + if (sCopySectStrut.SrcSection ==ISO_IMAGE2 && sCopySectStrut.DstSection ==ISO_IMAGE1) { eISOReadPart = ISO_IMAGE2 ; eISOWritePart = ISO_IMAGE1 ; uiReadOffsetWithinPart = 0; @@ -3978,7 +3978,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3End) - (Adapter->psFlash2xCSInfo->OffsetISOImage2Part3Start); - if(uiTotalDataToCopy < ISOLength) { + if (uiTotalDataToCopy < ISOLength) { pr_info("error as Source ISO Section does not have valid signature\n"); Status = STATUS_FAILURE; goto out; @@ -3991,7 +3991,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3End) - (Adapter->psFlash2xCSInfo->OffsetISOImage1Part3Start); - if(uiTotalDataToCopy < ISOLength) { + if (uiTotalDataToCopy < ISOLength) { pr_info("error as Dest ISO Section does not have enough section size\n"); Status = STATUS_FAILURE; goto out; @@ -4001,8 +4001,8 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) CorruptISOSig(Adapter,ISO_IMAGE1); - while(uiTotalDataToCopy) { - if(uiTotalDataToCopy == Adapter->uiSectorSize) { + while (uiTotalDataToCopy) { + if (uiTotalDataToCopy == Adapter->uiSectorSize) { //Setting for write of first sector. First sector is assumed to be written in last bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Writing the signature sector\n"); @@ -4016,19 +4016,19 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) uiReadOffsetWithinPart = uiReadOffsetWithinPart + Adapter->uiSectorSize ; uiWriteOffsetWithinPart = uiWriteOffsetWithinPart + Adapter->uiSectorSize ; - if((eISOReadPart == ISO_IMAGE2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start) )) { + if ((eISOReadPart == ISO_IMAGE2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start) )) { eISOReadPart = ISO_IMAGE2_PART2 ; uiReadOffsetWithinPart = 0; } - if((eISOReadPart == ISO_IMAGE2_PART2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start))) { + if ((eISOReadPart == ISO_IMAGE2_PART2) && (uiReadOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage2Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage2Part2Start))) { eISOReadPart = ISO_IMAGE2_PART3 ; uiReadOffsetWithinPart = 0; } - if((eISOWritePart == ISO_IMAGE1) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start))) { + if ((eISOWritePart == ISO_IMAGE1) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part1End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start))) { eISOWritePart = ISO_IMAGE1_PART2 ; uiWriteOffsetWithinPart = 0; } - if((eISOWritePart == ISO_IMAGE1_PART2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start))) { + if ((eISOWritePart == ISO_IMAGE1_PART2) && (uiWriteOffsetWithinPart == (Adapter->psFlash2xCSInfo->OffsetISOImage1Part2End - Adapter->psFlash2xCSInfo->OffsetISOImage1Part2Start))) { eISOWritePart = ISO_IMAGE1_PART3 ; uiWriteOffsetWithinPart = 0; } @@ -4040,17 +4040,17 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) uiReadOffsetWithinPart, Adapter->uiSectorSize ); - if(Status) { + if (Status) { pr_info("Read failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOReadPart, uiReadOffsetWithinPart); break; } - if(IsThisHeaderSector == TRUE) { + if (IsThisHeaderSector == TRUE) { //If this is header sector write 0xFFFFFFFF at the sig time and in last write sig memcpy(SigBuff, Buff + sigOffset, MAX_RW_SIZE); - for(i = 0; i < MAX_RW_SIZE;i++) + for (i = 0; i < MAX_RW_SIZE;i++) *(Buff + sigOffset + i) = 0xFF; } @@ -4062,7 +4062,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) Adapter->uiSectorSize, TRUE); - if(Status) { + if (Status) { pr_info("Write failed while copying ISO: Part: %x, OffsetWithinPart: %x\n", eISOWritePart, uiWriteOffsetWithinPart); break; @@ -4070,7 +4070,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) Adapter->bHeaderChangeAllowed = FALSE ; - if(IsThisHeaderSector == TRUE) { + if (IsThisHeaderSector == TRUE) { WriteToFlashWithoutSectorErase(Adapter, SigBuff, eISOWritePart, @@ -4109,9 +4109,9 @@ INT BcmFlash2xCorruptSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSect INT Status = STATUS_SUCCESS ; pr_info("Section Value :%x\n", eFlash2xSectionVal); - if((eFlash2xSectionVal == DSD0) || (eFlash2xSectionVal == DSD1) || (eFlash2xSectionVal == DSD2)) { + if ((eFlash2xSectionVal == DSD0) || (eFlash2xSectionVal == DSD1) || (eFlash2xSectionVal == DSD2)) { Status = CorruptDSDSig(Adapter, eFlash2xSectionVal); - } else if(eFlash2xSectionVal == ISO_IMAGE1 || eFlash2xSectionVal == ISO_IMAGE2) { + } else if (eFlash2xSectionVal == ISO_IMAGE1 || eFlash2xSectionVal == ISO_IMAGE2) { Status = CorruptISOSig(Adapter, eFlash2xSectionVal); } else { bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, @@ -4139,33 +4139,33 @@ INT BcmFlash2xWriteSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlashSectionV UINT uiOffset = 0; //DSD_HEADER dsdHeader = {0}; - if(Adapter->bSigCorrupted == FALSE) { + if (Adapter->bSigCorrupted == FALSE) { bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Signature is not corrupted by driver, hence not restoring\n"); return STATUS_SUCCESS; } - if(Adapter->bAllDSDWriteAllow == FALSE) { - if(IsSectionWritable(Adapter,eFlashSectionVal) == FALSE) { + if (Adapter->bAllDSDWriteAllow == FALSE) { + if (IsSectionWritable(Adapter,eFlashSectionVal) == FALSE) { pr_info("Section is not Writable...Hence can't Write signature\n"); return SECTOR_IS_NOT_WRITABLE; } } - if((eFlashSectionVal == DSD0) ||(eFlashSectionVal == DSD1) || (eFlashSectionVal == DSD2)) { + if ((eFlashSectionVal == DSD0) ||(eFlashSectionVal == DSD1) || (eFlashSectionVal == DSD2)) { uiSignature = htonl(DSD_IMAGE_MAGIC_NUMBER) ; uiOffset = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader ; uiOffset += FIELD_OFFSET_IN_HEADER(PDSD_HEADER,DSDImageMagicNumber); - if((ReadDSDSignature(Adapter,eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) { + if ((ReadDSDSignature(Adapter,eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) { pr_info("Corrupted Pattern is not there. Hence won't write sig\n"); return STATUS_FAILURE; } - } else if((eFlashSectionVal == ISO_IMAGE1) || (eFlashSectionVal == ISO_IMAGE2)) { + } else if ((eFlashSectionVal == ISO_IMAGE1) || (eFlashSectionVal == ISO_IMAGE2)) { uiSignature = htonl(ISO_IMAGE_MAGIC_NUMBER); //uiOffset = 0; uiOffset = FIELD_OFFSET_IN_HEADER(PISO_HEADER,ISOImageMagicNumber); - if((ReadISOSignature(Adapter,eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) { + if ((ReadISOSignature(Adapter,eFlashSectionVal) & 0xFF000000) != CORRUPTED_PATTERN) { pr_info("Corrupted Pattern is not there. Hence won't write sig\n"); return STATUS_FAILURE; } @@ -4204,7 +4204,7 @@ INT validateFlash2xReadWrite(PMINI_ADAPTER Adapter, PFLASH2X_READWRITE psFlash2x UINT uiSectEndOffset = 0; uiNumOfBytes = psFlash2xReadWrite->numOfBytes; - if(IsSectionExistInFlash(Adapter,psFlash2xReadWrite->Section) != TRUE) { + if (IsSectionExistInFlash(Adapter,psFlash2xReadWrite->Section) != TRUE) { pr_info("Section<%x> does not exixt in Flash\n", psFlash2xReadWrite->Section); return FALSE; @@ -4213,15 +4213,15 @@ INT validateFlash2xReadWrite(PMINI_ADAPTER Adapter, PFLASH2X_READWRITE psFlash2x bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Start offset :%x ,section :%d\n", uiSectStartOffset, psFlash2xReadWrite->Section); - if((psFlash2xReadWrite->Section == ISO_IMAGE1) ||(psFlash2xReadWrite->Section == ISO_IMAGE2)) { - if(psFlash2xReadWrite->Section == ISO_IMAGE1) { + if ((psFlash2xReadWrite->Section == ISO_IMAGE1) ||(psFlash2xReadWrite->Section == ISO_IMAGE2)) { + if (psFlash2xReadWrite->Section == ISO_IMAGE1) { uiSectEndOffset = BcmGetSectionValEndOffset(Adapter,ISO_IMAGE1) - BcmGetSectionValStartOffset(Adapter,ISO_IMAGE1)+ BcmGetSectionValEndOffset(Adapter,ISO_IMAGE1_PART2) - BcmGetSectionValStartOffset(Adapter,ISO_IMAGE1_PART2)+ BcmGetSectionValEndOffset(Adapter,ISO_IMAGE1_PART3) - BcmGetSectionValStartOffset(Adapter,ISO_IMAGE1_PART3); - } else if(psFlash2xReadWrite->Section == ISO_IMAGE2) { + } else if (psFlash2xReadWrite->Section == ISO_IMAGE2) { uiSectEndOffset = BcmGetSectionValEndOffset(Adapter,ISO_IMAGE2) - BcmGetSectionValStartOffset(Adapter,ISO_IMAGE2)+ BcmGetSectionValEndOffset(Adapter,ISO_IMAGE2_PART2) - @@ -4243,7 +4243,7 @@ INT validateFlash2xReadWrite(PMINI_ADAPTER Adapter, PFLASH2X_READWRITE psFlash2x "End offset :%x\n", uiSectEndOffset); //Checking the boundary condition - if((uiSectStartOffset + psFlash2xReadWrite->offset + uiNumOfBytes) <= uiSectEndOffset) + if ((uiSectStartOffset + psFlash2xReadWrite->offset + uiNumOfBytes) <= uiSectEndOffset) return TRUE; else { pr_info("Invalid Request....\n"); @@ -4262,7 +4262,7 @@ INT validateFlash2xReadWrite(PMINI_ADAPTER Adapter, PFLASH2X_READWRITE psFlash2x INT IsFlash2x(PMINI_ADAPTER Adapter) { - if(Adapter->uiFlashLayoutMajorVersion >= FLASH_2X_MAJOR_NUMBER) + if (Adapter->uiFlashLayoutMajorVersion >= FLASH_2X_MAJOR_NUMBER) return TRUE ; else return FALSE; @@ -4280,12 +4280,12 @@ static INT GetFlashBaseAddr(PMINI_ADAPTER Adapter) UINT uiBaseAddr = 0; - if(Adapter->bDDRInitDone) { + if (Adapter->bDDRInitDone) { /* For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr In case of Raw Read... use the default value */ - if(Adapter->uiFlashLayoutMajorVersion && (Adapter->bFlashRawRead == FALSE) && + if (Adapter->uiFlashLayoutMajorVersion && (Adapter->bFlashRawRead == FALSE) && !((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1)) ) uiBaseAddr = Adapter->uiFlashBaseAdd ; @@ -4296,7 +4296,7 @@ static INT GetFlashBaseAddr(PMINI_ADAPTER Adapter) For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr In case of Raw Read... use the default value */ - if(Adapter->uiFlashLayoutMajorVersion && (Adapter->bFlashRawRead == FALSE) && + if (Adapter->uiFlashLayoutMajorVersion && (Adapter->bFlashRawRead == FALSE) && !((Adapter->uiFlashLayoutMajorVersion == 1) && (Adapter->uiFlashLayoutMinorVersion == 1)) ) uiBaseAddr = Adapter->uiFlashBaseAdd | FLASH_CONTIGIOUS_START_ADDR_BEFORE_INIT; @@ -4333,22 +4333,22 @@ INT BcmCopySection(PMINI_ADAPTER Adapter, UINT BytesToBeCopied = 0; PUCHAR pBuff = NULL ; INT Status = STATUS_SUCCESS ; - if(SrcSection == DstSection) { + if (SrcSection == DstSection) { pr_info("Source and Destination should be different ...try again\n"); return -EINVAL; } - if((SrcSection != DSD0) && (SrcSection != DSD1) && (SrcSection != DSD2)) { + if ((SrcSection != DSD0) && (SrcSection != DSD1) && (SrcSection != DSD2)) { pr_info("Source should be DSD subsection\n"); return -EINVAL; } - if((DstSection != DSD0) && (DstSection != DSD1) && (DstSection != DSD2)) { + if ((DstSection != DSD0) && (DstSection != DSD1) && (DstSection != DSD2)) { pr_info("Destination should be DSD subsection\n"); return -EINVAL; } //if offset zero means have to copy complete secton - if(numOfBytes == 0) { + if (numOfBytes == 0) { numOfBytes = BcmGetSectionValEndOffset(Adapter,SrcSection) - BcmGetSectionValStartOffset(Adapter,SrcSection); @@ -4356,14 +4356,14 @@ INT BcmCopySection(PMINI_ADAPTER Adapter, "Section Size :0x%x\n", numOfBytes); } - if((offset + numOfBytes) > BcmGetSectionValEndOffset(Adapter,SrcSection) + if ((offset + numOfBytes) > BcmGetSectionValEndOffset(Adapter,SrcSection) - BcmGetSectionValStartOffset(Adapter,SrcSection)) { pr_info("Input parameters going beyond the section offS: %x numB: %x of Source Section\n", offset, numOfBytes); return -EINVAL; } - if((offset + numOfBytes) > BcmGetSectionValEndOffset(Adapter,DstSection) + if ((offset + numOfBytes) > BcmGetSectionValEndOffset(Adapter,DstSection) - BcmGetSectionValStartOffset(Adapter,DstSection)) { pr_info("Input parameters going beyond the section offS: %x numB: %x of Destination Section\n", offset, numOfBytes); @@ -4371,22 +4371,22 @@ INT BcmCopySection(PMINI_ADAPTER Adapter, } - if(numOfBytes > Adapter->uiSectorSize ) + if (numOfBytes > Adapter->uiSectorSize ) BuffSize = Adapter->uiSectorSize; else BuffSize = numOfBytes ; pBuff = (PCHAR)kzalloc(BuffSize, GFP_KERNEL); - if(pBuff == NULL) { + if (pBuff == NULL) { pr_info("Memory allocation failed..\n"); return -ENOMEM; } BytesToBeCopied = Adapter->uiSectorSize ; - if(offset % Adapter->uiSectorSize) + if (offset % Adapter->uiSectorSize) BytesToBeCopied = Adapter->uiSectorSize - (offset % Adapter->uiSectorSize); - if(BytesToBeCopied > numOfBytes) + if (BytesToBeCopied > numOfBytes) BytesToBeCopied = numOfBytes ; @@ -4396,26 +4396,26 @@ INT BcmCopySection(PMINI_ADAPTER Adapter, do { Status = BcmFlash2xBulkRead(Adapter, (PUINT)pBuff, SrcSection , offset,BytesToBeCopied); - if(Status) { + if (Status) { pr_info("Read failed at offset :%d for NOB :%d\n", SrcSection, BytesToBeCopied); break; } Status = BcmFlash2xBulkWrite(Adapter,(PUINT)pBuff,DstSection,offset,BytesToBeCopied,FALSE); - if(Status) { + if (Status) { pr_info("Write failed at offset :%d for NOB :%d\n", DstSection, BytesToBeCopied); break; } offset = offset + BytesToBeCopied; numOfBytes = numOfBytes - BytesToBeCopied ; - if(numOfBytes) { - if(numOfBytes > Adapter->uiSectorSize ) + if (numOfBytes) { + if (numOfBytes > Adapter->uiSectorSize ) BytesToBeCopied = Adapter->uiSectorSize; else BytesToBeCopied = numOfBytes; } - }while(numOfBytes > 0) ; + }while (numOfBytes > 0) ; kfree(pBuff); Adapter->bHeaderChangeAllowed = FALSE ; return Status; @@ -4445,7 +4445,7 @@ INT SaveHeaderIfPresent(PMINI_ADAPTER Adapter, PUCHAR pBuff, UINT uiOffset) uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1); - if((uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter,DSD2)- Adapter->uiSectorSize)|| + if ((uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter,DSD2)- Adapter->uiSectorSize)|| (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter,DSD1)- Adapter->uiSectorSize)|| (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter,DSD0)- Adapter->uiSectorSize)) { @@ -4455,16 +4455,16 @@ INT SaveHeaderIfPresent(PMINI_ADAPTER Adapter, PUCHAR pBuff, UINT uiOffset) bHasHeader = TRUE ; } - if(uiSectAlignAddr == BcmGetSectionValStartOffset(Adapter,ISO_IMAGE1) || + if (uiSectAlignAddr == BcmGetSectionValStartOffset(Adapter,ISO_IMAGE1) || uiSectAlignAddr == BcmGetSectionValStartOffset(Adapter,ISO_IMAGE2)) { offsetToProtect = 0; HeaderSizeToProtect = sizeof(ISO_HEADER); bHasHeader = TRUE; } //If Header is present overwrite passed buffer with this - if(bHasHeader && (Adapter->bHeaderChangeAllowed == FALSE)) { + if (bHasHeader && (Adapter->bHeaderChangeAllowed == FALSE)) { pTempBuff = (PUCHAR)kzalloc(HeaderSizeToProtect, GFP_KERNEL); - if(pTempBuff == NULL) { + if (pTempBuff == NULL) { pr_info("Memory allocation failed\n"); return -ENOMEM; } @@ -4476,10 +4476,10 @@ INT SaveHeaderIfPresent(PMINI_ADAPTER Adapter, PUCHAR pBuff, UINT uiOffset) kfree(pTempBuff); } - if(bHasHeader && Adapter->bSigCorrupted) { + if (bHasHeader && Adapter->bSigCorrupted) { sig = *((PUINT)(pBuff + offsetToProtect + FIELD_OFFSET_IN_HEADER(PDSD_HEADER,DSDImageMagicNumber))); sig = ntohl(sig); - if((sig & 0xFF000000) != CORRUPTED_PATTERN) { + if ((sig & 0xFF000000) != CORRUPTED_PATTERN) { bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Desired pattern is not at sig offset. Hence won't restore\n"); Adapter->bSigCorrupted = FALSE; @@ -4527,7 +4527,7 @@ static INT BcmDoChipSelect(PMINI_ADAPTER Adapter, UINT offset) power down modes (Idle mode/shutdown mode), the values in the register will be different. */ - if(Adapter->SelectedChip == ChipNum) + if (Adapter->SelectedChip == ChipNum) return STATUS_SUCCESS; //bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Selected Chip :%x\n", ChipNum); @@ -4538,7 +4538,7 @@ static INT BcmDoChipSelect(PMINI_ADAPTER Adapter, UINT offset) rdmalt(Adapter, FLASH_GPIO_CONFIG_REG, &GPIOConfig, 4); { - switch(ChipNum) { + switch (ChipNum) { case 0: PartNum = 0; break; @@ -4562,7 +4562,7 @@ static INT BcmDoChipSelect(PMINI_ADAPTER Adapter, UINT offset) Even if the chip goes to low power mode, it should wake with values in each register in sync with each other. These values are not written by host other than during CHIP_SELECT. */ - if(PartNum == ((FlashConfig >> CHIP_SELECT_BIT12) & 0x3)) + if (PartNum == ((FlashConfig >> CHIP_SELECT_BIT12) & 0x3)) return STATUS_SUCCESS; //clearing the bit[13..12] @@ -4587,7 +4587,7 @@ INT ReadDSDSignature(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL dsd) //sigoffsetInMap =(PUCHAR)&(dsdHeader.DSDImageMagicNumber) -(PUCHAR)&dsdHeader; - if(dsd != DSD0 && dsd != DSD1 && dsd != DSD2) { + if (dsd != DSD0 && dsd != DSD1 && dsd != DSD2) { pr_info("passed section value is not for DSDs\n"); return STATUS_FAILURE; } @@ -4609,8 +4609,8 @@ INT ReadDSDPriority(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL dsd) unsigned int uiDSDPri = STATUS_FAILURE; //DSD_HEADER dsdHeader = {0}; //priOffsetInMap = (PUCHAR)&(dsdHeader.DSDImagePriority) -(PUCHAR)&dsdHeader; - if(IsSectionWritable(Adapter,dsd)) { - if(ReadDSDSignature(Adapter,dsd)== DSD_IMAGE_MAGIC_NUMBER) { + if (IsSectionWritable(Adapter,dsd)) { + if (ReadDSDSignature(Adapter,dsd)== DSD_IMAGE_MAGIC_NUMBER) { BcmFlash2xBulkRead(Adapter, &uiDSDPri, dsd, @@ -4631,25 +4631,25 @@ FLASH2X_SECTION_VAL getHighestPriDSD(PMINI_ADAPTER Adapter) INT DsdPri= 0 ; FLASH2X_SECTION_VAL HighestPriDSD = 0 ; - if(IsSectionWritable(Adapter,DSD2)) { + if (IsSectionWritable(Adapter,DSD2)) { DSDHighestPri = ReadDSDPriority(Adapter,DSD2); HighestPriDSD = DSD2 ; } - if(IsSectionWritable(Adapter,DSD1)) { + if (IsSectionWritable(Adapter,DSD1)) { DsdPri = ReadDSDPriority(Adapter,DSD1); - if(DSDHighestPri < DsdPri) { + if (DSDHighestPri < DsdPri) { DSDHighestPri = DsdPri ; HighestPriDSD = DSD1; } } - if(IsSectionWritable(Adapter,DSD0)) { + if (IsSectionWritable(Adapter,DSD0)) { DsdPri = ReadDSDPriority(Adapter,DSD0); - if(DSDHighestPri < DsdPri) { + if (DSDHighestPri < DsdPri) { DSDHighestPri = DsdPri ; HighestPriDSD = DSD0; } } - if(HighestPriDSD) + if (HighestPriDSD) bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Highest DSD :%x , and its Pri :%x\n", HighestPriDSD, DSDHighestPri); @@ -4665,7 +4665,7 @@ INT ReadISOSignature(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL iso) //sigoffsetInMap =(PUCHAR)&(ISOHeader.ISOImageMagicNumber) -(PUCHAR)&ISOHeader; - if(iso != ISO_IMAGE1 && iso != ISO_IMAGE2) { + if (iso != ISO_IMAGE1 && iso != ISO_IMAGE2) { pr_info("passed section value is not for ISOs\n"); return STATUS_FAILURE; } @@ -4685,8 +4685,8 @@ INT ReadISOPriority(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL iso) { unsigned int ISOPri = STATUS_FAILURE; - if(IsSectionWritable(Adapter,iso)) { - if(ReadISOSignature(Adapter,iso)== ISO_IMAGE_MAGIC_NUMBER) { + if (IsSectionWritable(Adapter,iso)) { + if (ReadISOSignature(Adapter,iso)== ISO_IMAGE_MAGIC_NUMBER) { BcmFlash2xBulkRead(Adapter, &ISOPri, iso, @@ -4707,18 +4707,18 @@ FLASH2X_SECTION_VAL getHighestPriISO(PMINI_ADAPTER Adapter) INT ISOPri= 0 ; FLASH2X_SECTION_VAL HighestPriISO = NO_SECTION_VAL ; - if(IsSectionWritable(Adapter,ISO_IMAGE2)) { + if (IsSectionWritable(Adapter,ISO_IMAGE2)) { ISOHighestPri = ReadISOPriority(Adapter,ISO_IMAGE2); HighestPriISO = ISO_IMAGE2 ; } - if(IsSectionWritable(Adapter,ISO_IMAGE1)) { + if (IsSectionWritable(Adapter,ISO_IMAGE1)) { ISOPri = ReadISOPriority(Adapter,ISO_IMAGE1); - if(ISOHighestPri < ISOPri) { + if (ISOHighestPri < ISOPri) { ISOHighestPri = ISOPri ; HighestPriISO = ISO_IMAGE1; } } - if(HighestPriISO) + if (HighestPriISO) bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Highest ISO :%x and its Pri :%x\n", HighestPriISO, ISOHighestPri); @@ -4741,7 +4741,7 @@ INT WriteToFlashWithoutSectorErase(PMINI_ADAPTER Adapter, INT Status = STATUS_SUCCESS; PUCHAR pcBuff = (PUCHAR)pBuff; - if(uiNumBytes % Adapter->ulFlashWriteSize) { + if (uiNumBytes % Adapter->ulFlashWriteSize) { pr_info("Writing without Sector Erase for non-FlashWriteSize number of bytes 0x%x\n", uiNumBytes); return STATUS_FAILURE; @@ -4749,7 +4749,7 @@ INT WriteToFlashWithoutSectorErase(PMINI_ADAPTER Adapter, uiStartOffset = BcmGetSectionValStartOffset(Adapter,eFlash2xSectionVal); - if(IsSectionExistInVendorInfo(Adapter,eFlash2xSectionVal)) { + if (IsSectionExistInVendorInfo(Adapter,eFlash2xSectionVal)) { return vendorextnWriteSectionWithoutErase(Adapter, pcBuff, eFlash2xSectionVal, uiOffset, uiNumBytes); } @@ -4766,13 +4766,13 @@ INT WriteToFlashWithoutSectorErase(PMINI_ADAPTER Adapter, BcmDoChipSelect(Adapter,uiOffset); uiPartOffset = (uiOffset & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); - for(i = 0 ; i< uiNumBytes; i += Adapter->ulFlashWriteSize) { - if(Adapter->ulFlashWriteSize == BYTE_WRITE_SUPPORT) + for (i = 0 ; i< uiNumBytes; i += Adapter->ulFlashWriteSize) { + if (Adapter->ulFlashWriteSize == BYTE_WRITE_SUPPORT) Status = flashByteWrite(Adapter,uiPartOffset, pcBuff); else Status = flashWrite(Adapter,uiPartOffset, pcBuff); - if(Status != STATUS_SUCCESS) + if (Status != STATUS_SUCCESS) break; pcBuff = pcBuff + Adapter->ulFlashWriteSize; @@ -4790,48 +4790,48 @@ BOOLEAN IsSectionExistInFlash(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL section BOOLEAN SectionPresent = FALSE ; - switch(section) { + switch (section) { case ISO_IMAGE1 : - if((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start != UNINIT_PTR_IN_CS) && + if ((Adapter->psFlash2xCSInfo->OffsetISOImage1Part1Start != UNINIT_PTR_IN_CS) && (IsNonCDLessDevice(Adapter) == FALSE)) SectionPresent = TRUE ; break; case ISO_IMAGE2 : - if((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start != UNINIT_PTR_IN_CS) && + if ((Adapter->psFlash2xCSInfo->OffsetISOImage2Part1Start != UNINIT_PTR_IN_CS) && (IsNonCDLessDevice(Adapter) == FALSE)) SectionPresent = TRUE ; break; case DSD0 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSDStart != UNINIT_PTR_IN_CS) SectionPresent = TRUE ; break; case DSD1 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD1Start != UNINIT_PTR_IN_CS) SectionPresent = TRUE ; break; case DSD2 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForDSD2Start != UNINIT_PTR_IN_CS) SectionPresent = TRUE ; break; case VSA0 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSAStart != UNINIT_PTR_IN_CS) SectionPresent = TRUE ; break; case VSA1 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA1Start != UNINIT_PTR_IN_CS) SectionPresent = TRUE ; break; case VSA2 : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForVSA2Start != UNINIT_PTR_IN_CS) SectionPresent = TRUE ; break; case SCSI : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForScsiFirmware != UNINIT_PTR_IN_CS) SectionPresent = TRUE ; break; case CONTROL_SECTION : - if(Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart != UNINIT_PTR_IN_CS) + if (Adapter->psFlash2xCSInfo->OffsetFromZeroForControlSectionStart != UNINIT_PTR_IN_CS) SectionPresent = TRUE ; break; default : @@ -4844,17 +4844,17 @@ INT IsSectionWritable(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL Section) { INT offset = STATUS_FAILURE; INT Status = FALSE; - if(IsSectionExistInFlash(Adapter,Section) == FALSE) { + if (IsSectionExistInFlash(Adapter,Section) == FALSE) { pr_info("Section <%d> does not exist\n", Section); return FALSE; } offset = BcmGetSectionValStartOffset(Adapter,Section); - if(offset == INVALID_OFFSET) { + if (offset == INVALID_OFFSET) { pr_info("Section<%d> does not exist\n", Section); return FALSE; } - if(IsSectionExistInVendorInfo(Adapter,Section)) { + if (IsSectionExistInVendorInfo(Adapter,Section)) { return !(Adapter->psFlash2xVendorInfo->VendorSection[Section].AccessFlags & FLASH2X_SECTION_RO); } @@ -4873,15 +4873,15 @@ static INT CorruptDSDSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSect Adapter->bSigCorrupted = FALSE; - if(Adapter->bAllDSDWriteAllow == FALSE) { - if(IsSectionWritable(Adapter,eFlash2xSectionVal) != TRUE) { + if (Adapter->bAllDSDWriteAllow == FALSE) { + if (IsSectionWritable(Adapter,eFlash2xSectionVal) != TRUE) { pr_info("Section is not Writable...Hence can't Corrupt signature\n"); return SECTOR_IS_NOT_WRITABLE; } } pBuff = (PUCHAR)kzalloc(MAX_RW_SIZE, GFP_KERNEL); - if(pBuff == NULL) { + if (pBuff == NULL) { pr_info("Can't allocate memory\n"); return -ENOMEM ; } @@ -4898,15 +4898,15 @@ static INT CorruptDSDSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSect //Now corrupting the sig by corrupting 4th last Byte. *(pBuff + 12) = 0; - if(sig == DSD_IMAGE_MAGIC_NUMBER) { + if (sig == DSD_IMAGE_MAGIC_NUMBER) { Adapter->bSigCorrupted = TRUE; - if(Adapter->ulFlashWriteSize == BYTE_WRITE_SUPPORT) { + if (Adapter->ulFlashWriteSize == BYTE_WRITE_SUPPORT) { uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize -1); BlockStatus = BcmFlashUnProtectBlock(Adapter,uiSectAlignAddr,Adapter->uiSectorSize); WriteToFlashWithoutSectorErase(Adapter,(PUINT)(pBuff + 12),eFlash2xSectionVal, (uiOffset + 12),BYTE_WRITE_SUPPORT); - if(BlockStatus) { + if (BlockStatus) { BcmRestoreBlockProtectStatus(Adapter,BlockStatus); BlockStatus = 0; } @@ -4934,13 +4934,13 @@ static INT CorruptISOSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSect Adapter->bSigCorrupted = FALSE; - if(IsSectionWritable(Adapter,eFlash2xSectionVal) != TRUE) { + if (IsSectionWritable(Adapter,eFlash2xSectionVal) != TRUE) { pr_info("Section is not Writable...Hence can't Corrupt signature\n"); return SECTOR_IS_NOT_WRITABLE; } pBuff = (PUCHAR)kzalloc(MAX_RW_SIZE, GFP_KERNEL); - if(pBuff == NULL) { + if (pBuff == NULL) { pr_info("Can't allocate memory\n"); return -ENOMEM ; } @@ -4955,7 +4955,7 @@ static INT CorruptISOSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSect //corrupt signature *pBuff = 0; - if(sig == ISO_IMAGE_MAGIC_NUMBER) { + if (sig == ISO_IMAGE_MAGIC_NUMBER) { Adapter->bSigCorrupted = TRUE; WriteToFlashWithoutSectorErase(Adapter,(PUINT)pBuff,eFlash2xSectionVal, uiOffset ,Adapter->ulFlashWriteSize); @@ -4974,7 +4974,7 @@ static INT CorruptISOSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSect BOOLEAN IsNonCDLessDevice(PMINI_ADAPTER Adapter) { - if(Adapter->psFlash2xCSInfo->IsCDLessDeviceBootSig == NON_CDLESS_DEVICE_BOOT_SIG) + if (Adapter->psFlash2xCSInfo->IsCDLessDeviceBootSig == NON_CDLESS_DEVICE_BOOT_SIG) return TRUE; else return FALSE ; -- 1.7.8.111.gad25c.dirty _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel