diff options
author | Larry Finger <Larry.Finger@lwfinger.net> | 2011-08-25 11:48:11 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-25 10:05:08 -0700 |
commit | ac513a88a072b23452ca96a86f18ba8b9c0d85cd (patch) | |
tree | fdf0cd2b381d79cca121a2ec8c4ad55ae10016b4 /drivers/staging/rtl8192e | |
parent | 75bf74b90fd0c21b92d5e6153eb40388812e7096 (diff) |
staging: rtl8192e: Cleanup checkpatch -f warnings and errors - Part I
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/rtl8192e')
-rw-r--r-- | drivers/staging/rtl8192e/r8190P_def.h | 72 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/r8190P_rtl8256.c | 186 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/r8190P_rtl8256.h | 11 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/r8192E_cmdpkt.c | 196 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/r8192E_cmdpkt.h | 45 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/r8192E_dev.c | 20 |
6 files changed, 278 insertions, 252 deletions
diff --git a/drivers/staging/rtl8192e/r8190P_def.h b/drivers/staging/rtl8192e/r8190P_def.h index 2355766bb32c..b7bb71fa9ecd 100644 --- a/drivers/staging/rtl8192e/r8190P_def.h +++ b/drivers/staging/rtl8192e/r8190P_def.h @@ -39,7 +39,7 @@ enum rtl819x_loopback { #define RESET_DELAY_8185 20 -#define RT_IBSS_INT_MASKS (IMR_BcnInt | IMR_BcnInt | IMR_TBDOK | IMR_TBDER) +#define RT_IBSS_INT_MASKS (IMR_BcnInt | IMR_BcnInt | IMR_TBDOK | IMR_TBDER) #define DESC90_RATE1M 0x00 #define DESC90_RATE2M 0x01 @@ -85,7 +85,7 @@ enum rtl819x_loopback { #define BT_QA_BOARD 1 #define BT_FPGA 2 -#define Rx_Smooth_Factor 20 +#define RX_SMOOTH 20 #define QSLT_BK 0x1 #define QSLT_BE 0x0 @@ -130,7 +130,7 @@ enum rtl819x_loopback { enum version_8190_loopback { - VERSION_8190_BD=0x3, + VERSION_8190_BD = 0x3, VERSION_8190_BE }; @@ -139,9 +139,9 @@ enum version_8190_loopback { #define IC_VersionCut_E 0x4 enum rf_optype { - RF_OP_By_SW_3wire = 0, - RF_OP_By_FW, - RF_OP_MAX + RF_OP_By_SW_3wire = 0, + RF_OP_By_FW, + RF_OP_MAX }; @@ -303,41 +303,41 @@ struct phy_sts_cck_819xpci { #define PHY_Beacon_RSSI_SLID_WIN_MAX 10 struct tx_desc { - u16 PktSize; - u8 Offset; - u8 Reserved1:3; - u8 CmdInit:1; - u8 LastSeg:1; - u8 FirstSeg:1; - u8 LINIP:1; - u8 OWN:1; - - u8 TxFWInfoSize; - u8 RATid:3; - u8 DISFB:1; - u8 USERATE:1; - u8 MOREFRAG:1; - u8 NoEnc:1; - u8 PIFS:1; - u8 QueueSelect:5; - u8 NoACM:1; - u8 Resv:2; - u8 SecCAMID:5; - u8 SecDescAssign:1; - u8 SecType:2; - - u16 TxBufferSize; - u8 PktId:7; - u8 Resv1:1; - u8 Reserved2; + u16 PktSize; + u8 Offset; + u8 Reserved1:3; + u8 CmdInit:1; + u8 LastSeg:1; + u8 FirstSeg:1; + u8 LINIP:1; + u8 OWN:1; + + u8 TxFWInfoSize; + u8 RATid:3; + u8 DISFB:1; + u8 USERATE:1; + u8 MOREFRAG:1; + u8 NoEnc:1; + u8 PIFS:1; + u8 QueueSelect:5; + u8 NoACM:1; + u8 Resv:2; + u8 SecCAMID:5; + u8 SecDescAssign:1; + u8 SecType:2; + + u16 TxBufferSize; + u8 PktId:7; + u8 Resv1:1; + u8 Reserved2; u32 TxBuffAddr; u32 NextDescAddress; - u32 Reserved5; - u32 Reserved6; - u32 Reserved7; + u32 Reserved5; + u32 Reserved6; + u32 Reserved7; }; diff --git a/drivers/staging/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/r8190P_rtl8256.c index e8bef59a7984..0da56c80f088 100644 --- a/drivers/staging/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/r8190P_rtl8256.c @@ -22,41 +22,59 @@ #include "r8192E_phy.h" #include "r8190P_rtl8256.h" -void PHY_SetRF8256Bandwidth(struct net_device* dev , enum ht_channel_width Bandwidth) +void PHY_SetRF8256Bandwidth(struct net_device *dev, + enum ht_channel_width Bandwidth) { u8 eRFPath; struct r8192_priv *priv = rtllib_priv(dev); - for (eRFPath = 0; eRFPath <priv->NumTotalRFPath; eRFPath++) { + for (eRFPath = 0; eRFPath < priv->NumTotalRFPath; eRFPath++) { if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath)) continue; switch (Bandwidth) { case HT_CHANNEL_WIDTH_20: - if (priv->card_8192_version == VERSION_8190_BD || priv->card_8192_version == VERSION_8190_BE) { - rtl8192_phy_SetRFReg(dev, (enum rf90_radio_path)eRFPath, 0x0b, bMask12Bits, 0x100); - rtl8192_phy_SetRFReg(dev, (enum rf90_radio_path)eRFPath, 0x2c, bMask12Bits, 0x3d7); - rtl8192_phy_SetRFReg(dev, (enum rf90_radio_path)eRFPath, 0x0e, bMask12Bits, 0x021); + if (priv->card_8192_version == VERSION_8190_BD || + priv->card_8192_version == VERSION_8190_BE) { + rtl8192_phy_SetRFReg(dev, + (enum rf90_radio_path)eRFPath, + 0x0b, bMask12Bits, 0x100); + rtl8192_phy_SetRFReg(dev, + (enum rf90_radio_path)eRFPath, + 0x2c, bMask12Bits, 0x3d7); + rtl8192_phy_SetRFReg(dev, + (enum rf90_radio_path)eRFPath, + 0x0e, bMask12Bits, 0x021); } else { - RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): unknown hardware version\n"); + RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): " + "unknown hardware version\n"); } break; case HT_CHANNEL_WIDTH_20_40: - if (priv->card_8192_version == VERSION_8190_BD ||priv->card_8192_version == VERSION_8190_BE) { - rtl8192_phy_SetRFReg(dev, (enum rf90_radio_path)eRFPath, 0x0b, bMask12Bits, 0x300); - rtl8192_phy_SetRFReg(dev, (enum rf90_radio_path)eRFPath, 0x2c, bMask12Bits, 0x3ff); - rtl8192_phy_SetRFReg(dev, (enum rf90_radio_path)eRFPath, 0x0e, bMask12Bits, 0x0e1); + if (priv->card_8192_version == VERSION_8190_BD || + priv->card_8192_version == VERSION_8190_BE) { + rtl8192_phy_SetRFReg(dev, + (enum rf90_radio_path)eRFPath, + 0x0b, bMask12Bits, 0x300); + rtl8192_phy_SetRFReg(dev, + (enum rf90_radio_path)eRFPath, + 0x2c, bMask12Bits, 0x3ff); + rtl8192_phy_SetRFReg(dev, + (enum rf90_radio_path)eRFPath, + 0x0e, bMask12Bits, 0x0e1); } else { - RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): unknown hardware version\n"); + RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): " + "unknown hardware version\n"); } break; default: - RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): unknown Bandwidth: %#X\n",Bandwidth ); + RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): unknown " + "Bandwidth: %#X\n", Bandwidth); break; } @@ -64,7 +82,7 @@ void PHY_SetRF8256Bandwidth(struct net_device* dev , enum ht_channel_width Bandw return; } -bool PHY_RF8256_Config(struct net_device* dev) +bool PHY_RF8256_Config(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); bool rtStatus = true; @@ -74,7 +92,7 @@ bool PHY_RF8256_Config(struct net_device* dev) return rtStatus; } -bool phy_RF8256_Config_ParaFile(struct net_device* dev) +bool phy_RF8256_Config_ParaFile(struct net_device *dev) { u32 u4RegValue = 0; u8 eRFPath; @@ -87,7 +105,8 @@ bool phy_RF8256_Config_ParaFile(struct net_device* dev) u8 ConstRetryTimes = 5, RetryTimes = 5; u8 ret = 0; - for (eRFPath = (enum rf90_radio_path)RF90_PATH_A; eRFPath <priv->NumTotalRFPath; eRFPath++) { + for (eRFPath = (enum rf90_radio_path)RF90_PATH_A; + eRFPath < priv->NumTotalRFPath; eRFPath++) { if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath)) continue; @@ -97,11 +116,13 @@ bool phy_RF8256_Config_ParaFile(struct net_device* dev) switch (eRFPath) { case RF90_PATH_A: case RF90_PATH_C: - u4RegValue = rtl8192_QueryBBReg(dev, pPhyReg->rfintfs, bRFSI_RFENV); + u4RegValue = rtl8192_QueryBBReg(dev, pPhyReg->rfintfs, + bRFSI_RFENV); break; - case RF90_PATH_B : + case RF90_PATH_B: case RF90_PATH_D: - u4RegValue = rtl8192_QueryBBReg(dev, pPhyReg->rfintfs, bRFSI_RFENV<<16); + u4RegValue = rtl8192_QueryBBReg(dev, pPhyReg->rfintfs, + bRFSI_RFENV<<16); break; } @@ -109,14 +130,19 @@ bool phy_RF8256_Config_ParaFile(struct net_device* dev) rtl8192_setBBreg(dev, pPhyReg->rfintfo, bRFSI_RFENV, 0x1); - rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, b3WireAddressLength, 0x0); - rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, b3WireDataLength, 0x0); + rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, + b3WireAddressLength, 0x0); + rtl8192_setBBreg(dev, pPhyReg->rfHSSIPara2, + b3WireDataLength, 0x0); - rtl8192_phy_SetRFReg(dev, (enum rf90_radio_path) eRFPath, 0x0, bMask12Bits, 0xbf); + rtl8192_phy_SetRFReg(dev, (enum rf90_radio_path) eRFPath, 0x0, + bMask12Bits, 0xbf); - rtStatus = rtl8192_phy_checkBBAndRF(dev, HW90_BLOCK_RF, (enum rf90_radio_path)eRFPath); - if (rtStatus!= true) { - RT_TRACE(COMP_ERR, "PHY_RF8256_Config():Check Radio[%d] Fail!!\n", eRFPath); + rtStatus = rtl8192_phy_checkBBAndRF(dev, HW90_BLOCK_RF, + (enum rf90_radio_path)eRFPath); + if (rtStatus != true) { + RT_TRACE(COMP_ERR, "PHY_RF8256_Config():Check " + "Radio[%d] Fail!!\n", eRFPath); goto phy_RF8256_Config_ParaFile_Fail; } @@ -124,34 +150,61 @@ bool phy_RF8256_Config_ParaFile(struct net_device* dev) RF3_Final_Value = 0; switch (eRFPath) { case RF90_PATH_A: - while (RF3_Final_Value!=RegValueToBeCheck && RetryTimes != 0) { - ret = rtl8192_phy_ConfigRFWithHeaderFile(dev,(enum rf90_radio_path)eRFPath); - RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); - RT_TRACE(COMP_RF, "RF %d %d register final value: %x\n", eRFPath, RegOffSetToBeCheck, RF3_Final_Value); + while (RF3_Final_Value != RegValueToBeCheck && + RetryTimes != 0) { + ret = rtl8192_phy_ConfigRFWithHeaderFile(dev, + (enum rf90_radio_path)eRFPath); + RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, + (enum rf90_radio_path)eRFPath, + RegOffSetToBeCheck, + bMask12Bits); + RT_TRACE(COMP_RF, "RF %d %d register final " + "value: %x\n", eRFPath, + RegOffSetToBeCheck, RF3_Final_Value); RetryTimes--; } break; case RF90_PATH_B: - while (RF3_Final_Value!=RegValueToBeCheck && RetryTimes != 0) { - ret = rtl8192_phy_ConfigRFWithHeaderFile(dev,(enum rf90_radio_path)eRFPath); - RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); - RT_TRACE(COMP_RF, "RF %d %d register final value: %x\n", eRFPath, RegOffSetToBeCheck, RF3_Final_Value); + while (RF3_Final_Value != RegValueToBeCheck && + RetryTimes != 0) { + ret = rtl8192_phy_ConfigRFWithHeaderFile(dev, + (enum rf90_radio_path)eRFPath); + RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, + (enum rf90_radio_path)eRFPath, + RegOffSetToBeCheck, + bMask12Bits); + RT_TRACE(COMP_RF, "RF %d %d register final " + "value: %x\n", eRFPath, + RegOffSetToBeCheck, RF3_Final_Value); RetryTimes--; } break; case RF90_PATH_C: - while (RF3_Final_Value!=RegValueToBeCheck && RetryTimes != 0) { - ret = rtl8192_phy_ConfigRFWithHeaderFile(dev,(enum rf90_radio_path)eRFPath); - RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); - RT_TRACE(COMP_RF, "RF %d %d register final value: %x\n", eRFPath, RegOffSetToBeCheck, RF3_Final_Value); + while (RF3_Final_Value != RegValueToBeCheck && + RetryTimes != 0) { + ret = rtl8192_phy_ConfigRFWithHeaderFile(dev, + (enum rf90_radio_path)eRFPath); + RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, + (enum rf90_radio_path)eRFPath, + RegOffSetToBeCheck, + bMask12Bits); + RT_TRACE(COMP_RF, "RF %d %d register final " + "value: %x\n", eRFPath, + RegOffSetToBeCheck, RF3_Final_Value); RetryTimes--; } break; case RF90_PATH_D: - while (RF3_Final_Value!=RegValueToBeCheck && RetryTimes != 0) { - ret = rtl8192_phy_ConfigRFWithHeaderFile(dev,(enum rf90_radio_path)eRFPath); - RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (enum rf90_radio_path)eRFPath, RegOffSetToBeCheck, bMask12Bits); - RT_TRACE(COMP_RF, "RF %d %d register final value: %x\n", eRFPath, RegOffSetToBeCheck, RF3_Final_Value); + while (RF3_Final_Value != RegValueToBeCheck && + RetryTimes != 0) { + ret = rtl8192_phy_ConfigRFWithHeaderFile(dev, + (enum rf90_radio_path)eRFPath); + RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, + (enum rf90_radio_path)eRFPath, + RegOffSetToBeCheck, bMask12Bits); + RT_TRACE(COMP_RF, "RF %d %d register final " + "value: %x\n", eRFPath, + RegOffSetToBeCheck, RF3_Final_Value); RetryTimes--; } break; @@ -160,16 +213,19 @@ bool phy_RF8256_Config_ParaFile(struct net_device* dev) switch (eRFPath) { case RF90_PATH_A: case RF90_PATH_C: - rtl8192_setBBreg(dev, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue); + rtl8192_setBBreg(dev, pPhyReg->rfintfs, bRFSI_RFENV, + u4RegValue); break; - case RF90_PATH_B : + case RF90_PATH_B: case RF90_PATH_D: - rtl8192_setBBreg(dev, pPhyReg->rfintfs, bRFSI_RFENV<<16, u4RegValue); + rtl8192_setBBreg(dev, pPhyReg->rfintfs, bRFSI_RFENV<<16, + u4RegValue); break; } if (ret) { - RT_TRACE(COMP_ERR, "phy_RF8256_Config_ParaFile():Radio[%d] Fail!!", eRFPath); + RT_TRACE(COMP_ERR, "phy_RF8256_Config_ParaFile():" + "Radio[%d] Fail!!", eRFPath); goto phy_RF8256_Config_ParaFile_Fail; } @@ -183,18 +239,17 @@ phy_RF8256_Config_ParaFile_Fail: return false; } -void PHY_SetRF8256CCKTxPower(struct net_device* dev, u8 powerlevel) +void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel) { - u32 TxAGC=0; + u32 TxAGC = 0; struct r8192_priv *priv = rtllib_priv(dev); TxAGC = powerlevel; - if (priv->bDynamicTxLowPower == true) - { + if (priv->bDynamicTxLowPower == true) { if (priv->CustomerID == RT_CID_819x_Netcore) - TxAGC = 0x22; - else - TxAGC += priv->CckPwEnl; + TxAGC = 0x22; + else + TxAGC += priv->CckPwEnl; } if (TxAGC > 0x24) TxAGC = 0x24; @@ -202,7 +257,7 @@ void PHY_SetRF8256CCKTxPower(struct net_device* dev, u8 powerlevel) } -void PHY_SetRF8256OFDMTxPower(struct net_device* dev, u8 powerlevel) +void PHY_SetRF8256OFDMTxPower(struct net_device *dev, u8 powerlevel) { struct r8192_priv *priv = rtllib_priv(dev); u32 writeVal, powerBase0, powerBase1, writeVal_tmp; @@ -211,13 +266,15 @@ void PHY_SetRF8256OFDMTxPower(struct net_device* dev, u8 powerlevel) u8 byte0, byte1, byte2, byte3; powerBase0 = powerlevel + priv->LegacyHTTxPowerDiff; - powerBase0 = (powerBase0<<24) | (powerBase0<<16) |(powerBase0<<8) |powerBase0; + powerBase0 = (powerBase0 << 24) | (powerBase0 << 16) | + (powerBase0 << 8) | powerBase0; powerBase1 = powerlevel; - powerBase1 = (powerBase1<<24) | (powerBase1<<16) |(powerBase1<<8) |powerBase1; + powerBase1 = (powerBase1 << 24) | (powerBase1 << 16) | + (powerBase1 << 8) | powerBase1; - for (index=0; index<6; index++) - { - writeVal = (u32)(priv->MCSTxPowerLevelOriginalOffset[index] + ((index<2)?powerBase0:powerBase1)); + for (index = 0; index < 6; index++) { + writeVal = (u32)(priv->MCSTxPowerLevelOriginalOffset[index] + + ((index < 2) ? powerBase0 : powerBase1)); byte0 = (u8)(writeVal & 0x7f); byte1 = (u8)((writeVal & 0x7f00)>>8); byte2 = (u8)((writeVal & 0x7f0000)>>16); @@ -231,20 +288,17 @@ void PHY_SetRF8256OFDMTxPower(struct net_device* dev, u8 powerlevel) if (byte3 > 0x24) byte3 = 0x24; - if (index == 3) - { - writeVal_tmp = (byte3<<24) | (byte2<<16) |(byte1<<8) |byte0; + if (index == 3) { + writeVal_tmp = (byte3 << 24) | (byte2 << 16) | + (byte1 << 8) | byte0; priv->Pwr_Track = writeVal_tmp; } if (priv->bDynamicTxHighPower == true) - { writeVal = 0x03030303; - } else - { - writeVal = (byte3<<24) | (byte2<<16) |(byte1<<8) |byte0; - } + writeVal = (byte3 << 24) | (byte2 << 16) | + (byte1 << 8) | byte0; rtl8192_setBBreg(dev, RegOffset[index], 0x7f7f7f7f, writeVal); } diff --git a/drivers/staging/rtl8192e/r8190P_rtl8256.h b/drivers/staging/rtl8192e/r8190P_rtl8256.h index 00fe5a1bb7ec..64e831d2f4e5 100644 --- a/drivers/staging/rtl8192e/r8190P_rtl8256.h +++ b/drivers/staging/rtl8192e/r8190P_rtl8256.h @@ -21,10 +21,11 @@ #define RTL8225H #define RTL819X_TOTAL_RF_PATH 2 -extern void PHY_SetRF8256Bandwidth(struct net_device* dev , enum ht_channel_width Bandwidth); -extern bool PHY_RF8256_Config(struct net_device* dev); -extern bool phy_RF8256_Config_ParaFile(struct net_device* dev); -extern void PHY_SetRF8256CCKTxPower(struct net_device* dev, u8 powerlevel); -extern void PHY_SetRF8256OFDMTxPower(struct net_device* dev, u8 powerlevel); +extern void PHY_SetRF8256Bandwidth(struct net_device *dev, + enum ht_channel_width Bandwidth); +extern bool PHY_RF8256_Config(struct net_device *dev); +extern bool phy_RF8256_Config_ParaFile(struct net_device *dev); +extern void PHY_SetRF8256CCKTxPower(struct net_device *dev, u8 powerlevel); +extern void PHY_SetRF8256OFDMTxPower(struct net_device *dev, u8 powerlevel); #endif diff --git a/drivers/staging/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/r8192E_cmdpkt.c index edca4d55f582..881eb1f96d2c 100644 --- a/drivers/staging/rtl8192e/r8192E_cmdpkt.c +++ b/drivers/staging/rtl8192e/r8192E_cmdpkt.c @@ -29,14 +29,14 @@ u32 temp[10];\ \ memcpy(temp, Address, 40);\ - for (i = 0; i <40; i+=4)\ - printk("\r\n %08x", temp[i]);\ -}\ + for (i = 0; i < 40; i += 4)\ + printk(KERN_INFO "\r\n %08x", temp[i]);\ +} /*---------------------------Define functions---------------------------------*/ - extern bool cmpk_message_handle_tx( +extern bool cmpk_message_handle_tx( struct net_device *dev, - u8* code_virtual_address, + u8 *code_virtual_address, u32 packettype, u32 buffer_len) { @@ -53,7 +53,7 @@ struct tx_fwinfo_8190pci *pTxFwInfo = NULL; - RT_TRACE(COMP_CMDPKT,"%s(),buffer_len is %d\n",__func__,buffer_len); + RT_TRACE(COMP_CMDPKT, "%s(),buffer_len is %d\n", __func__, buffer_len); firmware_init_param(dev); frag_threshold = pfirmware->cmdpacket_frag_thresold; @@ -63,18 +63,19 @@ bLastIniPkt = 0; } else { - frag_length =(u16)(buffer_len - frag_offset); + frag_length = (u16)(buffer_len - frag_offset); bLastIniPkt = 1; } - skb = dev_alloc_skb(frag_length + priv->rtllib->tx_headroom + 4); + skb = dev_alloc_skb(frag_length + + priv->rtllib->tx_headroom + 4); if (skb == NULL) { rt_status = false; goto Failed; } - memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); + memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tcb_desc->queue_index = TXCMD_QUEUE; tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_NORMAL; @@ -83,18 +84,18 @@ seg_ptr = skb_put(skb, priv->rtllib->tx_headroom); pTxFwInfo = (struct tx_fwinfo_8190pci *)seg_ptr; - memset(pTxFwInfo,0,sizeof(struct tx_fwinfo_8190pci)); - memset(pTxFwInfo,0x12,8); + memset(pTxFwInfo, 0, sizeof(struct tx_fwinfo_8190pci)); + memset(pTxFwInfo, 0x12, 8); seg_ptr = skb_put(skb, frag_length); memcpy(seg_ptr, code_virtual_address, (u32)frag_length); - priv->rtllib->softmac_hard_start_xmit(skb,dev); + priv->rtllib->softmac_hard_start_xmit(skb, dev); code_virtual_address += frag_length; frag_offset += frag_length; - }while(frag_offset < buffer_len); + } while (frag_offset < buffer_len); write_nic_byte(dev, TPPoll, TPPoll_CQ); Failed: @@ -110,7 +111,8 @@ cmpk_count_txstatistic( #ifdef ENABLE_PS enum rt_rf_power_state rtState; - pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState)); + pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE, + (pu1Byte)(&rtState)); if (rtState == eRfOff) return; @@ -152,10 +154,7 @@ cmpk_count_txstatistic( -static void -cmpk_handle_tx_feedback( - struct net_device *dev, - u8 * pmsg) +static void cmpk_handle_tx_feedback(struct net_device *dev, u8 *pmsg) { struct r8192_priv *priv = rtllib_priv(dev); struct cmpk_txfb rx_tx_fb; /* */ @@ -163,41 +162,30 @@ cmpk_handle_tx_feedback( priv->stats.txfeedback++; - memcpy((u8*)&rx_tx_fb, pmsg, sizeof(struct cmpk_txfb)); + memcpy((u8 *)&rx_tx_fb, pmsg, sizeof(struct cmpk_txfb)); cmpk_count_txstatistic(dev, &rx_tx_fb); } /* cmpk_Handle_Tx_Feedback */ -void -cmdpkt_beacontimerinterrupt_819xusb( - struct net_device *dev -) +void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev) { struct r8192_priv *priv = rtllib_priv(dev); u16 tx_rate; - { - if ((priv->rtllib->current_network.mode == IEEE_A) || - (priv->rtllib->current_network.mode == IEEE_N_5G) || - ((priv->rtllib->current_network.mode == IEEE_N_24G) && (!priv->rtllib->pHTInfo->bCurSuppCCK))) - { - tx_rate = 60; - DMESG("send beacon frame tx rate is 6Mbpm\n"); - } - else - { - tx_rate =10; - DMESG("send beacon frame tx rate is 1Mbpm\n"); - } - + if ((priv->rtllib->current_network.mode == IEEE_A) || + (priv->rtllib->current_network.mode == IEEE_N_5G) || + ((priv->rtllib->current_network.mode == IEEE_N_24G) && + (!priv->rtllib->pHTInfo->bCurSuppCCK))) { + tx_rate = 60; + DMESG("send beacon frame tx rate is 6Mbpm\n"); + } else { + tx_rate = 10; + DMESG("send beacon frame tx rate is 1Mbpm\n"); } } -static void -cmpk_handle_interrupt_status( - struct net_device *dev, - u8* pmsg) +static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg) { struct cmpk_intr_sta rx_intr_status; /* */ struct r8192_priv *priv = rtllib_priv(dev); @@ -206,67 +194,55 @@ cmpk_handle_interrupt_status( rx_intr_status.length = pmsg[1]; - if (rx_intr_status.length != (sizeof(struct cmpk_intr_sta) - 2)) - { + if (rx_intr_status.length != (sizeof(struct cmpk_intr_sta) - 2)) { DMESG("cmpk_Handle_Interrupt_Status: wrong length!\n"); return; } - if ( priv->rtllib->iw_mode == IW_MODE_ADHOC) - { + if (priv->rtllib->iw_mode == IW_MODE_ADHOC) { rx_intr_status.interrupt_status = *((u32 *)(pmsg + 4)); - DMESG("interrupt status = 0x%x\n", rx_intr_status.interrupt_status); + DMESG("interrupt status = 0x%x\n", + rx_intr_status.interrupt_status); - if (rx_intr_status.interrupt_status & ISR_TxBcnOk) - { + if (rx_intr_status.interrupt_status & ISR_TxBcnOk) { priv->rtllib->bibsscoordinator = true; priv->stats.txbeaconokint++; - } - else if (rx_intr_status.interrupt_status & ISR_TxBcnErr) - { + } else if (rx_intr_status.interrupt_status & ISR_TxBcnErr) { priv->rtllib->bibsscoordinator = false; priv->stats.txbeaconerr++; } if (rx_intr_status.interrupt_status & ISR_BcnTimerIntr) - { cmdpkt_beacontimerinterrupt_819xusb(dev); - } - } - - DMESG("<---- cmpk_handle_interrupt_status()\n"); } /* cmpk_handle_interrupt_status */ -static void -cmpk_handle_query_config_rx( - struct net_device *dev, - u8* pmsg) +static void cmpk_handle_query_config_rx(struct net_device *dev, u8 *pmsg) { cmpk_query_cfg_t rx_query_cfg; /* */ - rx_query_cfg.cfg_action = (pmsg[4] & 0x80000000)>>31; - rx_query_cfg.cfg_type = (pmsg[4] & 0x60) >> 5; - rx_query_cfg.cfg_size = (pmsg[4] & 0x18) >> 3; - rx_query_cfg.cfg_page = (pmsg[6] & 0x0F) >> 0; - rx_query_cfg.cfg_offset = pmsg[7]; - rx_query_cfg.value = (pmsg[8] << 24) | (pmsg[9] << 16) | - (pmsg[10] << 8) | (pmsg[11] << 0); - rx_query_cfg.mask = (pmsg[12] << 24) | (pmsg[13] << 16) | - (pmsg[14] << 8) | (pmsg[15] << 0); + rx_query_cfg.cfg_action = (pmsg[4] & 0x80000000)>>31; + rx_query_cfg.cfg_type = (pmsg[4] & 0x60) >> 5; + rx_query_cfg.cfg_size = (pmsg[4] & 0x18) >> 3; + rx_query_cfg.cfg_page = (pmsg[6] & 0x0F) >> 0; + rx_query_cfg.cfg_offset = pmsg[7]; + rx_query_cfg.value = (pmsg[8] << 24) | (pmsg[9] << 16) | + (pmsg[10] << 8) | (pmsg[11] << 0); + rx_query_cfg.mask = (pmsg[12] << 24) | (pmsg[13] << 16) | + (pmsg[14] << 8) | (pmsg[15] << 0); } /* cmpk_Handle_Query_Config_Rx */ -static void cmpk_count_tx_status( struct net_device *dev, - struct cmpk_tx_status *pstx_status) +static void cmpk_count_tx_status(struct net_device *dev, + struct cmpk_tx_status *pstx_status) { struct r8192_priv *priv = rtllib_priv(dev); @@ -274,12 +250,11 @@ static void cmpk_count_tx_status( struct net_device *dev, enum rt_rf_power_state rtstate; - pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState)); + pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE, + (pu1Byte)(&rtState)); if (rtState == eRfOff) - { return; - } #endif priv->stats.txfeedbackok += pstx_status->txok; @@ -309,68 +284,56 @@ static void cmpk_count_tx_status( struct net_device *dev, -static void -cmpk_handle_tx_status( - struct net_device *dev, - u8* pmsg) +static void cmpk_handle_tx_status(struct net_device *dev, u8 *pmsg) { struct cmpk_tx_status rx_tx_sts; /* */ - memcpy((void*)&rx_tx_sts, (void*)pmsg, sizeof(struct cmpk_tx_status)); + memcpy((void *)&rx_tx_sts, (void *)pmsg, sizeof(struct cmpk_tx_status)); cmpk_count_tx_status(dev, &rx_tx_sts); - } - -static void -cmpk_handle_tx_rate_history( - struct net_device *dev, - u8* pmsg) +static void cmpk_handle_tx_rate_history(struct net_device *dev, u8 *pmsg) { struct cmpk_tx_rahis *ptxrate; - u8 i, j; + u8 i, j; u16 length = sizeof(struct cmpk_tx_rahis); - u32 *ptemp; + u32 *ptemp; struct r8192_priv *priv = rtllib_priv(dev); #ifdef ENABLE_PS - pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState)); + pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE, + (pu1Byte)(&rtState)); if (rtState == eRfOff) - { return; - } #endif ptemp = (u32 *)pmsg; - for (i = 0; i < (length/4); i++) - { + for (i = 0; i < (length / 4); i++) { u16 temp1, temp2; - temp1 = ptemp[i]&0x0000FFFF; - temp2 = ptemp[i]>>16; - ptemp[i] = (temp1<<16)|temp2; + temp1 = ptemp[i] & 0x0000FFFF; + temp2 = ptemp[i] >> 16; + ptemp[i] = (temp1 << 16) | temp2; } ptxrate = (struct cmpk_tx_rahis *)pmsg; - if (ptxrate == NULL ) - { + if (ptxrate == NULL) return; - } - for (i = 0; i < 16; i++) - { + for (i = 0; i < 16; i++) { if (i < 4) priv->stats.txrate.cck[i] += ptxrate->cck[i]; - if (i< 8) + if (i < 8) priv->stats.txrate.ofdm[i] += ptxrate->ofdm[i]; for (j = 0; j < 4; j++) - priv->stats.txrate.ht_mcs[j][i] += ptxrate->ht_mcs[j][i]; + priv->stats.txrate.ht_mcs[j][i] += + ptxrate->ht_mcs[j][i]; } } @@ -389,8 +352,7 @@ cmpk_message_handle_rx( RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx()\n"); - if (/*(prfd->queue_id != CMPK_RX_QUEUE_ID) || */(pstats== NULL)) - { + if (pstats == NULL) { /* Print error message. */ /*RT_TRACE(COMP_SEND, DebugLevel, ("\n\r[CMPK]-->Err queue id or pointer"));*/ @@ -403,43 +365,49 @@ cmpk_message_handle_rx( element_id = pcmd_buff[0]; - while (total_length > 0 || exe_cnt++ >100) - { + while (total_length > 0 || exe_cnt++ > 100) { element_id = pcmd_buff[0]; switch (element_id) { case RX_TX_FEEDBACK: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():RX_TX_FEEDBACK\n"); - cmpk_handle_tx_feedback (dev, pcmd_buff); + RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" + "RX_TX_FEEDBACK\n"); + cmpk_handle_tx_feedback(dev, pcmd_buff); cmd_length = CMPK_RX_TX_FB_SIZE; break; case RX_INTERRUPT_STATUS: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():RX_INTERRUPT_STATUS\n"); + RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" + "RX_INTERRUPT_STATUS\n"); cmpk_handle_interrupt_status(dev, pcmd_buff); cmd_length = sizeof(struct cmpk_intr_sta); break; case BOTH_QUERY_CONFIG: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():BOTH_QUERY_CONFIG\n"); + RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" + "BOTH_QUERY_CONFIG\n"); cmpk_handle_query_config_rx(dev, pcmd_buff); cmd_length = CMPK_BOTH_QUERY_CONFIG_SIZE; break; case RX_TX_STATUS: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():RX_TX_STATUS\n"); + RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" + "RX_TX_STATUS\n"); cmpk_handle_tx_status(dev, pcmd_buff); cmd_length = CMPK_RX_TX_STS_SIZE; break; case RX_TX_PER_PKT_FEEDBACK: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():RX_TX_PER_PKT_FEEDBACK\n"); + RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" + "RX_TX_PER_PKT_FEEDBACK\n"); cmd_length = CMPK_RX_TX_FB_SIZE; break; case RX_TX_RATE_HISTORY: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():RX_TX_HISTORY\n"); + RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" + "RX_TX_HISTORY\n"); cmpk_handle_tx_rate_history(dev, pcmd_buff); cmd_length = CMPK_TX_RAHIS_SIZE; break; default: - RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():unknow CMD Element\n"); + RT_TRACE(COMP_CMDPKT, "---->cmpk_message_handle_rx():" + "unknow CMD Element\n"); return 1; } diff --git a/drivers/staging/rtl8192e/r8192E_cmdpkt.h b/drivers/staging/rtl8192e/r8192E_cmdpkt.h index b55d075d6cdf..23219e17e5a1 100644 --- a/drivers/staging/rtl8192e/r8192E_cmdpkt.h +++ b/drivers/staging/rtl8192e/r8192E_cmdpkt.h @@ -18,16 +18,16 @@ ******************************************************************************/ #ifndef R819XUSB_CMDPKT_H #define R819XUSB_CMDPKT_H -#define CMPK_RX_TX_FB_SIZE sizeof(struct cmpk_txfb) -#define CMPK_TX_SET_CONFIG_SIZE sizeof(struct cmpk_set_cfg) -#define CMPK_BOTH_QUERY_CONFIG_SIZE sizeof(struct cmpk_set_cfg) -#define CMPK_RX_TX_STS_SIZE sizeof(struct cmpk_tx_status) -#define CMPK_RX_DBG_MSG_SIZE sizeof(struct cmpk_rx_dbginfo) -#define CMPK_TX_RAHIS_SIZE sizeof(struct cmpk_tx_rahis) +#define CMPK_RX_TX_FB_SIZE sizeof(struct cmpk_txfb) +#define CMPK_TX_SET_CONFIG_SIZE sizeof(struct cmpk_set_cfg) +#define CMPK_BOTH_QUERY_CONFIG_SIZE sizeof(struct cmpk_set_cfg) +#define CMPK_RX_TX_STS_SIZE sizeof(struct cmpk_tx_status) +#define CMPK_RX_DBG_MSG_SIZE sizeof(struct cmpk_rx_dbginfo) +#define CMPK_TX_RAHIS_SIZE sizeof(struct cmpk_tx_rahis) -#define ISR_TxBcnOk BIT27 -#define ISR_TxBcnErr BIT26 -#define ISR_BcnTimerIntr BIT13 +#define ISR_TxBcnOk BIT27 +#define ISR_TxBcnErr BIT26 +#define ISR_BcnTimerIntr BIT13 struct cmpk_txfb { @@ -110,7 +110,7 @@ struct cmpk_tx_status { u16 reserve3_23; u8 reserve3_1; u8 rate; -}__packed; +} __packed; struct cmpk_rx_dbginfo { u16 reserve1; @@ -138,19 +138,22 @@ struct cmpk_tx_rahis { } __packed; enum cmpk_element { - RX_TX_FEEDBACK = 0, - RX_INTERRUPT_STATUS = 1, - TX_SET_CONFIG = 2, - BOTH_QUERY_CONFIG = 3, - RX_TX_STATUS = 4, - RX_DBGINFO_FEEDBACK = 5, - RX_TX_PER_PKT_FEEDBACK = 6, - RX_TX_RATE_HISTORY = 7, - RX_CMD_ELE_MAX + RX_TX_FEEDBACK = 0, + RX_INTERRUPT_STATUS = 1, + TX_SET_CONFIG = 2, + BOTH_QUERY_CONFIG = 3, + RX_TX_STATUS = 4, + RX_DBGINFO_FEEDBACK = 5, + RX_TX_PER_PKT_FEEDBACK = 6, + RX_TX_RATE_HISTORY = 7, + RX_CMD_ELE_MAX }; -extern u32 cmpk_message_handle_rx(struct net_device *dev, struct rtllib_rx_stats * pstats); -extern bool cmpk_message_handle_tx(struct net_device *dev, u8* codevirtualaddress, u32 packettype, u32 buffer_len); +extern u32 cmpk_message_handle_rx(struct net_device *dev, + struct rtllib_rx_stats *pstats); +extern bool cmpk_message_handle_tx(struct net_device *dev, + u8 *codevirtualaddress, u32 packettype, + u32 buffer_len); #endif diff --git a/drivers/staging/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/r8192E_dev.c index 453481959ff3..aaba5586dbef 100644 --- a/drivers/staging/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/r8192E_dev.c @@ -1662,15 +1662,15 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv, u8 *buffer,struct rtllib_ if (pprevious_stats->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath]) { priv->stats.rx_rssi_percentage[rfpath] = - ( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) + - (pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor); + ( (priv->stats.rx_rssi_percentage[rfpath]*(RX_SMOOTH-1)) + + (pprevious_stats->RxMIMOSignalStrength[rfpath])) /(RX_SMOOTH); priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] + 1; } else { priv->stats.rx_rssi_percentage[rfpath] = - ( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) + - (pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor); + ( (priv->stats.rx_rssi_percentage[rfpath]*(RX_SMOOTH-1)) + + (pprevious_stats->RxMIMOSignalStrength[rfpath])) /(RX_SMOOTH); } RT_TRACE(COMP_DBG,"Jacken -> priv->RxStats.RxRSSIPercentage[rfPath] = %d \n" ,priv->stats.rx_rssi_percentage[rfpath] ); } @@ -1708,15 +1708,15 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv, u8 *buffer,struct rtllib_ if (pprevious_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb) { priv->undecorated_smoothed_pwdb = - ( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) + - (pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor); + ( ((priv->undecorated_smoothed_pwdb)*(RX_SMOOTH-1)) + + (pprevious_stats->RxPWDBAll)) /(RX_SMOOTH); priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1; } else { priv->undecorated_smoothed_pwdb = - ( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) + - (pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor); + ( ((priv->undecorated_smoothed_pwdb)*(RX_SMOOTH-1)) + + (pprevious_stats->RxPWDBAll)) /(RX_SMOOTH); } rtl819x_update_rxsignalstatistics8190pci(priv,pprevious_stats); } @@ -1755,8 +1755,8 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv, u8 *buffer,struct rtllib_ priv->stats.rx_evm_percentage[nspatial_stream] = pprevious_stats->RxMIMOSignalQuality[nspatial_stream]; } priv->stats.rx_evm_percentage[nspatial_stream] = - ( (priv->stats.rx_evm_percentage[nspatial_stream]* (Rx_Smooth_Factor-1)) + - (pprevious_stats->RxMIMOSignalQuality[nspatial_stream]* 1)) / (Rx_Smooth_Factor); + ( (priv->stats.rx_evm_percentage[nspatial_stream]* (RX_SMOOTH-1)) + + (pprevious_stats->RxMIMOSignalQuality[nspatial_stream]* 1)) / (RX_SMOOTH); } } } |