Move braces to appropriate lines. Signed-off-by: Joe Perches <joe@xxxxxxxxxxx> --- drivers/staging/bcm/Adapter.h | 98 +-- drivers/staging/bcm/CmHost.c | 468 ++++--------- drivers/staging/bcm/DDRInit.c | 113 +--- drivers/staging/bcm/Debug.h | 3 +- drivers/staging/bcm/HostMIBSInterface.h | 36 +- drivers/staging/bcm/IPv6Protocol.c | 113 +-- drivers/staging/bcm/IPv6ProtocolHdr.h | 21 +- drivers/staging/bcm/InterfaceAdapter.h | 21 +- drivers/staging/bcm/InterfaceIdleMode.c | 93 +-- drivers/staging/bcm/InterfaceIsr.c | 39 +- drivers/staging/bcm/InterfaceRx.c | 66 +-- drivers/staging/bcm/InterfaceTx.c | 59 +-- drivers/staging/bcm/Ioctl.h | 45 +- drivers/staging/bcm/LeakyBucket.c | 102 +-- drivers/staging/bcm/Misc.c | 3 +- drivers/staging/bcm/PHSDefines.h | 18 +- drivers/staging/bcm/PHSModule.c | 428 ++++-------- drivers/staging/bcm/Protocol.h | 24 +- drivers/staging/bcm/Qos.c | 176 ++---- drivers/staging/bcm/Transmit.c | 53 +- drivers/staging/bcm/led_control.c | 3 +- drivers/staging/bcm/led_control.h | 6 +- drivers/staging/bcm/nvm.c | 1152 ++++++++++--------------------- drivers/staging/bcm/nvm.h | 21 +- drivers/staging/bcm/target_params.h | 3 +- 25 files changed, 1019 insertions(+), 2145 deletions(-) diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index 226efbd..716ab10 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -4,8 +4,7 @@ #define MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES 256 #include "Debug.h" -struct _LEADER -{ +struct _LEADER { USHORT Vcid; USHORT PLength; UCHAR Status; @@ -13,16 +12,14 @@ struct _LEADER }__attribute__((packed)); typedef struct _LEADER LEADER,*PLEADER; -struct _PACKETTOSEND -{ +struct _PACKETTOSEND { LEADER Leader; UCHAR ucPayload; }__attribute__((packed)); typedef struct _PACKETTOSEND PACKETTOSEND, *PPACKETTOSEND; -struct _CONTROL_PACKET -{ +struct _CONTROL_PACKET { PVOID ControlBuff; UINT ControlBuffLen; struct _CONTROL_PACKET* next; @@ -30,8 +27,7 @@ struct _CONTROL_PACKET typedef struct _CONTROL_PACKET CONTROL_PACKET,*PCONTROL_PACKET; -struct link_request -{ +struct link_request { LEADER Leader; UCHAR szData[4]; }__attribute__((packed)); @@ -39,8 +35,7 @@ typedef struct link_request LINK_REQUEST, *PLINK_REQUEST; //classification extension is added -typedef struct _ADD_CONNECTION -{ +typedef struct _ADD_CONNECTION { ULONG SrcIpAddressCount; ULONG SrcIpAddress[MAX_CONNECTIONS]; ULONG SrcIpMask[MAX_CONNECTIONS]; @@ -60,8 +55,7 @@ typedef struct _ADD_CONNECTION } ADD_CONNECTION,*PADD_CONNECTION; -typedef struct _CLASSIFICATION_RULE -{ +typedef struct _CLASSIFICATION_RULE { UCHAR ucIPSrcAddrLen; UCHAR ucIPSrcAddr[32]; UCHAR ucIPDestAddrLen; @@ -73,8 +67,7 @@ typedef struct _CLASSIFICATION_RULE USHORT usVcid; } CLASSIFICATION_RULE,*PCLASSIFICATION_RULE; -typedef struct _CLASSIFICATION_ONLY -{ +typedef struct _CLASSIFICATION_ONLY { USHORT usVcid; ULONG DestIpAddress; ULONG DestIpMask; @@ -90,34 +83,28 @@ typedef struct _CLASSIFICATION_ONLY #define MAX_PROTOCOL_LENGTH 32 #define IPV6_ADDRESS_SIZEINBYTES 0x10 -typedef union _U_IP_ADDRESS -{ - struct - { - ULONG ulIpv4Addr[MAX_IP_RANGE_LENGTH];//Source Ip Address Range - ULONG ulIpv4Mask[MAX_IP_RANGE_LENGTH];//Source Ip Mask Address Range +typedef union _U_IP_ADDRESS { + struct { + ULONG ulIpv4Addr[MAX_IP_RANGE_LENGTH];//Source Ip Address Range + ULONG ulIpv4Mask[MAX_IP_RANGE_LENGTH];//Source Ip Mask Address Range }; - struct - { - ULONG ulIpv6Addr[MAX_IP_RANGE_LENGTH * 4];//Source Ip Address Range - ULONG ulIpv6Mask[MAX_IP_RANGE_LENGTH * 4];//Source Ip Mask Address Range + struct { + ULONG ulIpv6Addr[MAX_IP_RANGE_LENGTH * 4];//Source Ip Address Range + ULONG ulIpv6Mask[MAX_IP_RANGE_LENGTH * 4];//Source Ip Mask Address Range }; - struct - { - UCHAR ucIpv4Address[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS]; - UCHAR ucIpv4Mask[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS]; + struct { + UCHAR ucIpv4Address[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS]; + UCHAR ucIpv4Mask[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS]; }; - struct - { - UCHAR ucIpv6Address[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES]; - UCHAR ucIpv6Mask[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES]; + struct { + UCHAR ucIpv6Address[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES]; + UCHAR ucIpv6Mask[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES]; }; }U_IP_ADDRESS; struct _packet_info; -typedef struct _S_HDR_SUPRESSION_CONTEXTINFO -{ +typedef struct _S_HDR_SUPRESSION_CONTEXTINFO { UCHAR ucaHdrSupressionInBuf[MAX_PHS_LENGTHS]; //Intermediate buffer to accumulate pkt Header for PHS UCHAR ucaHdrSupressionOutBuf[MAX_PHS_LENGTHS + PHSI_LEN]; //Intermediate buffer containing pkt Header after PHS @@ -125,8 +112,7 @@ typedef struct _S_HDR_SUPRESSION_CONTEXTINFO }S_HDR_SUPRESSION_CONTEXTINFO; -typedef struct _S_CLASSIFIER_RULE -{ +typedef struct _S_CLASSIFIER_RULE { ULONG ulSFID; UCHAR ucReserved[2]; B_UINT16 uiClassifierRuleIndex; @@ -180,8 +166,7 @@ typedef struct _S_CLASSIFIER_RULE }S_CLASSIFIER_RULE; //typedef struct _S_CLASSIFIER_RULE S_CLASSIFIER_RULE; -typedef struct _S_FRAGMENTED_PACKET_INFO -{ +typedef struct _S_FRAGMENTED_PACKET_INFO { BOOLEAN bUsed; ULONG ulSrcIpAddress; USHORT usIpIdentification; @@ -189,8 +174,7 @@ typedef struct _S_FRAGMENTED_PACKET_INFO BOOLEAN bOutOfOrderFragment; }S_FRAGMENTED_PACKET_INFO,*PS_FRAGMENTED_PACKET_INFO; -struct _packet_info -{ +struct _packet_info { //classification extension Rule ULONG ulSFID; USHORT usVCID_Value; @@ -229,15 +213,12 @@ struct _packet_info UINT uiPendedLast; UCHAR ucIpVersion; - union - { - struct - { + union { + struct { struct sk_buff* FirstTxQueue; struct sk_buff* LastTxQueue; }; - struct - { + struct { struct sk_buff* ControlHead; struct sk_buff* ControlTail; }; @@ -264,8 +245,7 @@ struct _packet_info typedef struct _packet_info PacketInfo; -typedef struct _PER_TARANG_DATA -{ +typedef struct _PER_TARANG_DATA { struct _PER_TARANG_DATA * next; struct _MINI_ADAPTER * Adapter; struct sk_buff* RxAppControlHead; @@ -279,8 +259,7 @@ typedef struct _PER_TARANG_DATA #ifdef REL_4_1 -typedef struct _TARGET_PARAMS -{ +typedef struct _TARGET_PARAMS { B_UINT32 m_u32CfgVersion; // Scanning Related Params @@ -362,8 +341,7 @@ typedef struct _TARGET_PARAMS } STARGETPARAMS, *PSTARGETPARAMS; #endif -typedef struct _STTARGETDSXBUFFER -{ +typedef struct _STTARGETDSXBUFFER { ULONG ulTargetDsxBuffer; B_UINT16 tid; BOOLEAN valid; @@ -376,8 +354,7 @@ typedef INT (*FP_FLASH_WRITE_STATUS)(struct _MINI_ADAPTER*,UINT,PVOID); /** Driver adapter data structure */ -struct _MINI_ADAPTER -{ +struct _MINI_ADAPTER { struct _MINI_ADAPTER *next; struct net_device *dev; u32 msg_enable; @@ -581,8 +558,7 @@ struct _ETH_HEADER_STRUC { typedef struct _ETH_HEADER_STRUC ETH_HEADER_STRUC, *PETH_HEADER_STRUC; -typedef struct FirmwareInfo -{ +typedef struct FirmwareInfo { void __user * pvMappedFirmwareAddress; ULONG u32FirmwareLength; ULONG u32StartingAddress; @@ -590,14 +566,13 @@ typedef struct FirmwareInfo // holds the value of net_device structure.. extern struct net_device *gblpnetdev; -typedef struct _cntl_pkt{ +typedef struct _cntl_pkt { PMINI_ADAPTER Adapter; PLEADER PLeader; -}cntl_pkt; +} cntl_pkt; typedef LINK_REQUEST CONTROL_MESSAGE; -typedef struct _DDR_SETTING -{ +typedef struct _DDR_SETTING { UINT ulRegAddress; UINT ulRegValue; }DDR_SETTING, *PDDR_SETTING; @@ -635,8 +610,7 @@ InitAdapter(PMINI_ADAPTER psAdapter); #define EP6 5 -typedef enum eInterface_setting -{ +typedef enum eInterface_setting { DEFAULT_SETTING_0 = 0, ALTERNATE_SETTING_1 = 1, }INTERFACE_SETTING; diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 2053c3b..c382ff9 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -71,8 +71,7 @@ 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++) - { + for(uiClassifierIndex=0;uiClassifierIndex<MAX_CLASSIFIERS;uiClassifierIndex++) { if((Adapter->astClassifierTable[uiClassifierIndex].bUsed) && (Adapter->astClassifierTable[uiClassifierIndex].uiClassifierRuleIndex == uiClassifierID)&& (Adapter->astClassifierTable[uiClassifierIndex].ulSFID == ulSFID)) @@ -90,8 +89,7 @@ static int SearchFreeClsid(PMINI_ADAPTER Adapter /**Adapter Context*/ ) { unsigned int uiClassifierIndex = 0; - for(uiClassifierIndex=0;uiClassifierIndex<MAX_CLASSIFIERS;uiClassifierIndex++) - { + for(uiClassifierIndex=0;uiClassifierIndex<MAX_CLASSIFIERS;uiClassifierIndex++) { if(!Adapter->astClassifierTable[uiClassifierIndex].bUsed) return uiClassifierIndex; } @@ -121,53 +119,42 @@ 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): - (TOTAL_MASKED_ADDRESS_IN_BYTES)) >= u8IpAddressLen) - { + (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 = pstClassifierEntry->stDestIpAddress.ucIpv6Mask; - } - else - { + } else { ptrClassifierIpAddress = pstClassifierEntry->stDestIpAddress.ucIpv4Address; 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 = pstClassifierEntry->stSrcIpAddress.ucIpv6Mask; - } - else - { + } else { ptrClassifierIpAddress = pstClassifierEntry->stSrcIpAddress.ucIpv4Address; ptrClassifierIpMask = @@ -177,25 +164,20 @@ CopyIpAddrToClassifier(S_CLASSIFIER_RULE *pstClassifierEntry , bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Address Length:0x%X\n", pstClassifierEntry->ucIPDestinationAddressLength); while((u8IpAddressLen>= nSizeOfIPAddressInBytes) && - (ucLoopIndex < MAX_IP_RANGE_LENGTH)) - { + (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, @@ -204,17 +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. @@ -222,9 +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. @@ -236,28 +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 ; - ucLoopIndex++) - { - if(eIpAddrContext == eSrcIpAddress) - { + ucLoopIndex++) { + 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. @@ -272,8 +243,7 @@ CopyIpAddrToClassifier(S_CLASSIFIER_RULE *pstClassifierEntry , void ClearTargetDSXBuffer(PMINI_ADAPTER Adapter,B_UINT16 TID,BOOLEAN bFreeAll) { ULONG ulIndex; - for(ulIndex=0; ulIndex < Adapter->ulTotalTargetBuffersAvailable; ulIndex++) - { + for(ulIndex=0; ulIndex < Adapter->ulTotalTargetBuffersAvailable; ulIndex++) { if(Adapter->astTargetDsxBuffer[ulIndex].valid) continue; if ((bFreeAll) || (Adapter->astTargetDsxBuffer[ulIndex].tid == TID)){ @@ -312,8 +282,7 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter,stConvergenceSLT return; pstClassifierEntry = &Adapter->astClassifierTable[nClassifierIndex]; - if(pstClassifierEntry) - { + if(pstClassifierEntry) { //Store if Ipv6 pstClassifierEntry->bIpv6Protocol = (Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion == IPV6)?TRUE:FALSE; @@ -323,10 +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] = @@ -337,9 +304,7 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter,stConvergenceSLT pstClassifierEntry->usDestPortRangeLo[ucLoopIndex]); pstClassifierEntry->usDestPortRangeHi[ucLoopIndex]=ntohs(pstClassifierEntry->usDestPortRangeHi[ucLoopIndex]); } - } - else - { + } else { pstClassifierEntry->ucDestPortRangeLength=0; } //Source Port @@ -347,14 +312,12 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter,stConvergenceSLT "Source Port Range Length:0x%X\n", psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength); if(MAX_PORT_RANGE >= - psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength) - { + psfCSType->cCPacketClassificationRule.u8ProtocolSourcePortRangeLength) { pstClassifierEntry->ucSrcPortRangeLength = psfCSType->cCPacketClassificationRule. u8ProtocolSourcePortRangeLength/4; for(ucLoopIndex = 0; ucLoopIndex < - (pstClassifierEntry->ucSrcPortRangeLength); ucLoopIndex++) - { + (pstClassifierEntry->ucSrcPortRangeLength); ucLoopIndex++) { pstClassifierEntry->usSrcPortRangeLo[ucLoopIndex] = *((PUSHORT)(psfCSType->cCPacketClassificationRule. u8ProtocolSourcePortRange+ucLoopIndex)); @@ -392,8 +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 = @@ -404,13 +366,10 @@ 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 - { + } else { pstClassifierEntry->ucProtocolLength=1;// 1 valid protocol } @@ -435,8 +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; } @@ -481,8 +439,7 @@ static inline VOID DeleteClassifierRuleFromSF(PMINI_ADAPTER Adapter,UINT uiSearc pstClassifierEntry = &Adapter->astClassifierTable[nClassifierIndex]; - if(pstClassifierEntry) - { + if(pstClassifierEntry) { pstClassifierEntry->bUsed = FALSE; pstClassifierEntry->uiClassifierRuleIndex = 0; memset(pstClassifierEntry,0,sizeof(S_CLASSIFIER_RULE)); @@ -513,13 +470,10 @@ VOID DeleteAllClassifiersForSF(PMINI_ADAPTER Adapter,UINT uiSearchRuleIndex) 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); } } @@ -576,37 +530,31 @@ 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) - { - case eCSPacketIPV4: - { + switch(psfLocalSet->u8CSSpecification) { + case eCSPacketIPV4: { Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS; break; } - case eCSPacketIPV6: - { + case eCSPacketIPV6: { Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV6_CS; break; } case eCS802_3PacketEthernet: - case eCS802_1QPacketVLAN: - { + case eCS802_1QPacketVLAN: { Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3; break; } case eCSPacketIPV4Over802_1QVLAN: - case eCSPacketIPV4Over802_3Ethernet: - { + case eCSPacketIPV4Over802_3Ethernet: { Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS; Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3; break; } case eCSPacketIPV6Over802_1QVLAN: - case eCSPacketIPV6Over802_3Ethernet: - { + case eCSPacketIPV6Over802_3Ethernet: { Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV6_CS; Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3; break; @@ -629,12 +577,9 @@ 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 - { + } else { Adapter->PackInfo[uiSearchRuleIndex].ucIpVersion = IPV4; } @@ -643,8 +588,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = 0; if(psfLocalSet->u8ServiceClassNameLength > 0 && - psfLocalSet->u8ServiceClassNameLength < 32) - { + psfLocalSet->u8ServiceClassNameLength < 32) { memcpy(Adapter->PackInfo[uiSearchRuleIndex].ucServiceClassName, psfLocalSet->u8ServiceClassName, psfLocalSet->u8ServiceClassNameLength); @@ -653,8 +597,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A psfLocalSet->u8ServiceFlowSchedulingType; if(Adapter->PackInfo[uiSearchRuleIndex].u8QueueType==BE && - Adapter->PackInfo[uiSearchRuleIndex].ucDirection) - { + Adapter->PackInfo[uiSearchRuleIndex].ucDirection) { Adapter->usBestEffortQueueIndex=uiSearchRuleIndex; } @@ -663,33 +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; @@ -715,19 +651,15 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A u16PacketClassificationRuleIndex = ntohs(psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex); - switch(eClassifierAction) - { - case eAddClassifier: - { + 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"); @@ -737,8 +669,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A CopyClassifierRuleToSF(Adapter,psfCSType,uiSearchRuleIndex,nClassifierIndex); } - else - { + else { //This Classifier Already Exists and it is invalid to Add Classifier with existing PCRI bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "CopyToAdapter : Error The Specified Classifier Already Exists and attempted To Add Classifier with Same PCRI : 0x%x\n", @@ -747,13 +678,11 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A } break; - case eReplaceClassifier: - { + case eReplaceClassifier: { //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"); @@ -764,13 +693,11 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A } break; - case eDeleteClassifier: - { + case eDeleteClassifier: { //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"); @@ -791,18 +718,15 @@ 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, "psfCSType->u8PhsDSCAction : 0x%x\n", psfCSType->u8PhsDSCAction ); - switch (psfCSType->u8PhsDSCAction) - { - case eDeleteAllPHSRules: - { + switch (psfCSType->u8PhsDSCAction) { + case eDeleteAllPHSRules: { bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Deleting All PHS Rules For VCID: 0x%X\n", uVCID); @@ -815,27 +739,22 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A break; } - case eDeletePHSRule: - { + case eDeletePHSRule: { 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, psfCSType->cCPacketClassificationRule.u8AssociatedPHSI); - } - else - { + } else { } break; } default : { - if(ucDsxType == DSC_ACK) - { + if(ucDsxType == DSC_ACK) { break; //FOr DSC ACK Case PHS DSC Action must be in valid set } } @@ -843,20 +762,15 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A //No Break Here . Intentionally! case eAddPHSRule: - case eSetPHSRule: - { - if(psfCSType->cPhsRule.u8PHSI) - { + case eSetPHSRule: { + 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(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)) - { + (Adapter->astClassifierTable[uiClassifierIndex].u8AssociatedPHSI == psfCSType->cPhsRule.u8PHSI)) { bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Adding PHS Rule For Classifier : 0x%x cPhsRule.u8PHSI : 0x%x\n", Adapter->astClassifierTable[uiClassifierIndex].uiClassifierRuleIndex, @@ -888,17 +802,14 @@ 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)); } } } - } - else - { + } else { //Error PHS Rule specified in signaling could not be applied to any classifier //Copy the PHS Rule @@ -937,22 +848,17 @@ 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; - } - else if (ntohl(psfLocalSet->u32MaxSustainedTrafficRate) > - WIMAX_MAX_ALLOWED_RATE) - { + } else if (ntohl(psfLocalSet->u32MaxSustainedTrafficRate) > + WIMAX_MAX_ALLOWED_RATE) { //Too large Allowed Rate specified. Limiting to Wi Max Allowed rate Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate = WIMAX_MAX_ALLOWED_RATE; - } - else - { + } else { Adapter->PackInfo[uiSearchRuleIndex].uiMaxAllowedRate = ntohl(psfLocalSet->u32MaxSustainedTrafficRate); } @@ -980,8 +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. @@ -1193,8 +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, @@ -1205,8 +1109,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer) pstAddIndication->sfAuthorizedSet.u16MacOverhead); 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]; @@ -1465,14 +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]; @@ -1727,13 +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]; @@ -1877,8 +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; @@ -1898,8 +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; } @@ -1926,15 +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++; } @@ -1943,8 +1838,7 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter,PVOID pvBuffer,UINT *p if( (pstAddIndicationAlt->u8Type == DSD_RSP) || - (pstAddIndicationAlt->u8Type == DSD_ACK)) - { + (pstAddIndicationAlt->u8Type == DSD_ACK)) { //No Special handling send the message as it is return 1; } @@ -1967,8 +1861,7 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter,PVOID pvBuffer,UINT *p /* 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; @@ -2032,8 +1925,7 @@ static inline stLocalSFAddIndicationAlt bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "=====>\n"); if ((pstAddIndication->u8Type == DSD_REQ) || (pstAddIndication->u8Type == DSD_RSP) || - (pstAddIndication->u8Type == DSD_ACK)) - { + (pstAddIndication->u8Type == DSD_ACK)) { return (stLocalSFAddIndicationAlt *)pvBuffer; } @@ -2045,12 +1937,9 @@ static inline stLocalSFAddIndicationAlt */ pstAddIndicationDest=kmalloc(sizeof(stLocalSFAddIndicationAlt), GFP_KERNEL); - if(pstAddIndicationDest) - { + if(pstAddIndicationDest) { memset(pstAddIndicationDest,0,sizeof(stLocalSFAddIndicationAlt)); - } - else - { + } else { bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Failed to allocate memory for SF Add Indication Structure\n"); return NULL; @@ -2087,8 +1976,7 @@ 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) @@ -2096,8 +1984,7 @@ static inline stLocalSFAddIndicationAlt 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) @@ -2105,8 +1992,7 @@ static inline stLocalSFAddIndicationAlt 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) @@ -2154,8 +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; } @@ -2177,8 +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; @@ -2198,23 +2082,20 @@ static ULONG GetNextTargetBufferLocation(PMINI_ADAPTER Adapter,B_UINT16 tid) ULONG ulTargetDsxBufferIndexToUse,ulMaxTry; if((Adapter->ulTotalTargetBuffersAvailable == 0)|| - (Adapter->ulFreeTargetBufferCnt == 0)) - { + (Adapter->ulFreeTargetBufferCnt == 0)) { ClearTargetDSXBuffer(Adapter,tid,FALSE); return 0; } 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); @@ -2275,8 +2156,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap //read out the rest of the service flow param structure */ if((pstAddIndication = RestoreCmControlResponseMessage(Adapter,pvBuffer)) - == NULL) - { + == NULL) { ClearTargetDSXBuffer(Adapter,((stLocalSFAddIndication *)pvBuffer)->u16TID, FALSE); pr_info("Error in restoring Service Flow param structure from DSx message\n"); return FALSE; @@ -2291,10 +2171,8 @@ 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) - { - case DSA_REQ: - { + switch(pstAddIndication->u8Type) { + case DSA_REQ: { pLeader->PLength = sizeof(stLocalSFAddIndicationAlt); bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "Sending DSA Response....\n"); @@ -2311,8 +2189,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap kfree(pstAddIndication); } break; - case DSA_RSP: - { + case DSA_RSP: { pLeader->PLength = sizeof(stLocalSFAddIndicationAlt); bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "SENDING DSA ACK TO MAC %d\n", @@ -2322,8 +2199,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap ((stLocalSFAddIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSA_ACK; }//no break here..we should go down. - case DSA_ACK: - { + case DSA_ACK: { UINT uiSearchRuleIndex=0; bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, "VCID:0x%X\n", @@ -2335,46 +2211,35 @@ 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 - { + } else { psfLocalSet = &pstAddIndication->sfActiveSet; 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; @@ -2382,8 +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 = @@ -2404,12 +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; @@ -2423,24 +2284,20 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap } } - else - { + else { Adapter->PackInfo[uiSearchRuleIndex].bActive=FALSE; Adapter->PackInfo[uiSearchRuleIndex].bValid=FALSE; Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value=0; kfree(pstAddIndication); } - } - else - { + } else { pr_info("DSA ACK did not get valid SFID\n"); kfree(pstAddIndication); return FALSE; } } break; - case DSC_REQ: - { + case DSC_REQ: { pLeader->PLength = sizeof(stLocalSFChangeIndicationAlt); pstChangeIndication = (stLocalSFChangeIndicationAlt*)pstAddIndication; bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, @@ -2454,8 +2311,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap kfree(pstAddIndication); } break; - case DSC_RSP: - { + case DSC_RSP: { pLeader->PLength = sizeof(stLocalSFChangeIndicationAlt); pstChangeIndication = (stLocalSFChangeIndicationAlt*)pstAddIndication; bcm_dbg(Adapter, OTHERS, CONN_MSG, ALL, @@ -2464,53 +2320,41 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap *((stLocalSFChangeIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE])) = *pstChangeIndication; ((stLocalSFChangeIndicationAlt*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSC_ACK; } - case DSC_ACK: - { + case DSC_ACK: { UINT uiSearchRuleIndex=0; 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; } } - else - { + else { 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", @@ -2524,23 +2368,18 @@ 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); } - } - else - { + } else { pr_info("DSC ACK did not get valid SFID\n"); kfree(pstAddIndication); return FALSE; } } break; - case DSD_REQ: - { + case DSD_REQ: { UINT uiSearchRuleIndex; ULONG ulSFID; @@ -2553,8 +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++; @@ -2565,8 +2403,7 @@ BOOLEAN CmControlResponseMessage(PMINI_ADAPTER Adapter, /**<Pointer to the Adap ((stLocalSFDeleteIndication*)&(Adapter->caDsxReqResp[LEADER_SIZE]))->u8Type = DSD_RSP; CopyBufferToControlPacket(Adapter,(PVOID)Adapter->caDsxReqResp); } - case DSD_RSP: - { + case DSD_RSP: { //Do nothing as SF has already got Deleted } break; @@ -2595,8 +2432,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, - psSfInfo->pstSFIndication, sizeof(stLocalSFAddIndicationAlt))) - { + psSfInfo->pstSFIndication, sizeof(stLocalSFAddIndicationAlt))) { pr_info("copy to user failed SFID %d, present in queue !!!\n", uiSFId); status = -EFAULT; @@ -2617,8 +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); @@ -2628,22 +2463,18 @@ 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); - } - else - { + } else { Adapter->PackInfo[uiSearchRuleIndex].usVCID_Value = ntohs(pHostInfo->VCID); Adapter->PackInfo[uiSearchRuleIndex].usCID = ntohs(pHostInfo->newCID); @@ -2657,8 +2488,7 @@ VOID OverrideServiceFlowParams(PMINI_ADAPTER Adapter,PUINT puiBuffer) Adapter->PackInfo[uiSearchRuleIndex].bAuthorizedSet =TRUE; 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 02fa7a9..6b2a9a4 100644 --- a/drivers/staging/bcm/DDRInit.c +++ b/drivers/staging/bcm/DDRInit.c @@ -781,11 +781,9 @@ int ddr_init(MINI_ADAPTER *Adapter) UINT uiClockSetting = 0; int retval = STATUS_SUCCESS; - switch (Adapter->chip_id) - { + switch (Adapter->chip_id) { case 0xbece3200: - switch (Adapter->DDRSetting) - { + switch (Adapter->DDRSetting) { case DDR_80_MHZ: psDDRSetting=asT3LP_DDRSetting80MHz; RegCount=(sizeof(asT3LP_DDRSetting80MHz)/ @@ -800,12 +798,9 @@ 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 - { + } else { uiClockSetting = 0x03F1365B; } break; @@ -824,8 +819,7 @@ int ddr_init(MINI_ADAPTER *Adapter) */ if( (Adapter->chip_id != BCS220_2) && (Adapter->chip_id != BCS220_2BC) && - (Adapter->chip_id != BCS220_3) ) - { + (Adapter->chip_id != BCS220_3) ) { retval= rdmalt(Adapter,(UINT)0x0f000830, &uiResetValue, sizeof(uiResetValue)); if(retval < 0) { bcm_dbg(Adapter, CMHOST, RDM, ALL, @@ -842,8 +836,7 @@ int ddr_init(MINI_ADAPTER *Adapter) return retval; } } - switch(Adapter->DDRSetting) - { + switch(Adapter->DDRSetting) { @@ -862,12 +855,9 @@ 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 - { + } else { uiClockSetting = 0x03F1365B; } break; @@ -876,12 +866,9 @@ 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 - { + } else { uiClockSetting = 0x03F137DB; } } @@ -894,8 +881,7 @@ int ddr_init(MINI_ADAPTER *Adapter) case 0xbece0300: bcm_dbg(Adapter, INITEXIT, DRV_ENTRY, ALL, "DDR Setting: %x\n", Adapter->DDRSetting); - switch (Adapter->DDRSetting) - { + switch (Adapter->DDRSetting) { case DDR_80_MHZ: psDDRSetting = asT3_DDRSetting80MHz; RegCount = (sizeof(asT3_DDRSetting80MHz)/ @@ -914,10 +900,8 @@ int ddr_init(MINI_ADAPTER *Adapter) default: return -EINVAL; } - case 0xbece0310: - { - switch (Adapter->DDRSetting) - { + case 0xbece0310: { + switch (Adapter->DDRSetting) { case DDR_80_MHZ: psDDRSetting = asT3B_DDRSetting80MHz; RegCount=(sizeof(asT3B_DDRSetting80MHz)/ @@ -937,18 +921,13 @@ int ddr_init(MINI_ADAPTER *Adapter) psDDRSetting = asT3B_DDRSetting133MHz; RegCount=(sizeof(asT3B_DDRSetting133MHz)/ sizeof(DDR_SETTING)); - } - else - { + } else { 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 - { + } else { uiClockSetting = 0x07F1365B; } } @@ -966,14 +945,10 @@ 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 - { + } else { value = psDDRSetting->ulRegValue; } retval = wrmalt(Adapter, psDDRSetting->ulRegAddress, &value, sizeof(value)); @@ -986,14 +961,12 @@ 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)&& (Adapter->chip_id != BCS220_2BC)&& - (Adapter->chip_id != BCS220_3)) - { + (Adapter->chip_id != BCS220_3)) { /* drive MDDR to half in case of UMA-B: */ uiResetValue = 0x01010001; retval = wrmalt(Adapter, (UINT)0x0F007018, &uiResetValue, sizeof(uiResetValue)); @@ -1036,8 +1009,7 @@ 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) { bcm_dbg(Adapter, CMHOST, RDM, ALL, @@ -1081,9 +1053,7 @@ int ddr_init(MINI_ADAPTER *Adapter) __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) { @@ -1145,11 +1115,9 @@ int download_ddr_settings(PMINI_ADAPTER Adapter) int retval = STATUS_SUCCESS; BOOLEAN bOverrideSelfRefresh = FALSE; - switch (Adapter->chip_id) - { + switch (Adapter->chip_id) { case 0xbece3200: - switch (Adapter->DDRSetting) - { + switch (Adapter->DDRSetting) { case DDR_80_MHZ: psDDRSetting = asT3LP_DDRSetting80MHz; RegCount = (sizeof(asT3LP_DDRSetting80MHz)/sizeof(DDR_SET_NODE)); @@ -1179,8 +1147,7 @@ int download_ddr_settings(PMINI_ADAPTER Adapter) case BCS220_2BC: case BCS250_BC: case BCS220_3 : - switch (Adapter->DDRSetting) - { + switch (Adapter->DDRSetting) { case DDR_80_MHZ: psDDRSetting = asT3LPB_DDRSetting80MHz; RegCount=(sizeof(asT3LPB_DDRSetting80MHz)/sizeof(DDR_SET_NODE)); @@ -1214,8 +1181,7 @@ int download_ddr_settings(PMINI_ADAPTER Adapter) } break; case 0xbece0300: - switch (Adapter->DDRSetting) - { + switch (Adapter->DDRSetting) { case DDR_80_MHZ: psDDRSetting = asT3_DDRSetting80MHz; RegCount = (sizeof(asT3_DDRSetting80MHz)/sizeof(DDR_SET_NODE)); @@ -1238,10 +1204,8 @@ int download_ddr_settings(PMINI_ADAPTER Adapter) return -EINVAL; } break; - case 0xbece0310: - { - switch (Adapter->DDRSetting) - { + case 0xbece0310: { + switch (Adapter->DDRSetting) { case DDR_80_MHZ: psDDRSetting = asT3B_DDRSetting80MHz; RegCount = (sizeof(asT3B_DDRSetting80MHz)/sizeof(DDR_SET_NODE)); @@ -1270,8 +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; @@ -1280,8 +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; } @@ -1289,24 +1251,19 @@ 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, &value, sizeof(value))){ pr_info("%s:%d\n", __func__, __LINE__); break; } - } - else - { + } else { value = psDDRSetting->ulRegValue; if(STATUS_SUCCESS != wrmalt(Adapter, ul_ddr_setting_load_addr , diff --git a/drivers/staging/bcm/Debug.h b/drivers/staging/bcm/Debug.h index 2d35d2d..d272f85 100644 --- a/drivers/staging/bcm/Debug.h +++ b/drivers/staging/bcm/Debug.h @@ -189,8 +189,7 @@ * Delibrately matches that of the Windows driver.. * The TestApp's ioctl passes this struct to us. */ -typedef struct -{ +typedef struct { unsigned int Subtype, Type; unsigned int OnOff; // unsigned int debug_level; /* future expansion */ diff --git a/drivers/staging/bcm/HostMIBSInterface.h b/drivers/staging/bcm/HostMIBSInterface.h index ad7e8ff..fc39388 100644 --- a/drivers/staging/bcm/HostMIBSInterface.h +++ b/drivers/staging/bcm/HostMIBSInterface.h @@ -22,40 +22,34 @@ #define MIBS_MAX_HIST_ENTRIES 12 #define MIBS_PKTSIZEHIST_RANGE 128 -typedef union _U_MIBS_IP_ADDRESS -{ - struct - { +typedef union _U_MIBS_IP_ADDRESS { + struct { //Source Ip Address Range ULONG ulIpv4Addr[MIBS_MAX_IP_RANGE_LENGTH]; //Source Ip Mask Address Range ULONG ulIpv4Mask[MIBS_MAX_IP_RANGE_LENGTH]; }; - struct - { + struct { //Source Ip Address Range ULONG ulIpv6Addr[MIBS_MAX_IP_RANGE_LENGTH * 4]; //Source Ip Mask Address Range ULONG ulIpv6Mask[MIBS_MAX_IP_RANGE_LENGTH * 4]; }; - struct - { + struct { UCHAR ucIpv4Address[MIBS_MAX_IP_RANGE_LENGTH * MIBS_IP_LENGTH_OF_ADDRESS]; UCHAR ucIpv4Mask[MIBS_MAX_IP_RANGE_LENGTH * MIBS_IP_LENGTH_OF_ADDRESS]; }; - struct - { + struct { UCHAR ucIpv6Address[MIBS_MAX_IP_RANGE_LENGTH * MIBS_IPV6_ADDRESS_SIZEINBYTES]; UCHAR ucIpv6Mask[MIBS_MAX_IP_RANGE_LENGTH * MIBS_IPV6_ADDRESS_SIZEINBYTES]; }; }U_MIBS_IP_ADDRESS; -typedef struct _S_MIBS_HOST_INFO -{ +typedef struct _S_MIBS_HOST_INFO { ULONG64 GoodTransmits; ULONG64 GoodReceives; // this to keep track of the Tx and Rx MailBox Registers. @@ -77,8 +71,7 @@ typedef struct _S_MIBS_HOST_INFO UINT32 aRxPktSizeHist[MIBS_MAX_HIST_ENTRIES]; }S_MIBS_HOST_INFO; -typedef struct _S_MIBS_CLASSIFIER_RULE -{ +typedef struct _S_MIBS_CLASSIFIER_RULE { ULONG ulSFID; UCHAR ucReserved[2]; B_UINT16 uiClassifierRuleIndex; @@ -115,8 +108,7 @@ typedef struct _S_MIBS_CLASSIFIER_RULE }S_MIBS_CLASSIFIER_RULE; -typedef struct _S_MIBS_PHS_RULE -{ +typedef struct _S_MIBS_PHS_RULE { ULONG ulSFID; /// brief 8bit PHSI Of The Service Flow B_UINT8 u8PHSI; @@ -138,8 +130,7 @@ typedef struct _S_MIBS_PHS_RULE ULONG PHSErrorNumPackets; }S_MIBS_PHS_RULE; -typedef struct _S_MIBS_EXTSERVICEFLOW_PARAMETERS -{ +typedef struct _S_MIBS_EXTSERVICEFLOW_PARAMETERS { UINT32 wmanIfSfid; UINT32 wmanIfCmnCpsSfState; UINT32 wmanIfCmnCpsMaxSustainedRate; @@ -165,8 +156,7 @@ typedef struct _S_MIBS_EXTSERVICEFLOW_PARAMETERS }S_MIBS_EXTSERVICEFLOW_PARAMETERS; -typedef struct _S_MIBS_SERVICEFLOW_TABLE -{ +typedef struct _S_MIBS_SERVICEFLOW_TABLE { //classification extension Rule ULONG ulSFID; USHORT usVCID_Value; @@ -204,8 +194,7 @@ typedef struct _S_MIBS_SERVICEFLOW_TABLE UINT uiTotalTxBytes; }S_MIBS_SERVICEFLOW_TABLE; -typedef struct _S_MIBS_DROPPED_APP_CNTRL_MESSAGES -{ +typedef struct _S_MIBS_DROPPED_APP_CNTRL_MESSAGES { ULONG cm_responses; ULONG cm_control_newdsx_multiclassifier_resp; ULONG link_control_resp; @@ -217,8 +206,7 @@ typedef struct _S_MIBS_DROPPED_APP_CNTRL_MESSAGES }S_MIBS_DROPPED_APP_CNTRL_MESSAGES; -typedef struct _S_MIBS_HOST_STATS_MIBS -{ +typedef struct _S_MIBS_HOST_STATS_MIBS { S_MIBS_HOST_INFO stHostInfo; S_MIBS_CLASSIFIER_RULE astClassifierTable[MIBS_MAX_CLASSIFIERS]; S_MIBS_SERVICEFLOW_TABLE astSFtable[MIBS_MAX_SERVICEFLOWS]; diff --git a/drivers/staging/bcm/IPv6Protocol.c b/drivers/staging/bcm/IPv6Protocol.c index 49e084c..8e24671 100644 --- a/drivers/staging/bcm/IPv6Protocol.c +++ b/drivers/staging/bcm/IPv6Protocol.c @@ -11,8 +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; @@ -21,8 +20,7 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader pucRetHeaderPtr = *ppucPayload; pucPayloadPtr = *ppucPayload; - if(!pucRetHeaderPtr || !pucPayloadPtr) - { + if(!pucRetHeaderPtr || !pucPayloadPtr) { *bParseDone = TRUE; return NULL; } @@ -32,10 +30,8 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader - switch(*pucNextHeader) - { - case IPV6HDR_TYPE_HOPBYHOP: - { + switch(*pucNextHeader) { + case IPV6HDR_TYPE_HOPBYHOP: { bcm_dbg(Adapter, TX, IPV6_DBG, ALL, "IPv6 HopByHop Header\n"); @@ -43,8 +39,7 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader } break; - case IPV6HDR_TYPE_ROUTING: - { + case IPV6HDR_TYPE_ROUTING: { IPV6RoutingHeader *pstIpv6RoutingHeader; bcm_dbg(Adapter, TX, IPV6_DBG, ALL, "IPv6 Routing Header\n"); @@ -54,16 +49,14 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader } break; - case IPV6HDR_TYPE_FRAGMENTATION: - { + case IPV6HDR_TYPE_FRAGMENTATION: { bcm_dbg(Adapter, TX, IPV6_DBG, ALL, "IPv6 Fragmentation Header\n"); usNextHeaderOffset+= sizeof(IPV6FragmentHeader); } break; - case IPV6HDR_TYPE_DESTOPTS: - { + case IPV6HDR_TYPE_DESTOPTS: { IPV6DestOptionsHeader *pstIpv6DestOptsHdr = (IPV6DestOptionsHeader *)pucPayloadPtr; int nTotalOptions = pstIpv6DestOptsHdr->ucHdrExtLen; bcm_dbg(Adapter, TX, IPV6_DBG, ALL, @@ -73,8 +66,7 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader } break; - case IPV6HDR_TYPE_AUTHENTICATION: - { + case IPV6HDR_TYPE_AUTHENTICATION: { IPV6AuthenticationHeader *pstIpv6AuthHdr = (IPV6AuthenticationHeader *)pucPayloadPtr; int nHdrLen = pstIpv6AuthHdr->ucLength; bcm_dbg(Adapter, TX, IPV6_DBG, ALL, @@ -82,28 +74,24 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader usNextHeaderOffset+= nHdrLen * 4; } break; - case IPV6HDR_TYPE_ENCRYPTEDSECURITYPAYLOAD: - { + case IPV6HDR_TYPE_ENCRYPTEDSECURITYPAYLOAD: { bcm_dbg(Adapter, TX, IPV6_DBG, ALL, "IPv6 Encrypted Security Payload Header\n"); *bParseDone = TRUE; } break; - case IPV6_ICMP_HDR_TYPE: - { + case IPV6_ICMP_HDR_TYPE: { bcm_dbg(Adapter, TX, IPV6_DBG, ALL, "ICMP Header\n"); *bParseDone = TRUE; } break; - case TCP_HEADER_TYPE: - { + case TCP_HEADER_TYPE: { bcm_dbg(Adapter, TX, IPV6_DBG, ALL, "TCP Header\n"); *bParseDone = TRUE; } break; - case UDP_HEADER_TYPE: - { + case UDP_HEADER_TYPE: { bcm_dbg(Adapter, TX, IPV6_DBG, ALL, "UDP Header\n"); *bParseDone = TRUE; } @@ -118,14 +106,10 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader } - if(*bParseDone == FALSE) - { - if(*pusPayloadLength <= usNextHeaderOffset) - { + if(*bParseDone == FALSE) { + if(*pusPayloadLength <= usNextHeaderOffset) { *bParseDone = TRUE; - } - else - { + } else { *pucNextHeader = *pucPayloadPtr; pucPayloadPtr+=usNextHeaderOffset; (*pusPayloadLength)-=usNextHeaderOffset; @@ -148,20 +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, @@ -203,15 +183,13 @@ 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; } @@ -230,8 +208,7 @@ USHORT IpVersion6(PMINI_ADAPTER Adapter, /**< Pointer to the driver control stru 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)); @@ -254,18 +231,13 @@ USHORT IpVersion6(PMINI_ADAPTER Adapter, /**< Pointer to the driver control stru } }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) - { + } else { + if(FALSE == Adapter->PackInfo[iMatchedSFQueueIndex].bActive) { bClassificationSucceed = FALSE; } } @@ -294,13 +266,11 @@ static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,IPV6Head //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); @@ -311,17 +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++) - { + for(uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) { if((pstClassifierRule->stSrcIpAddress.ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & aulSrcIP[uiIpv6AddIndex]) - != pstClassifierRule->stSrcIpAddress.ulIpv6Addr[uiLoopIndex+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"); @@ -351,13 +318,11 @@ static BOOLEAN MatchDestIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,IPV6Hea //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); @@ -368,17 +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++) - { + for(uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) { if((pstClassifierRule->stDestIpAddress.ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & aulDestIP[uiIpv6AddIndex]) - != pstClassifierRule->stDestIpAddress.ulIpv6Addr[uiLoopIndex+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"); @@ -395,8 +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/IPv6ProtocolHdr.h b/drivers/staging/bcm/IPv6ProtocolHdr.h index b32a953..d9cc055 100644 --- a/drivers/staging/bcm/IPv6ProtocolHdr.h +++ b/drivers/staging/bcm/IPv6ProtocolHdr.h @@ -27,8 +27,7 @@ //typedef unsigned short USHORT; //typedef unsigned long int ULONG; -typedef struct IPV6HeaderFormatTag -{ +typedef struct IPV6HeaderFormatTag { UCHAR ucVersionPrio; UCHAR aucFlowLabel[3]; USHORT usPayloadLength; @@ -38,8 +37,7 @@ typedef struct IPV6HeaderFormatTag ULONG ulDestIpAddress[4]; }IPV6Header; -typedef struct IPV6RoutingHeaderFormatTag -{ +typedef struct IPV6RoutingHeaderFormatTag { UCHAR ucNextHeader; UCHAR ucRoutingType; UCHAR ucNumAddresses; @@ -49,31 +47,27 @@ typedef struct IPV6RoutingHeaderFormatTag }IPV6RoutingHeader; -typedef struct IPV6FragmentHeaderFormatTag -{ +typedef struct IPV6FragmentHeaderFormatTag { UCHAR ucNextHeader; UCHAR ucReserved; USHORT usFragmentOffset; ULONG ulIdentification; }IPV6FragmentHeader; -typedef struct IPV6DestOptionsHeaderFormatTag -{ +typedef struct IPV6DestOptionsHeaderFormatTag { UCHAR ucNextHeader; UCHAR ucHdrExtLen; UCHAR ucDestOptions[6]; //UCHAR udExtDestOptions[0]; }IPV6DestOptionsHeader; -typedef struct IPV6HopByHopOptionsHeaderFormatTag -{ +typedef struct IPV6HopByHopOptionsHeaderFormatTag { UCHAR ucNextHeader; UCHAR ucMisc[3]; ULONG ulJumboPayloadLen; }IPV6HopByHopOptionsHeader; -typedef struct IPV6AuthenticationHeaderFormatTag -{ +typedef struct IPV6AuthenticationHeaderFormatTag { UCHAR ucNextHeader; UCHAR ucLength; USHORT usReserved; @@ -82,8 +76,7 @@ typedef struct IPV6AuthenticationHeaderFormatTag }IPV6AuthenticationHeader; -typedef struct IPV6IcmpHeaderFormatTag -{ +typedef struct IPV6IcmpHeaderFormatTag { UCHAR ucType; UCHAR ucCode; USHORT usChecksum; diff --git a/drivers/staging/bcm/InterfaceAdapter.h b/drivers/staging/bcm/InterfaceAdapter.h index f345f00..155da34 100644 --- a/drivers/staging/bcm/InterfaceAdapter.h +++ b/drivers/staging/bcm/InterfaceAdapter.h @@ -1,8 +1,7 @@ #ifndef _INTERFACE_ADAPTER_H #define _INTERFACE_ADAPTER_H -typedef struct _BULK_ENDP_IN -{ +typedef struct _BULK_ENDP_IN { PCHAR bulk_in_buffer; size_t bulk_in_size; UCHAR bulk_in_endpointAddr; @@ -10,8 +9,7 @@ typedef struct _BULK_ENDP_IN }BULK_ENDP_IN, *PBULK_ENDP_IN; -typedef struct _BULK_ENDP_OUT -{ +typedef struct _BULK_ENDP_OUT { UCHAR bulk_out_buffer; size_t bulk_out_size; UCHAR bulk_out_endpointAddr; @@ -20,8 +18,7 @@ typedef struct _BULK_ENDP_OUT UCHAR int_out_interval; }BULK_ENDP_OUT, *PBULK_ENDP_OUT; -typedef struct _INTR_ENDP_IN -{ +typedef struct _INTR_ENDP_IN { PCHAR int_in_buffer; size_t int_in_size; UCHAR int_in_endpointAddr; @@ -29,8 +26,7 @@ typedef struct _INTR_ENDP_IN UINT int_in_pipe; }INTR_ENDP_IN, *PINTR_ENDP_IN; -typedef struct _INTR_ENDP_OUT -{ +typedef struct _INTR_ENDP_OUT { PCHAR int_out_buffer; size_t int_out_size; UCHAR int_out_endpointAddr; @@ -39,16 +35,14 @@ typedef struct _INTR_ENDP_OUT }INTR_ENDP_OUT, *PINTR_ENDP_OUT; -typedef struct _USB_TCB -{ +typedef struct _USB_TCB { struct urb *urb; PVOID psIntfAdapter; BOOLEAN bUsed; }USB_TCB, *PUSB_TCB; -typedef struct _USB_RCB -{ +typedef struct _USB_RCB { struct urb *urb; PVOID psIntfAdapter; BOOLEAN bUsed; @@ -58,8 +52,7 @@ typedef struct _USB_RCB //This is the interface specific Sub-Adapter //Structure. */ -typedef struct _S_INTERFACE_ADAPTER -{ +typedef struct _S_INTERFACE_ADAPTER { struct usb_device * udev; struct usb_interface * interface; diff --git a/drivers/staging/bcm/InterfaceIdleMode.c b/drivers/staging/bcm/InterfaceIdleMode.c index e0452a2..0d54eaf 100644 --- a/drivers/staging/bcm/InterfaceIdleMode.c +++ b/drivers/staging/bcm/InterfaceIdleMode.c @@ -51,35 +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) { @@ -104,11 +98,8 @@ int InterfaceIdleModeRespond(PMINI_ADAPTER Adapter, unsigned int* puiBuffer) wake_up(&Adapter->lowpower_mode_wait_queue); - } - else - { - if(TRUE == Adapter->IdleMode) - { + } else { + if(TRUE == Adapter->IdleMode) { bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "Device is already in Idle mode....\n"); return status ; @@ -121,8 +112,7 @@ int InterfaceIdleModeRespond(PMINI_ADAPTER Adapter, unsigned int* puiBuffer) if (Adapter->chip_id== BCS220_2 || Adapter->chip_id == BCS220_2BC || Adapter->chip_id== BCS250_BC || - Adapter->chip_id== BCS220_3) - { + Adapter->chip_id== BCS220_3) { bytes = rdmalt(Adapter, HPM_CONFIG_MSW, &uiRegRead, sizeof(uiRegRead)); if (bytes < 0) { @@ -136,8 +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; } @@ -145,9 +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); @@ -167,8 +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", @@ -178,34 +164,28 @@ static int InterfaceAbortIdlemode(PMINI_ADAPTER Adapter, unsigned int Pattern) if((Adapter->ulPowerSaveMode == DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) || - (Adapter->ulPowerSaveMode == DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE)) - { + (Adapter->ulPowerSaveMode == DEVICE_POWERSAVE_MODE_AS_PROTOCOL_IDLE_MODE)) { //write the SW abort pattern. bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "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. @@ -218,15 +198,12 @@ 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); return status; - } - else - { + } else { bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "NOB Sent down :%d\n", lenwritten); } @@ -234,32 +211,26 @@ 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) 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 - { + } else { bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "Number of completed iteration to read chip-id :%lu\n", itr); } 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; } @@ -269,13 +240,10 @@ 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 - { + } else { bcm_dbg(Adapter, OTHERS, IDLE_MODE, ALL, "Writing Low Power Mode Abort pattern to the Device\n"); Adapter->bTriedToWakeUpFromlowPowerMode = TRUE; @@ -291,21 +259,18 @@ 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; } } - else - { + else { //clear Interrupt EP registers. bytes = rdmalt(Adapter,DEVICE_INT_OUT_EP_REG0, &uiRegVal, sizeof(uiRegVal)); diff --git a/drivers/staging/bcm/InterfaceIsr.c b/drivers/staging/bcm/InterfaceIsr.c index d22581b..1842d3a 100644 --- a/drivers/staging/bcm/InterfaceIsr.c +++ b/drivers/staging/bcm/InterfaceIsr.c @@ -11,8 +11,7 @@ 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 ; @@ -20,8 +19,7 @@ static void read_int_callback(struct urb *urb/*, struct pt_regs *regs*/) if(((Adapter->bPreparingForLowPowerMode == TRUE) && (Adapter->bDoSuspend == TRUE)) || psIntfAdapter->bSuspended || - psIntfAdapter->bPreparingForBusSuspend) - { + psIntfAdapter->bPreparingForBusSuspend) { bcm_dbg(Adapter, OTHERS, INTF_INIT, ALL, "Interrupt call back is called while suspending the device\n"); return ; @@ -32,17 +30,14 @@ static void read_int_callback(struct urb *urb/*, struct pt_regs *regs*/) switch (status) { /* success */ case STATUS_SUCCESS: - if ( urb->actual_length ) - { + 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); @@ -50,8 +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, @@ -61,18 +55,15 @@ static void read_int_callback(struct urb *urb/*, struct pt_regs *regs*/) } if(Adapter->fw_download_done && !Adapter->downloadDDR && - atomic_read(&Adapter->CurrNumFreeTxDesc)) - { + 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); } @@ -130,8 +121,7 @@ static void read_int_callback(struct urb *urb/*, struct pt_regs *regs*/) int CreateInterruptUrb(PS_INTERFACE_ADAPTER psIntfAdapter) { psIntfAdapter->psInterruptUrb = usb_alloc_urb(0, GFP_KERNEL); - if (!psIntfAdapter->psInterruptUrb) - { + if (!psIntfAdapter->psInterruptUrb) { bcm_dbg(psIntfAdapter->psAdapter, OTHERS, INTF_INIT, ALL, "Cannot allocate interrupt urb\n"); return -ENOMEM; @@ -166,16 +156,13 @@ INT StartInterruptUrb(PS_INTERFACE_ADAPTER psIntfAdapter) FALSE == psIntfAdapter->psAdapter->bEndPointHalted && FALSE == psIntfAdapter->bSuspended && FALSE == psIntfAdapter->bPreparingForBusSuspend && - FALSE == psIntfAdapter->psAdapter->StopAllXaction) - { + FALSE == psIntfAdapter->psAdapter->StopAllXaction) { status = usb_submit_urb(psIntfAdapter->psInterruptUrb, GFP_ATOMIC); - if (status) - { + if (status) { 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 f051e76..31e50ee 100644 --- a/drivers/staging/bcm/InterfaceRx.c +++ b/drivers/staging/bcm/InterfaceRx.c @@ -19,8 +19,7 @@ GetBulkInRcb(PS_INTERFACE_ADAPTER psIntfAdapter) UINT index = 0; if((atomic_read(&psIntfAdapter->uNumRcbUsed) < MAXIMUM_USB_RCB) && - (psIntfAdapter->psAdapter->StopAllXaction == FALSE)) - { + (psIntfAdapter->psAdapter->StopAllXaction == FALSE)) { index = atomic_read(&psIntfAdapter->uCurrRcb); pRcb = &psIntfAdapter->asUsbRcb[index]; pRcb->bUsed = TRUE; @@ -56,22 +55,17 @@ static void read_bulk_callback(struct urb *urb) if((Adapter->device_removed == TRUE) || (TRUE == Adapter->bEndPointHalted) || (0 == urb->actual_length) - ) - { + ) { pRcb->bUsed = FALSE; atomic_dec(&psIntfAdapter->uNumRcbUsed); 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 - { + } else { bcm_dbg(Adapter, RX, RX_DPC, ALL, "Rx URB has got cancelled. status :%d\n", urb->status); @@ -82,8 +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 ; @@ -91,8 +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; @@ -100,8 +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); @@ -111,8 +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 = @@ -120,16 +110,14 @@ 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) || - (!(pLeader->Status >= 0x20 && pLeader->Status <= 0x3F))) - { + (!(pLeader->Status >= 0x20 && pLeader->Status <= 0x3F))) { bcm_dbg(psIntfAdapter->psAdapter, RX, RX_CTRL, ALL, "Received control pkt...\n"); *(PUSHORT)skb->data = pLeader->Status; @@ -143,9 +131,7 @@ static void read_bulk_callback(struct urb *urb) atomic_inc(&Adapter->cntrlpktCnt); wake_up(&Adapter->process_rx_cntrlpkt); - } - else - { + } else { /* * Data Packet, Format a proper Ethernet Header * and give it to the stack @@ -163,15 +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); @@ -184,9 +168,7 @@ static void read_bulk_callback(struct urb *urb) skb->protocol = eth_type_trans(skb, Adapter->dev); process_done = netif_rx(skb); - } - else - { + } else { bcm_dbg(psIntfAdapter->psAdapter, RX, RX_DATA, ALL, "i/f not up hance freeing SKB...\n"); dev_kfree_skb(skb); @@ -195,8 +177,7 @@ 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++) - { + 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]++; @@ -219,17 +200,14 @@ static int ReceiveRcb(PS_INTERFACE_ADAPTER psIntfAdapter, PUSB_RCB pRcb) if(FALSE == psIntfAdapter->psAdapter->device_removed && FALSE == psIntfAdapter->psAdapter->bEndPointHalted && FALSE == psIntfAdapter->bSuspended && - FALSE == psIntfAdapter->bPreparingForBusSuspend) - { + FALSE == psIntfAdapter->bPreparingForBusSuspend) { retval = usb_submit_urb(urb, GFP_ATOMIC); - if (retval) - { + if (retval) { bcm_dbg(psIntfAdapter->psAdapter, RX, RX_DPC, ALL, "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); } @@ -260,11 +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 2065ac0..a4fed36 100644 --- a/drivers/staging/bcm/InterfaceTx.c +++ b/drivers/staging/bcm/InterfaceTx.c @@ -13,15 +13,11 @@ 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 - { + } else { bcm_dbg(Adapter, TX, NEXT_SEND, ALL, "Tx URB has got cancelled. status :%d\n", urb->status); @@ -33,8 +29,7 @@ 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) && (pControlMsg->szData[1] == TARGET_CAN_GO_TO_IDLE_MODE))) @@ -42,8 +37,7 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/) { 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"); @@ -53,8 +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 ; @@ -65,15 +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)) - { + (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"); @@ -84,8 +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 ; @@ -96,8 +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"); @@ -120,8 +108,7 @@ static PUSB_TCB GetBulkOutTcb(PS_INTERFACE_ADAPTER psIntfAdapter) UINT index = 0; if((atomic_read(&psIntfAdapter->uNumTcbUsed) < MAXIMUM_USB_TCB) && - (psIntfAdapter->psAdapter->StopAllXaction ==FALSE)) - { + (psIntfAdapter->psAdapter->StopAllXaction ==FALSE)) { index = atomic_read(&psIntfAdapter->uCurrTcb); pTcb = &psIntfAdapter->asUsbTcb[index]; pTcb->bUsed = TRUE; @@ -144,8 +131,7 @@ static int TransmitTcb(PS_INTERFACE_ADAPTER psIntfAdapter, PUSB_TCB pTcb, PVOID urb->transfer_buffer = usb_alloc_coherent(psIntfAdapter->udev, len, GFP_ATOMIC, &urb->transfer_dma); - if (!urb->transfer_buffer) - { + if (!urb->transfer_buffer) { pr_info("Error allocating memory\n"); return -ENOMEM; } @@ -155,15 +141,12 @@ 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, psIntfAdapter->sBulkOut.int_out_interval); - } - else - { + } else { usb_fill_bulk_urb(urb, psIntfAdapter->udev, psIntfAdapter->sBulkOut.bulk_out_pipe, urb->transfer_buffer, len, write_bulk_callback, pTcb); @@ -173,16 +156,13 @@ static int TransmitTcb(PS_INTERFACE_ADAPTER psIntfAdapter, PUSB_TCB pTcb, PVOID if(FALSE == psIntfAdapter->psAdapter->device_removed && FALSE == psIntfAdapter->psAdapter->bEndPointHalted && FALSE == psIntfAdapter->bSuspended && - FALSE == psIntfAdapter->bPreparingForBusSuspend) - { + FALSE == psIntfAdapter->bPreparingForBusSuspend) { retval = usb_submit_urb(urb, GFP_ATOMIC); - if (retval) - { + if (retval) { 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); } @@ -197,8 +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/Ioctl.h b/drivers/staging/bcm/Ioctl.h index 60f568e..5b728d7 100644 --- a/drivers/staging/bcm/Ioctl.h +++ b/drivers/staging/bcm/Ioctl.h @@ -1,36 +1,32 @@ #ifndef _IOCTL_H_ #define _IOCTL_H_ -typedef struct rdmbuffer -{ +typedef struct rdmbuffer { ULONG Register; ULONG Length; }__attribute__((packed)) RDM_BUFFER, *PRDM_BUFFER; -typedef struct wrmbuffer -{ +typedef struct wrmbuffer { ULONG Register; ULONG Length; UCHAR Data[4]; }__attribute__((packed)) WRM_BUFFER, *PWRM_BUFFER; -typedef struct ioctlbuffer -{ +typedef struct ioctlbuffer { void __user *InputBuffer; ULONG InputLength; void __user *OutputBuffer; ULONG OutputLength; }__attribute__((packed)) IOCTL_BUFFER, *PIOCTL_BUFFER; -typedef struct stGPIOInfo -{ +typedef struct stGPIOInfo { UINT uiGpioNumber ; /* valid numbers 0-15 */ UINT uiGpioValue; /* 1 set ; 0 not set */ }__attribute__((packed))GPIO_INFO,*PGPIO_INFO; -typedef struct stUserThreadReq -{ + +typedef struct stUserThreadReq { //0->Inactivate LED thread. //1->Activate the LED thread UINT ThreadState; @@ -196,8 +192,7 @@ typedef enum _BCM_INTERFACE_TYPE BCM_PCMCIA }BCM_INTERFACE_TYPE; -typedef struct _DEVICE_DRIVER_INFO -{ +typedef struct _DEVICE_DRIVER_INFO { NVM_TYPE u32NVMType; UINT MaxRDMBufferSize; BCM_INTERFACE_TYPE u32InterfaceType; @@ -206,8 +201,7 @@ typedef struct _DEVICE_DRIVER_INFO UINT u32Reserved[10]; } DEVICE_DRIVER_INFO; -typedef struct _NVM_READWRITE -{ +typedef struct _NVM_READWRITE { void __user *pBuffer; // Data to be written from|read to. Memory should be allocated by the caller. @@ -222,8 +216,8 @@ typedef struct _NVM_READWRITE // Applicable only for write. If set verification of written data will be done. } NVM_READWRITE,*PNVM_READWRITE; -typedef struct bulkwrmbuffer -{ + +typedef struct bulkwrmbuffer { ULONG Register; ULONG SwapEndian; ULONG Values[1]; @@ -262,8 +256,7 @@ typedef enum _FLASH2X_SECTION_VAL /* * Structure used for READ/WRITE Flash Map2.x */ -typedef struct _FLASH2X_READWRITE -{ +typedef struct _FLASH2X_READWRITE { FLASH2X_SECTION_VAL Section; //which section has to be read/written B_UINT32 offset; //Offset within Section. @@ -279,8 +272,7 @@ typedef struct _FLASH2X_READWRITE * if NOB !=0, only NOB will be copied from the given offset. */ -typedef struct _FLASH2X_COPY_SECTION -{ +typedef struct _FLASH2X_COPY_SECTION { //Src Section from which Data has to be copied to DstSection FLASH2X_SECTION_VAL SrcSection; @@ -313,8 +305,7 @@ typedef enum _SECTION_TYPE * Bit [7...3] = Reserved */ -typedef struct _FLASH2X_BITMAP -{ +typedef struct _FLASH2X_BITMAP { UCHAR ISO_IMAGE1; UCHAR ISO_IMAGE2; UCHAR DSD0; @@ -332,8 +323,7 @@ typedef struct _FLASH2X_BITMAP }FLASH2X_BITMAP, *PFLASH2X_BITMAP; //for net entry time check -typedef struct _ST_TIME_ELAPSED_ -{ +typedef struct _ST_TIME_ELAPSED_ { ULONG64 ul64TimeElapsedSinceNetEntry; UINT32 uiReserved[4]; //By chance if required for future proofing }ST_TIME_ELAPSED,*PST_TIME_ELAPSED; @@ -343,15 +333,14 @@ enum { HOST_IDX, /*To access Host chip GPIO's for GPIO_MULTI_INFO or GPIO_MULTI_MODE*/ MAX_IDX }; -typedef struct stGPIOMultiInfo -{ + +typedef struct stGPIOMultiInfo { UINT uiGPIOCommand; /* 1 for set and 0 for get*/ UINT uiGPIOMask; /* set the correspondig bit to 1 to access GPIO*/ UINT uiGPIOValue; /* 0 or 1; value to be set when command is 1.*/ }__attribute__((packed))GPIO_MULTI_INFO , *PGPIO_MULTI_INFO; -typedef struct stGPIOMultiMode -{ +typedef struct stGPIOMultiMode { UINT uiGPIOMode; /* 1 for OUT mode, 0 for IN mode*/ UINT uiGPIOMask; /* GPIO mask to set mode*/ }__attribute__((packed))GPIO_MULTI_MODE, *PGPIO_MULTI_MODE; diff --git a/drivers/staging/bcm/LeakyBucket.c b/drivers/staging/bcm/LeakyBucket.c index e77ba7e0..db796a3 100644 --- a/drivers/staging/bcm/LeakyBucket.c +++ b/drivers/staging/bcm/LeakyBucket.c @@ -22,25 +22,21 @@ 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++) - { + for(i = 0; i < NO_OF_QUEUES; i++) { if(TRUE == Adapter->PackInfo[i].bValid && - (1 == Adapter->PackInfo[i].ucDirection)) - { + (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); @@ -48,8 +44,7 @@ static VOID UpdateTokenCount(register PMINI_ADAPTER Adapter) &tv, sizeof(struct timeval)); Adapter->PackInfo[i].liLastUpdateTokenAt = liCurrentTime; if((Adapter->PackInfo[i].uiCurrentTokenCount) >= - Adapter->PackInfo[i].uiMaxBucketSize) - { + Adapter->PackInfo[i].uiMaxBucketSize) { Adapter->PackInfo[i].uiCurrentTokenCount = Adapter->PackInfo[i].uiMaxBucketSize; } @@ -82,30 +77,23 @@ static ULONG GetSFTokenCount(PMINI_ADAPTER Adapter, PacketInfo *psSF) "IsPacketAllowedForFlow ===>\n"); /* Validate the parameters */ if(NULL == Adapter || (psSF < Adapter->PackInfo && - (uintptr_t)psSF > (uintptr_t) &Adapter->PackInfo[HiPriority])) - { + (uintptr_t)psSF > (uintptr_t) &Adapter->PackInfo[HiPriority])) { bcm_dbg(Adapter, TX, TOKEN_COUNTS, ALL, "IPAFF: Got wrong Parameters:Adapter: %p, QIndex: %zd\n", Adapter, (psSF-Adapter->PackInfo)); 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 - { + } else { bcm_dbg(Adapter, TX, TOKEN_COUNTS, ALL, "Not enough tokens in queue %zd Available %u\n", psSF-Adapter->PackInfo, psSF->uiCurrentTokenCount); psSF->uiPendedLast = 1; } - } - else - { + } else { bcm_dbg(Adapter, TX, TOKEN_COUNTS, ALL, "IPAFF: Queue %zd not valid\n", psSF-Adapter->PackInfo); } @@ -127,22 +115,19 @@ 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) - { + 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]++; @@ -184,8 +169,7 @@ static VOID CheckAndSendPacketFromIndex(PMINI_ADAPTER Adapter, PacketInfo *psSF) 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)); @@ -195,8 +179,7 @@ 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"); @@ -206,8 +189,7 @@ static VOID CheckAndSendPacketFromIndex(PMINI_ADAPTER Adapter, PacketInfo *psSF) 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,9 +202,7 @@ static VOID CheckAndSendPacketFromIndex(PMINI_ADAPTER Adapter, PacketInfo *psSF) Status = SendPacketFromQueue(Adapter, psSF, QueuePacket); psSF->uiPendedLast = FALSE; - } - else - { + } else { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "For Queue: %zd\n", psSF-Adapter->PackInfo); @@ -235,29 +215,22 @@ static VOID CheckAndSendPacketFromIndex(PMINI_ADAPTER Adapter, PacketInfo *psSF) psSF->uiPendedLast = TRUE; spin_unlock_bh(&psSF->SFQueueLock); } - } - else - { + } else { spin_unlock_bh(&psSF->SFQueueLock); } - } - else - { + } else { 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; @@ -267,13 +240,10 @@ static VOID CheckAndSendPacketFromIndex(PMINI_ADAPTER Adapter, PacketInfo *psSF) psSF->uiCurrentPacketsOnHost--; atomic_inc(&Adapter->index_rd_txcntrlpkt); spin_unlock_bh(&psSF->SFQueueLock); - } - else + } else bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "SendControlPacket Failed\n"); - } - else - { + } else { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "Control Pkt is not available, Indexing is wrong....\n"); } @@ -301,13 +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; } @@ -322,15 +290,13 @@ VOID transmit_packets(PMINI_ADAPTER Adapter) uiPrevTotalCount = atomic_read(&Adapter->TotalPacketCount); - for(iIndex=HiPriority;iIndex>=0;iIndex--) - { + for(iIndex=HiPriority;iIndex>=0;iIndex--) { if( !uiPrevTotalCount || (TRUE == Adapter->device_removed)) break; if(Adapter->PackInfo[iIndex].bValid && Adapter->PackInfo[iIndex].uiPendedLast && - Adapter->PackInfo[iIndex].uiCurrentBytesOnHost) - { + Adapter->PackInfo[iIndex].uiCurrentBytesOnHost) { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "Calling CheckAndSendPacketFromIndex..\n"); CheckAndSendPacketFromIndex(Adapter, &Adapter->PackInfo[iIndex]); @@ -338,19 +304,16 @@ 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--) - { + for(iIndex=HiPriority;iIndex>=0;iIndex--) { if( !uiPrevTotalCount || (TRUE == Adapter->device_removed)) break; if(Adapter->PackInfo[iIndex].bValid && Adapter->PackInfo[iIndex].uiCurrentBytesOnHost && - !Adapter->PackInfo[iIndex].uiPendedLast ) - { + !Adapter->PackInfo[iIndex].uiPendedLast ) { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "Calling CheckAndSendPacketFromIndex..\n"); CheckAndSendPacketFromIndex(Adapter, &Adapter->PackInfo[iIndex]); @@ -359,8 +322,7 @@ 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; diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c index 36929e6..cbd46a4 100644 --- a/drivers/staging/bcm/Misc.c +++ b/drivers/staging/bcm/Misc.c @@ -603,8 +603,7 @@ VOID LinkControlResponseMessage(PMINI_ADAPTER Adapter, PUCHAR pucBuffer) break; case LINK_SHUTDOWN_REQ_FROM_FIRMWARE: - case COMPLETE_WAKE_UP_NOTIFICATION_FRM_FW: - { + case COMPLETE_WAKE_UP_NOTIFICATION_FRM_FW: { HandleShutDownModeRequest(Adapter, pucBuffer); } break; diff --git a/drivers/staging/bcm/PHSDefines.h b/drivers/staging/bcm/PHSDefines.h index a32ff41..93a6eee 100644 --- a/drivers/staging/bcm/PHSDefines.h +++ b/drivers/staging/bcm/PHSDefines.h @@ -44,8 +44,7 @@ #define ERR_CLSID_MATCH_FAIL 0x808 #define ERR_PHSRULE_MATCH_FAIL 0x809 -typedef struct _S_PHS_RULE -{ +typedef struct _S_PHS_RULE { /// brief 8bit PHSI Of The Service Flow B_UINT8 u8PHSI; /// brief PHSF Of The Service Flow @@ -77,8 +76,7 @@ typedef enum _E_CLASSIFIER_ENTRY_CONTEXT eOldClassifierRuleContext }E_CLASSIFIER_ENTRY_CONTEXT; -typedef struct _S_CLASSIFIER_ENTRY -{ +typedef struct _S_CLASSIFIER_ENTRY { B_UINT8 bUsed; B_UINT16 uiClassifierRuleId; B_UINT8 u8PHSI; @@ -88,8 +86,7 @@ typedef struct _S_CLASSIFIER_ENTRY }S_CLASSIFIER_ENTRY; -typedef struct _S_CLASSIFIER_TABLE -{ +typedef struct _S_CLASSIFIER_TABLE { B_UINT16 uiTotalClassifiers; S_CLASSIFIER_ENTRY stActivePhsRulesList[MAX_PHSRULE_PER_SF]; S_CLASSIFIER_ENTRY stOldPhsRulesList[MAX_PHSRULE_PER_SF]; @@ -98,23 +95,20 @@ typedef struct _S_CLASSIFIER_TABLE }S_CLASSIFIER_TABLE; -typedef struct _S_SERVICEFLOW_ENTRY -{ +typedef struct _S_SERVICEFLOW_ENTRY { B_UINT8 bUsed; B_UINT16 uiVcid; S_CLASSIFIER_TABLE *pstClassifierTable; }S_SERVICEFLOW_ENTRY; -typedef struct _S_SERVICEFLOW_TABLE -{ +typedef struct _S_SERVICEFLOW_TABLE { B_UINT16 uiTotalServiceFlows; S_SERVICEFLOW_ENTRY stSFList[MAX_SERVICEFLOWS]; }S_SERVICEFLOW_TABLE; -typedef struct _PHS_DEVICE_EXTENSION -{ +typedef struct _PHS_DEVICE_EXTENSION { /* PHS Specific data*/ S_SERVICEFLOW_TABLE *pstServiceFlowPhsRulesTable; void *CompressedTxBuffer; diff --git a/drivers/staging/bcm/PHSModule.c b/drivers/staging/bcm/PHSModule.c index dd6ad51..92c40b8 100644 --- a/drivers/staging/bcm/PHSModule.c +++ b/drivers/staging/bcm/PHSModule.c @@ -110,27 +110,22 @@ 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 - { + } else { unPHSPktHdrBytesCopied = MAX_PHS_LENGTHS; } if( (unPHSPktHdrBytesCopied > 0 ) && - (unPHSPktHdrBytesCopied <= MAX_PHS_LENGTHS)) - { + (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) || (usPacketType == ETHERNET_FRAMETYPE_IPV6)) && - (bHeaderSuppressionEnabled)) - { + (bHeaderSuppressionEnabled)) { bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, "Trying to PHS Compress Using Classifier rule 0x%X\n", uiClassifierRuleID); @@ -148,20 +143,17 @@ int PHSTransmit(PMINI_ADAPTER Adapter, "PHS Old header Size : %d New Header Size %d\n", unPhsOldHdrSize, unPHSNewPktHeaderLen); - if(unPHSNewPktHeaderLen == unPhsOldHdrSize) - { + 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) @@ -181,13 +173,10 @@ int PHSTransmit(PMINI_ADAPTER Adapter, return STATUS_SUCCESS; } - else - { + 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; } @@ -198,11 +187,8 @@ int PHSTransmit(PMINI_ADAPTER Adapter, *(Packet->data + BytesToRemove) = bPHSI; return STATUS_SUCCESS; } - } - else - { - if(!bHeaderSuppressionEnabled) - { + } else { + if(!bHeaderSuppressionEnabled) { bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, "Header Suppression Disabled For SF: No PHS\n"); } @@ -227,8 +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; @@ -249,22 +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 - { + } else { TotalBytesAdded = nStandardPktHdrLen - nTotalsupressedPktHdrBytes - PHSI_LEN; - if(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)) - { + else { + if(skb_cow(packet, skb_headroom(packet) + TotalBytesAdded)) { pr_info("cow failed in receive\n"); return STATUS_FAILURE; } @@ -311,20 +290,17 @@ int phs_init(PPHS_DEVICE_EXTENSION pPhsdeviceExtension,PMINI_ADAPTER Adapter) 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-> @@ -336,8 +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); @@ -346,8 +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); @@ -365,8 +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; } @@ -419,16 +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; } @@ -437,8 +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); @@ -483,27 +453,22 @@ 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) { + 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--; @@ -546,13 +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; @@ -560,10 +523,8 @@ 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((nClsidIndex != PHS_INVALID_TABLE_INDEX) && (!pstClassifierEntry->bUnclassifiedPHSRule)) { + if(pstClassifierEntry->pstPhsRule) { if(pstClassifierEntry->pstPhsRule->u8RefCnt) pstClassifierEntry->pstPhsRule->u8RefCnt--; if(0==pstClassifierEntry->pstPhsRule->u8RefCnt) @@ -576,8 +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)); } @@ -612,25 +572,20 @@ 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) { + for(nClsidIndex=0;nClsidIndex<MAX_PHSRULE_PER_SF;nClsidIndex++) { + if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex].pstPhsRule) { if(pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] .pstPhsRule->u8RefCnt) pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex] @@ -642,8 +597,7 @@ ULONG PhsDeleteSFRules(IN void* pvContext,IN B_UINT16 uiVcid) .pstPhsRule = NULL; } memset(&pstClassifierRulesTable->stActivePhsRulesList[nClsidIndex], 0, sizeof(S_CLASSIFIER_ENTRY)); - if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule) - { + if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex].pstPhsRule) { if(pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] .pstPhsRule->u8RefCnt) pstClassifierRulesTable->stOldPhsRulesList[nClsidIndex] @@ -708,8 +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 ; @@ -723,8 +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; @@ -733,8 +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 ; @@ -745,8 +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 ; @@ -757,12 +707,10 @@ 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 + } else pstPhsRule->PHSErrorNumPackets++; return lStatus; @@ -804,8 +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; @@ -816,16 +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; @@ -833,13 +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; } @@ -873,21 +816,16 @@ 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) { + for(j=0;j<MAX_PHSRULE_PER_SF;j++) { + if(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule) { if(pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule ->u8RefCnt) pstClassifierRulesTable->stActivePhsRulesList[j].pstPhsRule @@ -897,8 +835,7 @@ static void free_phs_serviceflow_rules(S_SERVICEFLOW_TABLE *psServiceFlowRulesTa 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 ->u8RefCnt) pstClassifierRulesTable->stOldPhsRulesList[j].pstPhsRule @@ -923,16 +860,13 @@ 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; } @@ -943,9 +877,7 @@ static BOOLEAN ValidatePHSRuleComplete(IN S_PHS_RULE *psPhsRule) return FALSE; } return TRUE; - } - else - { + } else { return FALSE; } } @@ -954,12 +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; } @@ -977,22 +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 - { + } else { psClassifierRules = &pstClassifierTable->stOldPhsRulesList[i]; } - if(psClassifierRules->bUsed) - { - if(psClassifierRules->uiClassifierRuleId == uiClsid) - { + if(psClassifierRules->bUsed) { + if(psClassifierRules->uiClassifierRuleId == uiClsid) { *ppstClassifierEntry = psClassifierRules; return i; } @@ -1010,20 +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 - { + } else { pstClassifierRule = &pstClassifierTable->stOldPhsRulesList[i]; } - if(pstClassifierRule->bUsed) - { - if(pstClassifierRule->u8PHSI == uiPHSI) - { + if(pstClassifierRule->bUsed) { + if(pstClassifierRule->u8PHSI == uiPHSI) { *ppstPhsRule = pstClassifierRule->pstPhsRule; return i; } @@ -1045,10 +962,8 @@ 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; } @@ -1061,8 +976,7 @@ UINT CreateSFToClassifierRuleMapping(IN B_UINT16 uiVcid,IN B_UINT16 uiClsId, 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; @@ -1089,8 +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 @@ -1105,8 +1018,7 @@ 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->u8PHSI == psPhsRule->u8PHSI) { if(pstClassifierEntry->pstPhsRule == NULL) return ERR_PHS_INVALID_PHS_RULE; @@ -1115,32 +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; } @@ -1148,9 +1055,7 @@ UINT CreateClassiferToPHSRuleMapping(IN B_UINT16 uiVcid, //update PHSV pstClassifierEntry->pstPhsRule->u8PHSV = psPhsRule->u8PHSV; - } - else - { + } else { /* A new rule is being set for this classifier. */ @@ -1174,21 +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. @@ -1197,45 +1099,34 @@ 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 < - MAX_PHSRULE_PER_SF; iClassifierIndex++) - { - if(eClsContext == eActiveClassifierRuleContext) - { + MAX_PHSRULE_PER_SF; iClassifierIndex++) { + if(eClsContext == eActiveClassifierRuleContext) { psClassifierRules = &psaClassifiertable->stActivePhsRulesList[iClassifierIndex]; - } - else - { + } else { psClassifierRules = &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 - { + } else { //Lets replace the oldest rule if we are looking in old Rule table if(psaClassifiertable->uiOldestPhsRuleIndex >= - MAX_PHSRULE_PER_SF) - { + MAX_PHSRULE_PER_SF) { psaClassifiertable->uiOldestPhsRuleIndex =0; } @@ -1247,10 +1138,8 @@ 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) @@ -1265,9 +1154,7 @@ static UINT CreateClassifierPHSRule(IN B_UINT16 uiClsId, /* Update The PHS rule */ memcpy(psClassifierRules->pstPhsRule, psPhsRule, sizeof(S_PHS_RULE)); - } - else - { + } else { nStatus = UpdateClassifierPHSRule(uiClsId,psClassifierRules, psaClassifiertable,psPhsRule,u8AssociatedPHSI); } @@ -1293,36 +1180,29 @@ 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; } } memcpy(pstClassifierEntry->pstPhsRule, psPhsRule, sizeof(S_PHS_RULE)); - } - else - { + } else { //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; } @@ -1345,15 +1225,12 @@ static BOOLEAN DerefPhsRule(IN B_UINT16 uiClsId,S_CLASSIFIER_TABLE *psaClassifi return FALSE; if(pstPhsRule->u8RefCnt) pstPhsRule->u8RefCnt--; - if(0==pstPhsRule->u8RefCnt) - { + 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; - } - else - { + } else { return FALSE; } } @@ -1363,33 +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) bcm_dbg(Adapter, OTHERS, DUMP_INFO, ALL, "Active PHS Rule :\n"); - } - else - { + } else { stClsEntry = stServFlowEntry.pstClassifierTable->stOldPhsRulesList[j]; 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", @@ -1410,8 +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]); @@ -1421,8 +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]); @@ -1489,19 +1356,15 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, 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", phss, *phsf, *out_buf); - } - else - { + } else { *out_buf = *in_buf; bcm_dbg(Adapter, OTHERS, PHS_RECEIVE, ALL, "DECOMP:In phss %d input %d ouput %d\n", @@ -1515,8 +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++; } @@ -1553,8 +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; @@ -1562,12 +1423,9 @@ 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 - { + } else { *header_size = *new_header_size; } //To copy PHSI @@ -1575,14 +1433,11 @@ 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); - } - else - { + } else { *old_addr = ZERO_PHSI; bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, "COMP:In phs_compress PHSV Verification failed\n"); @@ -1622,33 +1477,25 @@ 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); return STATUS_PHS_NOCOMPRESSION; } - } - else + } else bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, "COMP:In verify_phsf success for field %d buf %d phsf %d\n", phss, *in_buffer, *phsf); - } - else - { + } else { *out_buffer = *in_buffer; bcm_dbg(Adapter, OTHERS, PHS_SEND, ALL, "COMP:In copying_header input %d out %d\n", @@ -1660,8 +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/Protocol.h b/drivers/staging/bcm/Protocol.h index 879d3e6..82ab2cb 100644 --- a/drivers/staging/bcm/Protocol.h +++ b/drivers/staging/bcm/Protocol.h @@ -20,8 +20,7 @@ struct ArpHeader { struct TransportHeaderT { - union - { + union { struct udphdr uhdr; struct tcphdr thdr; }; @@ -29,8 +28,7 @@ struct TransportHeaderT typedef struct TransportHeaderT xporthdr; -typedef enum _E_NWPKT_IPFRAME_TYPE -{ +typedef enum _E_NWPKT_IPFRAME_TYPE { eNonIPPacket, eIPv4Packet, eIPv6Packet @@ -45,16 +43,14 @@ typedef enum _E_NWPKT_ETHFRAME_TYPE eEthOtherFrame } E_NWPKT_ETHFRAME_TYPE; -typedef struct _S_ETHCS_PKT_INFO -{ +typedef struct _S_ETHCS_PKT_INFO { E_NWPKT_IPFRAME_TYPE eNwpktIPFrameType; E_NWPKT_ETHFRAME_TYPE eNwpktEthFrameType; USHORT usEtherType; UCHAR ucDSAP; }S_ETHCS_PKT_INFO,*PS_ETHCS_PKT_INFO; -typedef struct _ETH_CS_802_Q_FRAME -{ +typedef struct _ETH_CS_802_Q_FRAME { ETH_HEADER_STRUC EThHdr; USHORT UserPriority:3; USHORT CFI:1; @@ -62,16 +58,14 @@ typedef struct _ETH_CS_802_Q_FRAME USHORT EthType; } __attribute__((packed)) ETH_CS_802_Q_FRAME; -typedef struct _ETH_CS_802_LLC_FRAME -{ +typedef struct _ETH_CS_802_LLC_FRAME { ETH_HEADER_STRUC EThHdr; unsigned char DSAP; unsigned char SSAP; unsigned char Control; }__attribute__((packed)) ETH_CS_802_LLC_FRAME; -typedef struct _ETH_CS_802_LLC_SNAP_FRAME -{ +typedef struct _ETH_CS_802_LLC_SNAP_FRAME { ETH_HEADER_STRUC EThHdr; unsigned char DSAP; unsigned char SSAP; @@ -80,8 +74,7 @@ typedef struct _ETH_CS_802_LLC_SNAP_FRAME unsigned short usEtherType; } __attribute__((packed)) ETH_CS_802_LLC_SNAP_FRAME; -typedef struct _ETH_CS_ETH2_FRAME -{ +typedef struct _ETH_CS_ETH2_FRAME { ETH_HEADER_STRUC EThHdr; } __attribute__((packed)) ETH_CS_ETH2_FRAME; @@ -131,8 +124,7 @@ typedef enum _E_SERVICEFLOW_CS_SPEC_ #define ARP_PKT_SIZE 60 // This is the format for the TCP packet header -typedef struct _TCP_HEADER -{ +typedef struct _TCP_HEADER { USHORT usSrcPort; USHORT usDestPort; ULONG ulSeqNumber; diff --git a/drivers/staging/bcm/Qos.c b/drivers/staging/bcm/Qos.c index 322d3c9..999c0e4 100644 --- a/drivers/staging/bcm/Qos.c +++ b/drivers/staging/bcm/Qos.c @@ -33,16 +33,14 @@ BOOLEAN MatchSrcIpAddress(S_CLASSIFIER_RULE *pstClassifierRule,ULONG ulSrcIP) ulSrcIP=ntohl(ulSrcIP); 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)== - (pstClassifierRule->stSrcIpAddress.ulIpv4Addr[ucLoopIndex] & pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex] )) - { + (pstClassifierRule->stSrcIpAddress.ulIpv4Addr[ucLoopIndex] & pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex] )) { return TRUE; } } @@ -76,11 +74,9 @@ 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++) - { + for(ucLoopIndex=0;ucLoopIndex<(pstClassifierRule->ucIPDestinationAddressLength);ucLoopIndex++) { if((pstClassifierRule->stDestIpAddress.ulIpv4Mask[ucLoopIndex] & ulDestIP)== - (pstClassifierRule->stDestIpAddress.ulIpv4Addr[ucLoopIndex] & pstClassifierRule->stDestIpAddress.ulIpv4Mask[ucLoopIndex])) - { + (pstClassifierRule->stDestIpAddress.ulIpv4Addr[ucLoopIndex] & pstClassifierRule->stDestIpAddress.ulIpv4Mask[ucLoopIndex])) { return TRUE; } } @@ -107,8 +103,7 @@ BOOLEAN MatchTos(S_CLASSIFIER_RULE *pstClassifierRule,UCHAR ucTypeOfService) 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"); @@ -132,13 +127,11 @@ BOOLEAN MatchProtocol(S_CLASSIFIER_RULE *pstClassifierRule,UCHAR ucProtocol) PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); 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; } } @@ -166,11 +159,9 @@ BOOLEAN MatchSrcPort(S_CLASSIFIER_RULE *pstClassifierRule,USHORT ushSrcPort) if(0 == pstClassifierRule->ucSrcPortRangeLength) return TRUE; - for(ucLoopIndex=0;ucLoopIndex<pstClassifierRule->ucSrcPortRangeLength;ucLoopIndex++) - { + for(ucLoopIndex=0;ucLoopIndex<pstClassifierRule->ucSrcPortRangeLength;ucLoopIndex++) { if(ushSrcPort <= pstClassifierRule->usSrcPortRangeHi[ucLoopIndex] && - ushSrcPort >= pstClassifierRule->usSrcPortRangeLo[ucLoopIndex]) - { + ushSrcPort >= pstClassifierRule->usSrcPortRangeLo[ucLoopIndex]) { return TRUE; } } @@ -198,8 +189,7 @@ BOOLEAN MatchDestPort(S_CLASSIFIER_RULE *pstClassifierRule,USHORT ushDestPort) 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, @@ -207,8 +197,7 @@ BOOLEAN MatchDestPort(S_CLASSIFIER_RULE *pstClassifierRule,USHORT ushDestPort) pstClassifierRule->usDestPortRangeHi[ucLoopIndex]); if(ushDestPort <= pstClassifierRule->usDestPortRangeHi[ucLoopIndex] && - ushDestPort >= pstClassifierRule->usDestPortRangeLo[ucLoopIndex]) - { + ushDestPort >= pstClassifierRule->usDestPortRangeLo[ucLoopIndex]) { return TRUE; } } @@ -239,8 +228,7 @@ 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; } @@ -265,8 +253,7 @@ static USHORT IpVersion4(PMINI_ADAPTER Adapter, "Destination IP Address Matched\n"); if(FALSE == (bClassificationSucceed = - MatchTos(pstClassifierRule, iphd->tos))) - { + MatchTos(pstClassifierRule, iphd->tos))) { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "TOS Match failed\n"); break; @@ -302,18 +289,13 @@ static USHORT IpVersion4(PMINI_ADAPTER Adapter, break; } 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) - { + } else { + if(FALSE == Adapter->PackInfo[iMatchedSFQueueIndex].bActive) { bClassificationSucceed = FALSE; } } @@ -328,8 +310,7 @@ VOID PruneQueueAllSF(PMINI_ADAPTER Adapter) { UINT iIndex = 0; - for(iIndex = 0; iIndex < HiPriority; iIndex++) - { + for(iIndex = 0; iIndex < HiPriority; iIndex++) { if(!Adapter->PackInfo[iIndex].bValid) continue; @@ -363,10 +344,9 @@ static VOID PruneQueue(PMINI_ADAPTER Adapter, INT iIndex) spin_lock_bh(&Adapter->PackInfo[iIndex].SFQueueLock); - while(1) + while(1) { // while((UINT)Adapter->PackInfo[iIndex].uiCurrentPacketsOnHost > -// SF_MAX_ALLOWED_PACKETS_TO_BACKUP) - { +// SF_MAX_ALLOWED_PACKETS_TO_BACKUP) { bcm_dbg(Adapter, TX, PRUNE_QUEUE, ALL, "uiCurrentBytesOnHost:%x uiMaxBucketSize :%x\n", Adapter->PackInfo[iIndex].uiCurrentBytesOnHost, @@ -380,8 +360,7 @@ static VOID PruneQueue(PMINI_ADAPTER Adapter, INT iIndex) ((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); @@ -425,20 +404,16 @@ 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 + } else uiTotalPacketLength = 0; DEQUEUEPACKET(Adapter->PackInfo[iQIndex].FirstTxQueue, @@ -487,32 +462,27 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) *((UINT32*) (skb->cb) +SKB_CB_TCPACK_OFFSET ) = 0; EThCSGetPktInfo(Adapter,pvEThPayload,&stEthCsPktInfo); - switch(stEthCsPktInfo.eNwpktEthFrameType) - { - case eEth802LLCFrame: - { + switch(stEthCsPktInfo.eNwpktEthFrameType) { + case eEth802LLCFrame: { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "ClassifyPacket : 802LLCFrame\n"); pIpHeader = pvEThPayload + sizeof(ETH_CS_802_LLC_FRAME); break; } - case eEth802LLCSNAPFrame: - { + case eEth802LLCSNAPFrame: { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "ClassifyPacket : 802LLC SNAP Frame\n"); pIpHeader = pvEThPayload + sizeof(ETH_CS_802_LLC_SNAP_FRAME); break; } - case eEth802QVLANFrame: - { + case eEth802QVLANFrame: { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "ClassifyPacket : 802.1Q VLANFrame\n"); pIpHeader = pvEThPayload + sizeof(ETH_CS_802_Q_FRAME); break; } - case eEthOtherFrame: - { + case eEthOtherFrame: { bcm_dbg(Adapter, TX, IPV4_DBG, ALL, "ClassifyPacket : ETH Other Frame\n"); pIpHeader = pvEThPayload + sizeof(ETH_CS_ETH2_FRAME); @@ -527,24 +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) 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"); @@ -553,16 +519,14 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) } } - for(uiLoopIndex = MAX_CLASSIFIERS - 1; uiLoopIndex >= 0; uiLoopIndex--) - { + 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; } @@ -570,8 +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 } @@ -585,11 +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; @@ -604,8 +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; @@ -614,8 +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; @@ -626,11 +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; @@ -649,8 +606,7 @@ USHORT ClassifyPacket(PMINI_ADAPTER Adapter,struct sk_buff* skb) }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, @@ -658,15 +614,13 @@ 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) && - (ntohs(pIpHeader->tot_len) == (IpHeaderLength*4)+(TcpHeaderLength*4))) - { + (ntohs(pIpHeader->tot_len) == (IpHeaderLength*4)+(TcpHeaderLength*4))) { *((UINT32*) (skb->cb) +SKB_CB_TCPACK_OFFSET ) = TCP_ACK; } } @@ -676,8 +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; @@ -704,8 +657,7 @@ static BOOLEAN EthCSMatchSrcMACAddress(S_CLASSIFIER_RULE *pstClassifierRule,PUCH 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], @@ -724,8 +676,7 @@ static BOOLEAN EthCSMatchDestMACAddress(S_CLASSIFIER_RULE *pstClassifierRule,PUC 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], @@ -748,8 +699,7 @@ 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__, @@ -762,8 +712,7 @@ static BOOLEAN EthCSMatchEThTypeSAP(S_CLASSIFIER_RULE *pstClassifierRule,struct return FALSE; } - if(pstClassifierRule->au8EthCSEtherType[0] == 2) - { + if(pstClassifierRule->au8EthCSEtherType[0] == 2) { if(eEth802LLCFrame != pstEthCsPktInfo->eNwpktEthFrameType) return FALSE; @@ -797,8 +746,7 @@ 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(pstClassifierRule->usValidityBitMap & (1<<PKT_CLASSIFICATION_USER_PRIORITY_VALID)) { if(pstEthCsPktInfo->eNwpktEthFrameType!=eEth802QVLANFrame) return FALSE; @@ -816,8 +764,7 @@ static BOOLEAN EthCSMatchVLANRules(S_CLASSIFIER_RULE *pstClassifierRule,struct s bClassificationSucceed = FALSE; - if(pstClassifierRule->usValidityBitMap & (1<<PKT_CLASSIFICATION_VLANID_VALID)) - { + if(pstClassifierRule->usValidityBitMap & (1<<PKT_CLASSIFICATION_VLANID_VALID)) { if(pstEthCsPktInfo->eNwpktEthFrameType!=eEth802QVLANFrame) return FALSE; @@ -883,33 +830,26 @@ 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; //((ETH_CS_802_Q_FRAME*)pvEthPayload)->UserPriority - } - else - { + } else { pstEthCsPktInfo->eNwpktEthFrameType = eEthOtherFrame; u16Etype = ntohs(u16Etype); } - } - else - { + } else { //802.2 LLC 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; diff --git a/drivers/staging/bcm/Transmit.c b/drivers/staging/bcm/Transmit.c index ff0527a..7cb20b8 100644 --- a/drivers/staging/bcm/Transmit.c +++ b/drivers/staging/bcm/Transmit.c @@ -46,15 +46,13 @@ 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 ) < - ((PLeader->PLength-1)/MAX_DEVICE_DESC_SIZE)+1)) - { + ((PLeader->PLength-1)/MAX_DEVICE_DESC_SIZE)+1)) { bcm_dbg(Adapter, TX, TX_CONTROL, ALL, "NO FREE DESCRIPTORS TO SEND CONTROL PACKET\n"); return STATUS_FAILURE; @@ -97,8 +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; } @@ -109,8 +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; } @@ -118,8 +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; @@ -132,13 +127,10 @@ INT SetupNextSend(PMINI_ADAPTER Adapter, struct sk_buff *Packet, USHORT Vcid) 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; @@ -146,24 +138,19 @@ INT SetupNextSend(PMINI_ADAPTER Adapter, struct sk_buff *Packet, USHORT Vcid) } skb_push(Packet, LEADER_SIZE); memcpy(Packet->data, &Leader, LEADER_SIZE); - } - else - { + } else { Leader.PLength = Packet->len - ETH_HLEN; memcpy((LEADER*)skb_pull(Packet, (ETH_HLEN - LEADER_SIZE)), &Leader, LEADER_SIZE); } 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", Adapter->dev->name, status); - } - else - { + } else { struct net_device_stats *netstats = &Adapter->dev->stats; Adapter->PackInfo[QueueIndex].uiTotalTxBytes += Leader.PLength; @@ -215,8 +202,7 @@ 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) @@ -225,32 +211,27 @@ int tx_pkt_handler(PMINI_ADAPTER Adapter /**< pointer to adapter object*/ } //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) && Adapter->LinkStatus == SYNC_UP_REQUEST && - !Adapter->bSyncUpRequestSent) - { + !Adapter->bSyncUpRequestSent) { bcm_dbg(Adapter, TX, TX_PACKETS, ALL, "Calling LinkMessage\n"); 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.c b/drivers/staging/bcm/led_control.c index 929151f..31d3c76 100644 --- a/drivers/staging/bcm/led_control.c +++ b/drivers/staging/bcm/led_control.c @@ -743,8 +743,7 @@ static VOID LEDControlThread(PMINI_ADAPTER Adapter) if (GPIO_num != DISABLE_GPIO_NUM) TURN_ON_LED(1 << GPIO_num, uiLedIndex); break; - case NORMAL_OPERATION: - { + case NORMAL_OPERATION: { UCHAR GPIO_num_tx = DISABLE_GPIO_NUM; UCHAR GPIO_num_rx = DISABLE_GPIO_NUM; UCHAR uiLEDTx = 0; diff --git a/drivers/staging/bcm/led_control.h b/drivers/staging/bcm/led_control.h index 78e0646..9840302 100644 --- a/drivers/staging/bcm/led_control.h +++ b/drivers/staging/bcm/led_control.h @@ -71,8 +71,7 @@ typedef enum LedEvents { /*Structure which stores the information of different LED types * and corresponding LED state information of driver states*/ -typedef struct LedStateInfo_t -{ +typedef struct LedStateInfo_t { UCHAR LED_Type; /* specify GPIO number - use 0xFF if not used */ UCHAR LED_On_State; /* Bits set or reset for different states */ UCHAR LED_Blink_State; /* Bits set or reset for blinking LEDs for different states */ @@ -82,8 +81,7 @@ typedef struct LedStateInfo_t }LEDStateInfo, *pLEDStateInfo; -typedef struct _LED_INFO_STRUCT -{ +typedef struct _LED_INFO_STRUCT { LEDStateInfo LEDState[NUM_OF_LEDS]; BOOLEAN bIdleMode_tx_from_host; /*Variable to notify whether driver came out from idlemode due to Host or target*/ diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c index 03b88f3..54ae2c3 100644 --- a/drivers/staging/bcm/nvm.c +++ b/drivers/staging/bcm/nvm.c @@ -74,20 +74,17 @@ static UCHAR ReadEEPROMStatusRegister( PMINI_ADAPTER Adapter ) value = EEPROM_READ_STATUS_REGISTER ; wrmalt( Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value)); - while ( dwRetries != 0 ) - { + while ( dwRetries != 0 ) { 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; } /* Wait for Avail bit to be set. */ - if ( ( uiStatus & EEPROM_READ_DATA_AVAIL) != 0 ) - { + if ( ( uiStatus & EEPROM_READ_DATA_AVAIL) != 0 ) { /* Clear the Avail/Full bits - which ever is set. */ value = uiStatus & (EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL); wrmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); @@ -100,8 +97,7 @@ static UCHAR ReadEEPROMStatusRegister( PMINI_ADAPTER Adapter ) } dwRetries-- ; - if ( dwRetries == 0 ) - { + if ( dwRetries == 0 ) { rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); rdmalt(Adapter, EEPROM_SPI_Q_STATUS_REG, &value1, sizeof(value1)); pr_info("0x3004 = %x 0x3008 = %x, retries = %d failed\n", @@ -156,13 +152,11 @@ INT ReadBeceemEEPROMBulk( PMINI_ADAPTER Adapter, value= dwAddress | ( (dwNumWords == 4) ? EEPROM_16_BYTE_PAGE_READ : EEPROM_4_BYTE_PAGE_READ ); wrmalt( Adapter, EEPROM_CMDQ_SPI_REG, &value, sizeof(value)); - while ( dwRetries != 0 ) - { + while ( dwRetries != 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 from loop...\n"); return -ENODEV; } @@ -170,21 +164,16 @@ INT ReadBeceemEEPROMBulk( PMINI_ADAPTER Adapter, /* If we are reading 16 bytes we want to be sure that the queue * is full before we read. In the other cases we are ok if the * queue has data available */ - if ( dwNumWords == 4 ) - { - if ( ( uiStatus & EEPROM_READ_DATA_FULL ) != 0 ) - { + if ( dwNumWords == 4 ) { + if ( ( uiStatus & EEPROM_READ_DATA_FULL ) != 0 ) { /* Clear the Avail/Full bits - which ever is set. */ value = ( uiStatus & (EEPROM_READ_DATA_AVAIL | EEPROM_READ_DATA_FULL) ) ; wrmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG,&value, sizeof(value)); break; } - } - else if ( dwNumWords == 1 ) - { + } else if ( dwNumWords == 1 ) { - if ( ( uiStatus & EEPROM_READ_DATA_AVAIL ) != 0 ) - { + if ( ( uiStatus & EEPROM_READ_DATA_AVAIL ) != 0 ) { /* We just got Avail and we have to read 32bits so we * need this sleep for Cardbus kind of devices. */ if (Adapter->chip_id == 0xBECE0210 ) @@ -200,8 +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)); @@ -215,8 +203,7 @@ INT ReadBeceemEEPROMBulk( PMINI_ADAPTER Adapter, msleep(1); } - for ( dwIndex = 0; dwIndex < dwNumWords ; dwIndex++ ) - { + for ( dwIndex = 0; dwIndex < dwNumWords ; dwIndex++ ) { /* We get only a byte at a time - from LSB to MSB. We shift it into an integer. */ pvalue = (PUCHAR)(pdwData + dwIndex); @@ -277,8 +264,7 @@ INT ReadBeceemEEPROM( PMINI_ADAPTER Adapter, /* A word can overlap at most over 2 pages. In that case we read the * next page too. */ - if ( uiByteOffset > 12 ) - { + if ( uiByteOffset > 12 ) { ReadBeceemEEPROMBulk(Adapter, uiTempOffset + MAX_RW_SIZE, (PUINT)&uiData[4], 4); } @@ -337,21 +323,17 @@ 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); uiIndex += (MAX_RW_SIZE - uiExtraBytes); uiOffset += (MAX_RW_SIZE - uiExtraBytes); - } - else - { + } else { memcpy(pBuffer,(((PUCHAR)&uiData[0])+uiExtraBytes),uiBytesRemaining); uiIndex += uiBytesRemaining; uiOffset += uiBytesRemaining; @@ -362,57 +344,42 @@ 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; uiIndex += MAX_RW_SIZE; - } - else - { + } else { 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; uiIndex +=4; - } - else - { + } else { uiFailureRetries++; mdelay(3);//sleep for a while before retry... } - } - else + } else { // 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 - { + } else { uiFailureRetries++; mdelay(3);//sleep for a while before retry... } @@ -451,8 +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; } @@ -466,8 +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); @@ -486,8 +451,7 @@ static INT BeceemFlashBulkRead( uiNumBytes -= uiBytesToRead; } - while(uiNumBytes) - { + while(uiNumBytes) { BcmDoChipSelect(Adapter,uiOffset); uiPartOffset = (uiOffset & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); @@ -559,32 +523,24 @@ 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; } } - } - else - { + } else { // // EEPROM may not be present or not programmed // 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; } } @@ -620,8 +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)); @@ -632,8 +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; } @@ -651,8 +605,7 @@ static INT FlashSectorErase(PMINI_ADAPTER Adapter, msleep(10); }while((uiStatus & 0x1) && (iRetries < 400)); - if(uiStatus & 0x1) - { + if(uiStatus & 0x1) { pr_info("iRetries crossing the limit of 80000\n"); return STATUS_FAILURE; } @@ -693,26 +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; } @@ -722,8 +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; } @@ -740,8 +688,7 @@ static INT flashByteWrite( }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 ; } @@ -785,20 +732,17 @@ static INT flashWrite( // need not write 0xFFFFFFFF because write requires an erase and erase will // make whole sector 0xFFFFFFFF. // - if (!memcmp(pData, uiErasePattern, MAX_RW_SIZE)) - { + if (!memcmp(pData, uiErasePattern, MAX_RW_SIZE)) { return 0; } 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; } @@ -807,8 +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; } @@ -829,8 +772,7 @@ static INT flashWrite( msleep(1); }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 ; } @@ -867,27 +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; } @@ -897,8 +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; } @@ -915,8 +852,7 @@ static INT flashByteWriteStatus( msleep(1); }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 ; } @@ -954,19 +890,16 @@ static INT flashWriteStatus( // need not write 0xFFFFFFFF because write requires an erase and erase will // make whole sector 0xFFFFFFFF. // - if (!memcmp(pData,uiErasePattern,MAX_RW_SIZE)) - { + if (!memcmp(pData,uiErasePattern,MAX_RW_SIZE)) { return 0; } 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; } @@ -975,8 +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; } @@ -996,8 +928,7 @@ static INT flashWriteStatus( msleep(1); }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 ; } @@ -1051,8 +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. // @@ -1073,28 +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 @@ -1102,18 +1026,14 @@ 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. // ulWriteStatus |= (0x1<<2); ulWriteStatus &= ~(0x3<<3); - } - else - { + } else { // // Unblock all. // Clear BP2,BP1 and BP0. @@ -1191,30 +1111,23 @@ static INT BeceemFlashBulkWrite( // // check if the data to be written is overlapped across sectors // - if(uiOffset+uiNumBytes < uiSectBoundary) - { + if(uiOffset+uiNumBytes < uiSectBoundary) { uiNumSectTobeRead = 1; - } - else - { + } 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); @@ -1226,8 +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", @@ -1240,8 +1152,7 @@ static INT BeceemFlashBulkWrite( if(0 != BeceemFlashBulkRead(Adapter, (PUINT)pTempBuff, uiOffsetFromSectStart, - Adapter->uiSectorSize)) - { + Adapter->uiSectorSize)) { Status = -1; goto BeceemFlashBulkWrite_EXIT; } @@ -1256,20 +1167,16 @@ 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))); uiNumBytes -= (uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)); - } - else - { + } else { memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiNumBytes); } - if(IsFlash2x(Adapter)) - { + if(IsFlash2x(Adapter)) { SaveHeaderIfPresent(Adapter,(PUCHAR)pTempBuff,uiOffsetFromSectStart); } @@ -1280,15 +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; } @@ -1300,31 +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])) - { + } else { + if(memcmp(ucReadBk,&pTempBuff[uiIndex],MAX_RW_SIZE)) { + if(STATUS_SUCCESS != (*Adapter->fpFlashWriteWithStatusCheck)(Adapter,uiPartOffset+uiIndex,&pTempBuff[uiIndex])) { Status = STATUS_FAILURE; goto BeceemFlashBulkWrite_EXIT; } @@ -1339,8 +1233,7 @@ static INT BeceemFlashBulkWrite( (tw.tv_sec *1000 + tw.tv_usec/1000)); */ - if(ulStatus) - { + if(ulStatus) { BcmRestoreBlockProtectStatus(Adapter,ulStatus); ulStatus = 0; } @@ -1363,8 +1256,7 @@ static INT BeceemFlashBulkWrite( // Cleanup. // BeceemFlashBulkWrite_EXIT: - if(ulStatus) - { + if(ulStatus) { BcmRestoreBlockProtectStatus(Adapter,ulStatus); } @@ -1430,28 +1322,21 @@ static INT BeceemFlashBulkWriteStatus( // // check if the data to be written is overlapped across sectors // - if(uiOffset+uiNumBytes < uiSectBoundary) - { + if(uiOffset+uiNumBytes < uiSectBoundary) { uiNumSectTobeRead = 1; - } - else - { + } 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); @@ -1464,36 +1349,30 @@ 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, (PUINT)pTempBuff, uiOffsetFromSectStart, - Adapter->uiSectorSize)) - { + Adapter->uiSectorSize)) { Status = -1; goto BeceemFlashBulkWriteStatus_EXIT; } ulStatus = BcmFlashUnProtectBlock(Adapter,uiOffsetFromSectStart,Adapter->uiSectorSize); - if(uiNumSectTobeRead > 1) - { + if(uiNumSectTobeRead > 1) { memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)); pcBuffer += ((uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr))); uiNumBytes -= (uiSectBoundary-(uiSectAlignAddr+uiCurrSectOffsetAddr)); - } - else - { + } else { memcpy(&pTempBuff[uiCurrSectOffsetAddr],pcBuffer,uiNumBytes); } - if(IsFlash2x(Adapter)) - { + if(IsFlash2x(Adapter)) { SaveHeaderIfPresent(Adapter,(PUCHAR)pTempBuff,uiOffsetFromSectStart); } @@ -1502,28 +1381,22 @@ static INT BeceemFlashBulkWriteStatus( 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; } @@ -1533,8 +1406,7 @@ static INT BeceemFlashBulkWriteStatus( } } - if(ulStatus) - { + if(ulStatus) { BcmRestoreBlockProtectStatus(Adapter,ulStatus); ulStatus = 0; } @@ -1549,8 +1421,7 @@ static INT BeceemFlashBulkWriteStatus( // Cleanup. // BeceemFlashBulkWriteStatus_EXIT: - if(ulStatus) - { + if(ulStatus) { BcmRestoreBlockProtectStatus(Adapter,ulStatus); } @@ -1583,21 +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; } @@ -1605,10 +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; } @@ -1660,8 +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); @@ -1672,8 +1537,7 @@ INT PropagateCalParamsFromFlashToMemory(PMINI_ADAPTER Adapter) // uiEepromSize -= EEPROM_CALPARAM_START; - if(uiEepromSize > 1024*1024) - { + if(uiEepromSize > 1024*1024) { return -1; } @@ -1681,8 +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; } @@ -1691,11 +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; } @@ -1737,10 +1598,8 @@ static INT BeceemEEPROMReadBackandVerify( UINT uiData = 0; UINT auiData[4] = {0}; - while(uiNumBytes) - { - if(Adapter->device_removed ) - { + while(uiNumBytes) { + if(Adapter->device_removed ) { return -1; } @@ -1748,15 +1607,13 @@ static INT BeceemEEPROMReadBackandVerify( {// 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; } } @@ -1764,18 +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; } } @@ -1783,8 +1636,7 @@ static INT BeceemEEPROMReadBackandVerify( uiNumBytes -= 4; uiIndex++; - } - else + } else { // Handle the reads less than 4 bytes... uiData = 0; memcpy(&uiData,((PUCHAR)pBuffer)+(uiIndex*sizeof(UINT)),uiNumBytes); @@ -1881,11 +1733,9 @@ static INT BeceemEEPROMWritePage( PMINI_ADAPTER Adapter, UINT uiData[], UINT uiO * may take time. We should wait till the Empty bit is set. */ uiStatus = 0; rdmalt(Adapter, EEPROM_SPI_Q_STATUS1_REG, &uiStatus, sizeof(uiStatus)); - while ( ( uiStatus & EEPROM_WRITE_QUEUE_EMPTY ) == 0 ) - { + while ( ( uiStatus & EEPROM_WRITE_QUEUE_EMPTY ) == 0 ) { uiRetries--; - if ( uiRetries == 0 ) - { + if ( uiRetries == 0 ) { pr_info("0x0f003004 = %x, %d retries failed\n", uiStatus, MAX_EEPROM_RETRIES * RETRIES_PER_DELAY); @@ -1897,16 +1747,14 @@ static INT BeceemEEPROMWritePage( PMINI_ADAPTER Adapter, UINT uiData[], UINT uiO 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; } } - if ( uiRetries != 0 ) - { + if ( uiRetries != 0 ) { /* Clear the ones that are set - either, Empty/Full/Avail bits */ value = ( uiStatus & ( EEPROM_WRITE_QUEUE_EMPTY | EEPROM_WRITE_QUEUE_AVAIL | EEPROM_WRITE_QUEUE_FULL ) ); wrmalt( Adapter, EEPROM_SPI_Q_STATUS1_REG, &value, sizeof(value)); @@ -1919,16 +1767,13 @@ static INT BeceemEEPROMWritePage( PMINI_ADAPTER Adapter, UINT uiData[], UINT uiO * means the previous write to the EEPROM has completed. */ uiRetries = MAX_EEPROM_RETRIES*RETRIES_PER_DELAY; uiEpromStatus = 0; - while ( uiRetries != 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; } - if ( ( EEPROM_STATUS_REG_WRITE_BUSY & uiEpromStatus ) == 0 ) - { + if ( ( EEPROM_STATUS_REG_WRITE_BUSY & uiEpromStatus ) == 0 ) { pr_info("EEPROM status register = %x tries = %d\n", uiEpromStatus, MAX_EEPROM_RETRIES * RETRIES_PER_DELAY - @@ -1936,8 +1781,7 @@ static INT BeceemEEPROMWritePage( PMINI_ADAPTER Adapter, UINT uiData[], UINT uiO return STATUS_SUCCESS ; } uiRetries--; - if ( uiRetries == 0 ) - { + if ( uiRetries == 0 ) { pr_info("0x0f003004 = %x, for EEPROM status read %d retries failed\n", uiEpromStatus, MAX_EEPROM_RETRIES * RETRIES_PER_DELAY); @@ -1984,16 +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 ) ) @@ -2002,9 +1844,7 @@ INT BeceemEEPROMBulkWrite( uiBytesToCopy -= (MAX_RW_SIZE - uiExtraBytes); uiIndex += (MAX_RW_SIZE - uiExtraBytes); uiOffset += (MAX_RW_SIZE - uiExtraBytes); - } - else - { + } else { memcpy((((PUCHAR)&uiData[0])+uiExtraBytes),pBuffer,uiBytesToCopy); if ( STATUS_FAILURE == BeceemEEPROMWritePage( Adapter, uiData, uiTempOffset ) ) @@ -2018,15 +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; @@ -2034,9 +1871,7 @@ INT BeceemEEPROMBulkWrite( uiIndex += MAX_RW_SIZE; uiOffset += MAX_RW_SIZE; uiBytesToCopy -= MAX_RW_SIZE; - } - else - { + } else { // // To program non 16byte aligned data, read 16byte and then update. // @@ -2081,10 +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 ; @@ -2102,16 +1935,12 @@ 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, uiNumBytes); - } - else - { + } else { Status = -1; } return Status; @@ -2149,12 +1978,10 @@ 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 - { + else { uiFlashOffset = uiOffset + Adapter->ulFlashCalStart; #if defined(BCM_SHM_INTERFACE) && !defined(FLASH_DIRECT_ACCESS) @@ -2164,16 +1991,13 @@ INT BeceemNVMWrite( value = 0; wrmalt(Adapter, 0x0f000C80, &value, sizeof(value)); - if(Adapter->bStatusWrite == TRUE) - { + if(Adapter->bStatusWrite == TRUE) { Status = BeceemFlashBulkWriteStatus(Adapter, pBuffer, uiFlashOffset, uiNumBytes , bVerify); - } - else - { + } else { Status = BeceemFlashBulkWrite(Adapter, pBuffer, @@ -2185,44 +2009,32 @@ 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; - } - else - { + } else { wrm(Adapter,uiMemoryLoc+uiIndex,(PCHAR)(pBuffer+(uiIndex/4)),uiNumBytes); uiNumBytes = 0; break; } } - } - else - { - if((uiOffset+uiNumBytes) > EEPROM_CALPARAM_START) - { + } else { + 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; - } - else - { + } else { wrm(Adapter,uiMemoryLoc+uiIndex,(PCHAR)&pcBuffer[ulBytesTobeSkipped+uiIndex],uiNumBytes); uiNumBytes = 0; break; @@ -2234,21 +2046,16 @@ 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 - { + } else { Status = -1; } return Status; @@ -2292,13 +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; @@ -2307,8 +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); @@ -2351,47 +2154,35 @@ static UINT BcmGetFlashSectorSize(PMINI_ADAPTER Adapter, UINT FlashSectorSizeSig if(Adapter->bSectorSizeOverride && (Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && - Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE)) - { + Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE)) { Adapter->uiSectorSize = Adapter->uiSectorSizeInCFG; - } - else - { + } else { 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 && - Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) - { + Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) { Adapter->uiSectorSize = Adapter->uiSectorSizeInCFG; } // Init to Default, if none of the above works. - else - { + else { Adapter->uiSectorSize = DEFAULT_SECTOR_SIZE; } - } - else - { + } else { if(Adapter->uiSectorSizeInCFG <= MAX_SECTOR_SIZE && - Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) - { + Adapter->uiSectorSizeInCFG >= MIN_SECTOR_SIZE) { Adapter->uiSectorSize = Adapter->uiSectorSizeInCFG; - } - else - { + } else { Adapter->uiSectorSize = DEFAULT_SECTOR_SIZE; } } @@ -2458,16 +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); } @@ -2487,12 +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; @@ -2519,8 +2303,7 @@ static VOID BcmValidateNvmType(PMINI_ADAPTER Adapter) // if(Adapter->eNVMType == NVM_FLASH && - Adapter->chip_id < 0xBECE3300) - { + Adapter->chip_id < 0xBECE3300) { Adapter->eNVMType = NVM_AUTODETECT; } } @@ -2560,29 +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); @@ -2594,8 +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; } @@ -2735,8 +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]); @@ -2795,8 +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; @@ -2856,10 +2632,8 @@ static VOID UpdateVendorInfo(PMINI_ADAPTER Adapter) 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; } @@ -2868,8 +2642,7 @@ 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))) && (UNINIT_PTR_IN_CS != Adapter->psFlash2xVendorInfo->VendorSection[i].OffsetFromZeroForSectionStart)) @@ -2951,8 +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)); @@ -2971,13 +2743,10 @@ 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 - { + } else { Adapter->uiFlashLayoutMinorVersion = 0; uiFlashLayoutMajorVersion = 0; } @@ -2985,28 +2754,23 @@ 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)) && (SCSI_FIRMWARE_MINOR_VERSION <= MINOR_VERSION(Adapter->psFlashCSInfo->SCSIFirmwareVersion)) && (FLASH_SECTOR_SIZE_SIG == (Adapter->psFlashCSInfo->FlashSectorSizeSig)) && - (BYTE_WRITE_SUPPORT == (Adapter->psFlashCSInfo->FlashWriteSupportSize))) - { + (BYTE_WRITE_SUPPORT == (Adapter->psFlashCSInfo->FlashWriteSupportSize))) { Adapter->ulFlashWriteSize = (Adapter->psFlashCSInfo->FlashWriteSupportSize); Adapter->fpFlashWrite = flashByteWrite; Adapter->fpFlashWriteWithStatusCheck = flashByteWriteStatus; - } - else - { + } else { Adapter->ulFlashWriteSize = MAX_RW_SIZE; Adapter->fpFlashWrite = flashWrite; Adapter->fpFlashWriteWithStatusCheck = flashWriteStatus; @@ -3019,12 +2783,9 @@ static INT BcmGetFlashCSInfo(PMINI_ADAPTER Adapter) Adapter->uiFlashBaseAdd = Adapter->psFlashCSInfo->FlashBaseAddr & 0xFCFFFFFF; - } - else - { + } else { if(BcmFlash2xBulkRead(Adapter,(PUINT)Adapter->psFlash2xCSInfo,NO_SECTION_VAL, - Adapter->ulFlashControlSectionStart,sizeof(FLASH2X_CS_INFO))) - { + Adapter->ulFlashControlSectionStart,sizeof(FLASH2X_CS_INFO))) { pr_info("Unable to read CS structure\n"); return STATUS_FAILURE; } @@ -3033,14 +2794,11 @@ static INT BcmGetFlashCSInfo(PMINI_ADAPTER Adapter) 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)) - { + (BYTE_WRITE_SUPPORT == Adapter->psFlash2xCSInfo->FlashWriteSupportSize)) { Adapter->ulFlashWriteSize = Adapter->psFlash2xCSInfo->FlashWriteSupportSize; Adapter->fpFlashWrite = flashByteWrite; Adapter->fpFlashWriteWithStatusCheck = flashByteWriteStatus; - } - else - { + } else { Adapter->ulFlashWriteSize = MAX_RW_SIZE; Adapter->fpFlashWrite = flashWrite; Adapter->fpFlashWriteWithStatusCheck = flashWriteStatus; @@ -3088,8 +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; } // @@ -3098,16 +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; } @@ -3139,13 +2894,11 @@ 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) && (IsNonCDLessDevice(Adapter) == FALSE)) @@ -3226,13 +2979,11 @@ 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) && (IsNonCDLessDevice(Adapter) == FALSE)) @@ -3322,13 +3073,11 @@ 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; } @@ -3339,8 +3088,7 @@ INT BcmFlash2xBulkRead( 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; @@ -3358,8 +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 ; } @@ -3392,13 +3139,11 @@ 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; } @@ -3409,8 +3154,7 @@ INT BcmFlash2xBulkWrite( 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; @@ -3429,8 +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 ; } @@ -3463,21 +3206,15 @@ static INT BcmGetActiveDSD(PMINI_ADAPTER Adapter) 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; } @@ -3606,8 +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) @@ -3631,8 +3367,7 @@ 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; @@ -3645,8 +3380,7 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 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; } @@ -3656,8 +3390,7 @@ 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; @@ -3668,8 +3401,7 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 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; } @@ -3680,8 +3412,7 @@ 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; @@ -3689,16 +3420,12 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 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 - { + } else { //Means section is writable - if((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD2)) - { + if((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD2)) { psFlash2xBitMap->DSD2 |= FLASH2X_SECTION_ACT ; SetActiveDSDDone =TRUE ; } @@ -3708,8 +3435,7 @@ 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; @@ -3718,15 +3444,11 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 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 - { + } else { //Means section is writable - if((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD1)) - { + if((SetActiveDSDDone == FALSE) && (uiHighestPriDSD == DSD1)) { psFlash2xBitMap->DSD1 |= FLASH2X_SECTION_ACT ; SetActiveDSDDone =TRUE ; } @@ -3737,8 +3459,7 @@ 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; @@ -3746,15 +3467,11 @@ INT BcmGetFlash2xSectionalBitMap(PMINI_ADAPTER Adapter, PFLASH2X_BITMAP psFlash2 psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_VALID; //Setting Access permission - if(IsSectionWritable(Adapter, DSD0) == FALSE) - { + if(IsSectionWritable(Adapter, DSD0) == FALSE) { psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_RO; - } - else - { + } else { //Means section is writable - if((SetActiveDSDDone == FALSE) &&(uiHighestPriDSD == DSD0)) - { + if((SetActiveDSDDone == FALSE) &&(uiHighestPriDSD == DSD0)) { psFlash2xBitMap->DSD0 |= FLASH2X_SECTION_ACT ; SetActiveDSDDone =TRUE ; } @@ -3764,8 +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; @@ -3786,8 +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; @@ -3808,8 +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; @@ -3828,8 +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; @@ -3850,8 +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); @@ -3903,24 +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); @@ -3930,8 +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 @@ -3946,8 +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 ; @@ -3955,8 +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); @@ -3976,14 +3681,11 @@ 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 ; } - } - else - { + } else { pr_info("Signature is corrupted. Hence can't increase the priority\n"); Status = STATUS_FAILURE ; break; @@ -3992,12 +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); @@ -4006,8 +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 @@ -4022,16 +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); @@ -4047,16 +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; } @@ -4070,15 +3765,12 @@ 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 ; } - } - else - { + } else { pr_info("Signature is corrupted. Hence can't increase the priority\n"); Status = STATUS_FAILURE ; break; @@ -4122,8 +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; } @@ -4134,16 +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); } @@ -4151,14 +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; @@ -4171,8 +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; @@ -4185,8 +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; @@ -4196,10 +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"); @@ -4209,29 +3892,23 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) uiWriteOffsetWithinPart = 0 ; IsThisHeaderSector = TRUE ; - } - else - { + } else { 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; } @@ -4244,15 +3921,13 @@ 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); @@ -4267,8 +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; @@ -4276,8 +3950,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) Adapter->bHeaderChangeAllowed = FALSE; - if(IsThisHeaderSector == TRUE) - { + if(IsThisHeaderSector == TRUE) { WriteToFlashWithoutSectorErase(Adapter, SigBuff, eISOWritePart, @@ -4292,8 +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; @@ -4306,8 +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; @@ -4320,8 +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; @@ -4331,10 +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"); @@ -4344,29 +4012,23 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) uiWriteOffsetWithinPart = 0 ; IsThisHeaderSector = TRUE; - } - else - { + } else { 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; } @@ -4378,15 +4040,13 @@ 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); @@ -4402,8 +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; @@ -4411,8 +4070,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut) Adapter->bHeaderChangeAllowed = FALSE ; - if(IsThisHeaderSector == TRUE) - { + if(IsThisHeaderSector == TRUE) { WriteToFlashWithoutSectorErase(Adapter, SigBuff, eISOWritePart, @@ -4451,16 +4109,11 @@ 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 - { + } else { bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Given Section <%d>does not have Header\n", eFlash2xSectionVal); @@ -4486,47 +4139,37 @@ 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; } - } - else - { + } else { pr_info("GIVEN SECTION< %d > IS NOT VALID FOR SIG WRITE...\n", eFlashSectionVal); return STATUS_FAILURE; @@ -4561,8 +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; @@ -4571,19 +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) - @@ -4599,8 +4237,7 @@ INT validateFlash2xReadWrite(PMINI_ADAPTER Adapter, PFLASH2X_READWRITE psFlash2x bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "Total size of the ISO Image :%x\n", uiSectEndOffset); - } - else + } else uiSectEndOffset = BcmGetSectionValEndOffset(Adapter,psFlash2xReadWrite->Section); bcm_dbg(Adapter, OTHERS, NVM_RW, ALL, "End offset :%x\n", uiSectEndOffset); @@ -4608,8 +4245,7 @@ INT validateFlash2xReadWrite(PMINI_ADAPTER Adapter, PFLASH2X_READWRITE psFlash2x //Checking the boundary condition if((uiSectStartOffset + psFlash2xReadWrite->offset + uiNumOfBytes) <= uiSectEndOffset) return TRUE; - else - { + else { pr_info("Invalid Request....\n"); return FALSE; } @@ -4644,8 +4280,7 @@ 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 @@ -4656,9 +4291,7 @@ static INT GetFlashBaseAddr(PMINI_ADAPTER Adapter) uiBaseAddr = Adapter->uiFlashBaseAdd ; else uiBaseAddr = FLASH_CONTIGIOUS_START_ADDR_AFTER_INIT; - } - else - { + } else { /* For All Valid Flash Versions... except 1.1, take the value from FlashBaseAddr In case of Raw Read... use the default value @@ -4700,26 +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); @@ -4728,16 +4357,14 @@ INT BcmCopySection(PMINI_ADAPTER Adapter, } if((offset + numOfBytes) > BcmGetSectionValEndOffset(Adapter,SrcSection) - - BcmGetSectionValStartOffset(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) - - BcmGetSectionValStartOffset(Adapter,DstSection)) - { + - BcmGetSectionValStartOffset(Adapter,DstSection)) { pr_info("Input parameters going beyond the section offS: %x numB: %x of Destination Section\n", offset, numOfBytes); return -EINVAL; @@ -4750,8 +4377,7 @@ INT BcmCopySection(PMINI_ADAPTER Adapter, BuffSize = numOfBytes ; pBuff = (PCHAR)kzalloc(BuffSize, GFP_KERNEL); - if(pBuff == NULL) - { + if(pBuff == NULL) { pr_info("Memory allocation failed..\n"); return -ENOMEM; } @@ -4770,23 +4396,20 @@ 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) { if(numOfBytes > Adapter->uiSectorSize ) BytesToBeCopied = Adapter->uiSectorSize; else @@ -4824,8 +4447,7 @@ INT SaveHeaderIfPresent(PMINI_ADAPTER Adapter, PUCHAR pBuff, UINT uiOffset) if((uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter,DSD2)- Adapter->uiSectorSize)|| (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter,DSD1)- Adapter->uiSectorSize)|| - (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter,DSD0)- Adapter->uiSectorSize)) - { + (uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter,DSD0)- Adapter->uiSectorSize)) { //offset from the sector boundary having the header map offsetToProtect = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader % Adapter->uiSectorSize; @@ -4834,18 +4456,15 @@ INT SaveHeaderIfPresent(PMINI_ADAPTER Adapter, PUCHAR pBuff, UINT uiOffset) } if(uiSectAlignAddr == BcmGetSectionValStartOffset(Adapter,ISO_IMAGE1) || - uiSectAlignAddr == BcmGetSectionValStartOffset(Adapter,ISO_IMAGE2)) - { + 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; } @@ -4857,12 +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; @@ -4921,8 +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; @@ -4971,8 +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; } @@ -4994,10 +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, @@ -5018,25 +4631,20 @@ 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; } @@ -5057,8 +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; } @@ -5078,10 +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, @@ -5102,16 +4707,13 @@ 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; } @@ -5139,8 +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; @@ -5148,8 +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); } @@ -5166,8 +4766,7 @@ INT WriteToFlashWithoutSectorErase(PMINI_ADAPTER Adapter, BcmDoChipSelect(Adapter,uiOffset); uiPartOffset = (uiOffset & (FLASH_PART_SIZE - 1)) + GetFlashBaseAddr(Adapter); - for(i = 0 ; i< uiNumBytes; i += Adapter->ulFlashWriteSize) - { + for(i = 0 ; i< uiNumBytes; i += Adapter->ulFlashWriteSize) { if(Adapter->ulFlashWriteSize == BYTE_WRITE_SUPPORT) Status = flashByteWrite(Adapter,uiPartOffset, pcBuff); else @@ -5191,8 +4790,7 @@ 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) && @@ -5246,20 +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); } @@ -5278,18 +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 ; } @@ -5306,30 +4898,23 @@ 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; } - } - else - { + } else { WriteToFlashWithoutSectorErase(Adapter,(PUINT)pBuff,eFlash2xSectionVal, uiOffset ,MAX_RW_SIZE); } - } - else - { + } else { pr_info("BCM Signature is not present in header\n"); kfree(pBuff); return STATUS_FAILURE; @@ -5349,15 +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 ; } @@ -5372,14 +4955,11 @@ 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); - } - else - { + } else { pr_info("BCM Signature is not present in header\n"); kfree(pBuff); return STATUS_FAILURE; diff --git a/drivers/staging/bcm/nvm.h b/drivers/staging/bcm/nvm.h index 148488e..db6e165 100644 --- a/drivers/staging/bcm/nvm.h +++ b/drivers/staging/bcm/nvm.h @@ -22,15 +22,13 @@ #ifndef _NVM_H_ #define _NVM_H_ -typedef struct _FLASH_SECTOR_INFO -{ +typedef struct _FLASH_SECTOR_INFO { UINT uiSectorSig; UINT uiSectorSize; }FLASH_SECTOR_INFO,*PFLASH_SECTOR_INFO; -typedef struct _FLASH_CS_INFO -{ +typedef struct _FLASH_CS_INFO { B_UINT32 MagicNumber; // let the magic number be 0xBECE-F1A5 - F1A5 for "flas-h" @@ -104,8 +102,7 @@ typedef struct _FLASH_CS_INFO #define FLASH2X_TOTAL_SIZE (64*1024*1024) #define DEFAULT_SECTOR_SIZE (64*1024) -typedef struct _FLASH_2X_CS_INFO -{ +typedef struct _FLASH_2X_CS_INFO { // magic number as 0xBECE-F1A5 - F1A5 for "flas-h" B_UINT32 MagicNumber; @@ -202,8 +199,7 @@ typedef struct _FLASH_2X_CS_INFO }FLASH2X_CS_INFO,*PFLASH2X_CS_INFO; -typedef struct _VENDOR_SECTION_INFO -{ +typedef struct _VENDOR_SECTION_INFO { B_UINT32 OffsetFromZeroForSectionStart; B_UINT32 OffsetFromZeroForSectionEnd; B_UINT32 AccessFlags; @@ -211,15 +207,13 @@ typedef struct _VENDOR_SECTION_INFO } VENDOR_SECTION_INFO, *PVENDOR_SECTION_INFO; -typedef struct _FLASH2X_VENDORSPECIFIC_INFO -{ +typedef struct _FLASH2X_VENDORSPECIFIC_INFO { VENDOR_SECTION_INFO VendorSection[TOTAL_SECTIONS]; B_UINT32 Reserved[16]; } FLASH2X_VENDORSPECIFIC_INFO, *PFLASH2X_VENDORSPECIFIC_INFO; -typedef struct _DSD_HEADER -{ +typedef struct _DSD_HEADER { B_UINT32 DSDImageSize; B_UINT32 DSDImageCRC; B_UINT32 DSDImagePriority; @@ -229,8 +223,7 @@ typedef struct _DSD_HEADER }DSD_HEADER, *PDSD_HEADER; -typedef struct _ISO_HEADER -{ +typedef struct _ISO_HEADER { B_UINT32 ISOImageMagicNumber; B_UINT32 ISOImageSize; B_UINT32 ISOImageCRC; diff --git a/drivers/staging/bcm/target_params.h b/drivers/staging/bcm/target_params.h index 316610e..ae9792a 100644 --- a/drivers/staging/bcm/target_params.h +++ b/drivers/staging/bcm/target_params.h @@ -1,8 +1,7 @@ #ifndef TARGET_PARAMS_H #define TARGET_PARAMS_H -typedef struct _TARGET_PARAMS -{ +typedef struct _TARGET_PARAMS { B_UINT32 m_u32CfgVersion; // Scanning Related Params -- 1.7.8.111.gad25c.dirty _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel