staging: rtl8192e: Cleanup checkpatch -f warnings and errors - Part VII

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Larry Finger
2011-08-25 11:48:19 -05:00
committed by Greg Kroah-Hartman
parent f88ec6cbc1
commit b6da7313e0
2 changed files with 132 additions and 203 deletions

View File

@@ -55,48 +55,40 @@ void EnableHWSecurityConfig8192(struct net_device *dev)
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
struct rtllib_device *ieee = priv->rtllib;
SECR_value = SCR_TxEncEnable | SCR_RxDecEnable;
if (((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || (KEY_TYPE_WEP104 == ieee->pairwise_key_type)) && (priv->rtllib->auth_mode != 2))
{
if (((KEY_TYPE_WEP40 == ieee->pairwise_key_type) ||
(KEY_TYPE_WEP104 == ieee->pairwise_key_type)) &&
(priv->rtllib->auth_mode != 2)) {
SECR_value |= SCR_RxUseDK;
SECR_value |= SCR_TxUseDK;
}
else if ((ieee->iw_mode == IW_MODE_ADHOC) && (ieee->pairwise_key_type & (KEY_TYPE_CCMP | KEY_TYPE_TKIP)))
{
} else if ((ieee->iw_mode == IW_MODE_ADHOC) &&
(ieee->pairwise_key_type & (KEY_TYPE_CCMP |
KEY_TYPE_TKIP))) {
SECR_value |= SCR_RxUseDK;
SECR_value |= SCR_TxUseDK;
}
ieee->hwsec_active = 1;
if ((ieee->pHTInfo->IOTAction&HT_IOT_ACT_PURE_N_MODE) || !hwwep)
{
if ((ieee->pHTInfo->IOTAction&HT_IOT_ACT_PURE_N_MODE) || !hwwep) {
ieee->hwsec_active = 0;
SECR_value &= ~SCR_RxDecEnable;
}
RT_TRACE(COMP_SEC,"%s:, hwsec:%d, pairwise_key:%d, SECR_value:%x\n", __func__, \
ieee->hwsec_active, ieee->pairwise_key_type, SECR_value);
{
RT_TRACE(COMP_SEC, "%s:, hwsec:%d, pairwise_key:%d, SECR_value:%x\n",
__func__, ieee->hwsec_active, ieee->pairwise_key_type,
SECR_value);
write_nic_byte(dev, SECR, SECR_value);
}
}
void set_swcam(struct net_device *dev,
u8 EntryNo,
u8 KeyIndex,
u16 KeyType,
u8 *MacAddr,
u8 DefaultKey,
u32 *KeyContent,
u8 is_mesh)
void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh)
{
struct r8192_priv *priv = rtllib_priv(dev);
struct rtllib_device *ieee = priv->rtllib;
RT_TRACE(COMP_DBG, "===========>%s():EntryNo is %d,KeyIndex is "
"%d,KeyType is %d,is_mesh is %d\n", __func__, EntryNo,
KeyIndex, KeyType, is_mesh);
if (is_mesh){
} else {
if (!is_mesh) {
ieee->swcamtable[EntryNo].bused = true;
ieee->swcamtable[EntryNo].key_index = KeyIndex;
ieee->swcamtable[EntryNo].key_type = KeyType;
@@ -106,13 +98,8 @@ void set_swcam(struct net_device *dev,
}
}
void setKey(struct net_device *dev,
u8 EntryNo,
u8 KeyIndex,
u16 KeyType,
u8 *MacAddr,
u8 DefaultKey,
u32 *KeyContent )
void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
u8 *MacAddr, u8 DefaultKey, u32 *KeyContent)
{
u32 TargetCommand = 0;
u32 TargetContent = 0;
@@ -123,15 +110,15 @@ void setKey(struct net_device *dev,
rtState = priv->rtllib->eRFPowerState;
if (priv->rtllib->PowerSaveControl.bInactivePs) {
if (rtState == eRfOff) {
if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS)
{
RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__func__);
if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) {
RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",
__func__);
return ;
}
else{
} else {
down(&priv->rtllib->ips_sem);
IPSLeave(dev);
up(&priv->rtllib->ips_sem); }
up(&priv->rtllib->ips_sem);
}
}
}
priv->rtllib->is_set_key = true;
@@ -168,7 +155,8 @@ void setKey(struct net_device *dev,
write_nic_dword(dev, RWCAM, TargetCommand);
} else {
if (KeyContent != NULL) {
write_nic_dword(dev, WCAMI, (u32)(*(KeyContent+i-2)) );
write_nic_dword(dev, WCAMI,
(u32)(*(KeyContent+i-2)));
write_nic_dword(dev, RWCAM, TargetCommand);
udelay(100);
}
@@ -184,27 +172,25 @@ void CAM_read_entry(struct net_device *dev, u32 iIndex)
u8 entry_i = 0;
u32 ulStatus;
s32 i = 100;
for (entry_i=0;entry_i<CAM_CONTENT_COUNT;entry_i++)
{
for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
target_command = entry_i+CAM_CONTENT_COUNT*iIndex;
target_command = target_command | BIT31;
while((i--)>=0)
{
while ((i--) >= 0) {
ulStatus = read_nic_dword(dev, RWCAM);
if (ulStatus & BIT31){
if (ulStatus & BIT31)
continue;
}
else{
else
break;
}
}
write_nic_dword(dev, RWCAM, target_command);
RT_TRACE(COMP_SEC,"CAM_read_entry(): WRITE A0: %x \n",target_command);
RT_TRACE(COMP_SEC, "CAM_read_entry(): WRITE A0: %x\n",
target_command);
target_content = read_nic_dword(dev, RCAMO);
RT_TRACE(COMP_SEC, "CAM_read_entry(): WRITE A8: %x \n",target_content);
RT_TRACE(COMP_SEC, "CAM_read_entry(): WRITE A8: %x\n",
target_content);
}
printk("\n");
printk(KERN_INFO "\n");
}
void CamRestoreAllEntry(struct net_device *dev)
@@ -217,158 +203,99 @@ void CamRestoreAllEntry( struct net_device *dev)
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x03}};
static u8 CAM_CONST_BROAD[] =
{0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
{0x00, 0x00, 0x00, 0x00, 0x00, 0x03}
};
static u8 CAM_CONST_BROAD[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
RT_TRACE(COMP_SEC, "CamRestoreAllEntry:\n");
if ((priv->rtllib->pairwise_key_type == KEY_TYPE_WEP40) ||
(priv->rtllib->pairwise_key_type == KEY_TYPE_WEP104))
{
(priv->rtllib->pairwise_key_type == KEY_TYPE_WEP104)) {
for (EntryId=0; EntryId<4; EntryId++)
{
{
for (EntryId = 0; EntryId < 4; EntryId++) {
MacAddr = CAM_CONST_ADDR[EntryId];
if (priv->rtllib->swcamtable[EntryId].bused )
{
setKey(dev,
EntryId ,
EntryId,
if (priv->rtllib->swcamtable[EntryId].bused) {
setKey(dev, EntryId , EntryId,
priv->rtllib->pairwise_key_type, MacAddr,
0, (u32 *)(&priv->rtllib->swcamtable
[EntryId].key_buf[0]));
}
}
} else if (priv->rtllib->pairwise_key_type == KEY_TYPE_TKIP) {
if (priv->rtllib->iw_mode == IW_MODE_ADHOC) {
setKey(dev, 4, 0, priv->rtllib->pairwise_key_type,
(u8 *)dev->dev_addr, 0,
(u32 *)(&priv->rtllib->swcamtable[4].key_buf[0]));
} else {
setKey(dev, 4, 0, priv->rtllib->pairwise_key_type,
MacAddr, 0,
(u32 *)(&priv->rtllib->swcamtable[4].key_buf[0]));
}
} else if (priv->rtllib->pairwise_key_type == KEY_TYPE_CCMP) {
if (priv->rtllib->iw_mode == IW_MODE_ADHOC) {
setKey(dev, 4, 0,
priv->rtllib->pairwise_key_type,
MacAddr,
0,
(u32*)(&priv->rtllib->swcamtable[EntryId].key_buf[0])
);
}
(u8 *)dev->dev_addr, 0,
(u32 *)(&priv->rtllib->swcamtable[4].
key_buf[0]));
} else {
setKey(dev, 4, 0,
priv->rtllib->pairwise_key_type, MacAddr,
0, (u32 *)(&priv->rtllib->swcamtable[4].
key_buf[0]));
}
}
}
else if (priv->rtllib->pairwise_key_type == KEY_TYPE_TKIP)
{
{
if (priv->rtllib->iw_mode == IW_MODE_ADHOC)
{
setKey(dev,
4,
0,
priv->rtllib->pairwise_key_type,
(u8*)dev->dev_addr,
0,
(u32*)(&priv->rtllib->swcamtable[4].key_buf[0])
);
}
else
{
setKey(dev,
4,
0,
priv->rtllib->pairwise_key_type,
MacAddr,
0,
(u32*)(&priv->rtllib->swcamtable[4].key_buf[0])
);
}
}
}
else if (priv->rtllib->pairwise_key_type == KEY_TYPE_CCMP)
{
{
if (priv->rtllib->iw_mode == IW_MODE_ADHOC)
{
setKey(dev,
4,
0,
priv->rtllib->pairwise_key_type,
(u8*)dev->dev_addr,
0,
(u32*)(&priv->rtllib->swcamtable[4].key_buf[0])
);
}
else
{
setKey(dev,
4,
0,
priv->rtllib->pairwise_key_type,
MacAddr,
0,
(u32*)(&priv->rtllib->swcamtable[4].key_buf[0])
);
}
}
}
if (priv->rtllib->group_key_type == KEY_TYPE_TKIP)
{
if (priv->rtllib->group_key_type == KEY_TYPE_TKIP) {
MacAddr = CAM_CONST_BROAD;
for (EntryId=1 ; EntryId<4 ; EntryId++)
{
if (priv->rtllib->swcamtable[EntryId].bused )
{
setKey(dev,
EntryId,
EntryId,
for (EntryId = 1; EntryId < 4; EntryId++) {
if (priv->rtllib->swcamtable[EntryId].bused) {
setKey(dev, EntryId, EntryId,
priv->rtllib->group_key_type,
MacAddr,
0,
MacAddr, 0,
(u32 *)(&priv->rtllib->swcamtable[EntryId].key_buf[0])
);
}
}
if (priv->rtllib->iw_mode == IW_MODE_ADHOC)
{
if (priv->rtllib->iw_mode == IW_MODE_ADHOC) {
if (priv->rtllib->swcamtable[0].bused) {
setKey(dev,
0,
0,
setKey(dev, 0, 0,
priv->rtllib->group_key_type,
CAM_CONST_ADDR[0],
0,
CAM_CONST_ADDR[0], 0,
(u32 *)(&priv->rtllib->swcamtable[0].key_buf[0])
);
}
else
{
RT_TRACE(COMP_ERR,"===>%s():ERR!! ADHOC TKIP ,but 0 entry is have no data\n",__func__);
} else {
RT_TRACE(COMP_ERR, "===>%s():ERR!! ADHOC TKIP "
",but 0 entry is have no data\n",
__func__);
return;
}
}
} else if (priv->rtllib->group_key_type == KEY_TYPE_CCMP) {
MacAddr = CAM_CONST_BROAD;
for (EntryId=1; EntryId<4 ; EntryId++)
{
if (priv->rtllib->swcamtable[EntryId].bused )
{
setKey(dev,
EntryId ,
EntryId,
for (EntryId = 1; EntryId < 4; EntryId++) {
if (priv->rtllib->swcamtable[EntryId].bused) {
setKey(dev, EntryId , EntryId,
priv->rtllib->group_key_type,
MacAddr,
0,
MacAddr, 0,
(u32 *)(&priv->rtllib->swcamtable[EntryId].key_buf[0]));
}
}
if (priv->rtllib->iw_mode == IW_MODE_ADHOC) {
if (priv->rtllib->swcamtable[0].bused) {
setKey(dev,
0 ,
0,
setKey(dev, 0 , 0,
priv->rtllib->group_key_type,
CAM_CONST_ADDR[0],
0,
CAM_CONST_ADDR[0], 0,
(u32 *)(&priv->rtllib->swcamtable[0].key_buf[0]));
} else {
RT_TRACE(COMP_ERR,"===>%s():ERR!! ADHOC CCMP ,but 0 entry is have no data\n",
RT_TRACE(COMP_ERR, "===>%s():ERR!! ADHOC CCMP ,"
"but 0 entry is have no data\n",
__func__);
return;
}

View File

@@ -30,8 +30,10 @@ struct net_device;
void CamResetAllEntry(struct net_device *dev);
void EnableHWSecurityConfig8192(struct net_device *dev);
void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, u8 *MacAddr, u8 DefaultKey, u32 *KeyContent );
void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh);
void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
u8 *MacAddr, u8 DefaultKey, u32 *KeyContent);
void set_swcam(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,
u8 *MacAddr, u8 DefaultKey, u32 *KeyContent, u8 is_mesh);
void CamPrintDbgReg(struct net_device *dev);
u32 read_cam(struct net_device *dev, u8 addr);