[PATCH 750/961] staging: rtl8192e: Pass priv to SetKey

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mike McCormack <mikem@xxxxxxxxxx>

Signed-off-by: Mike McCormack <mikem@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
 drivers/staging/rtl8192e/r8192E.h      |    3 +-
 drivers/staging/rtl8192e/r8192E_core.c |   20 +++++---------
 drivers/staging/rtl8192e/r8192E_wx.c   |   43 ++++++--------------------------
 3 files changed, 17 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/rtl8192e/r8192E.h b/drivers/staging/rtl8192e/r8192E.h
index 26b2e58..c18705f 100644
--- a/drivers/staging/rtl8192e/r8192E.h
+++ b/drivers/staging/rtl8192e/r8192E.h
@@ -1122,7 +1122,8 @@ void rtl8192_commit(struct r8192_priv *priv);
 void write_phy(struct net_device *dev, u8 adr, u8 data);
 void CamResetAllEntry(struct r8192_priv *priv);
 void EnableHWSecurityConfig8192(struct r8192_priv *priv);
-void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent );
+void setKey(struct r8192_priv *priv, u8 EntryNo, u8 KeyIndex, u16 KeyType,
+	    const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent);
 void firmware_init_param(struct net_device *dev);
 RT_STATUS cmpk_message_handle_tx(struct net_device *dev, u8* codevirtualaddress, u32 packettype, u32 buffer_len);
 
diff --git a/drivers/staging/rtl8192e/r8192E_core.c b/drivers/staging/rtl8192e/r8192E_core.c
index 1028d43..04e6bdc 100644
--- a/drivers/staging/rtl8192e/r8192E_core.c
+++ b/drivers/staging/rtl8192e/r8192E_core.c
@@ -3542,7 +3542,6 @@ static int r8192_set_mac_adr(struct net_device *dev, void *mac)
 static void r8192e_set_hw_key(struct r8192_priv *priv, struct ieee_param *ipw)
 {
 	struct ieee80211_device *ieee = priv->ieee80211;
-	struct net_device *dev = priv->ieee80211->dev;
 	u8 broadcast_addr[6] = {0xff,0xff,0xff,0xff,0xff,0xff};
 	u32 key[4];
 
@@ -3567,13 +3566,13 @@ static void r8192e_set_hw_key(struct r8192_priv *priv, struct ieee_param *ipw)
 			 * key as in IPW interface, adhoc will only get here,
 			 * so we need index entry for its default key serching!
 			 */
-			setKey(dev, 4, ipw->u.crypt.idx,
+			setKey(priv, 4, ipw->u.crypt.idx,
 			       ieee->pairwise_key_type,
 			       (u8*)ieee->ap_mac_addr, 0, key);
 
 			/* LEAP WEP will never set this. */
 			if (ieee->auth_mode != 2)
-				setKey(dev, ipw->u.crypt.idx, ipw->u.crypt.idx,
+				setKey(priv, ipw->u.crypt.idx, ipw->u.crypt.idx,
 				       ieee->pairwise_key_type,
 				       (u8*)ieee->ap_mac_addr, 0, key);
 		}
@@ -3596,7 +3595,7 @@ static void r8192e_set_hw_key(struct r8192_priv *priv, struct ieee_param *ipw)
 			ieee->group_key_type = KEY_TYPE_NA;
 
 		if (ieee->group_key_type) {
-			setKey(dev, ipw->u.crypt.idx, ipw->u.crypt.idx,
+			setKey(priv, ipw->u.crypt.idx, ipw->u.crypt.idx,
 			       ieee->group_key_type, broadcast_addr, 0, key);
 		}
 	}
@@ -4950,21 +4949,16 @@ void EnableHWSecurityConfig8192(struct r8192_priv *priv)
 }
 #define TOTAL_CAM_ENTRY 32
 //#define CAM_CONTENT_COUNT 8
-void setKey(	struct net_device *dev,
-		u8 EntryNo,
-		u8 KeyIndex,
-		u16 KeyType,
-		const u8 *MacAddr,
-		u8 DefaultKey,
-		u32 *KeyContent )
+void setKey(struct r8192_priv *priv, u8 EntryNo, u8 KeyIndex, u16 KeyType,
+	    const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent)
 {
 	u32 TargetCommand = 0;
 	u32 TargetContent = 0;
 	u16 usConfig = 0;
 	u8 i;
 #ifdef ENABLE_IPS
-	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	RT_RF_POWER_STATE	rtState;
+
 	rtState = priv->eRFPowerState;
 	if (priv->PowerSaveControl.bInactivePs){
 		if(rtState == eRfOff){
@@ -4986,7 +4980,7 @@ void setKey(	struct net_device *dev,
 	if (EntryNo >= TOTAL_CAM_ENTRY)
 		RT_TRACE(COMP_ERR, "cam entry exceeds in setKey()\n");
 
-	RT_TRACE(COMP_SEC, "====>to setKey(), dev:%p, EntryNo:%d, KeyIndex:%d, KeyType:%d, MacAddr%pM\n", dev,EntryNo, KeyIndex, KeyType, MacAddr);
+	RT_TRACE(COMP_SEC, "====>to setKey(), priv:%p, EntryNo:%d, KeyIndex:%d, KeyType:%d, MacAddr%pM\n", priv, EntryNo, KeyIndex, KeyType, MacAddr);
 
 	if (DefaultKey)
 		usConfig |= BIT15 | (KeyType<<2);
diff --git a/drivers/staging/rtl8192e/r8192E_wx.c b/drivers/staging/rtl8192e/r8192E_wx.c
index b51842b..f763776 100644
--- a/drivers/staging/rtl8192e/r8192E_wx.c
+++ b/drivers/staging/rtl8192e/r8192E_wx.c
@@ -686,25 +686,15 @@ static int r8192_wx_set_enc(struct net_device *dev,
 		if(wrqu->encoding.length==0x5){
 		ieee->pairwise_key_type = KEY_TYPE_WEP40;
 			EnableHWSecurityConfig8192(priv);
-			setKey( dev,
-				key_idx,                //EntryNo
-				key_idx,                //KeyIndex
-				KEY_TYPE_WEP40,         //KeyType
-				zero_addr[key_idx],
-				0,                      //DefaultKey
-				hwkey);                 //KeyContent
+			setKey(priv, key_idx, key_idx, KEY_TYPE_WEP40,
+			       zero_addr[key_idx], 0, hwkey);
 		}
 
 		else if(wrqu->encoding.length==0xd){
 			ieee->pairwise_key_type = KEY_TYPE_WEP104;
 				EnableHWSecurityConfig8192(priv);
-			setKey( dev,
-				key_idx,                //EntryNo
-				key_idx,                //KeyIndex
-				KEY_TYPE_WEP104,        //KeyType
-				zero_addr[key_idx],
-				0,                      //DefaultKey
-				hwkey);                 //KeyContent
+			setKey(priv, key_idx, key_idx, KEY_TYPE_WEP104,
+			       zero_addr[key_idx], 0, hwkey);
 		}
 		else printk("wrong type in WEP, not WEP40 and WEP104\n");
 	}
@@ -909,37 +899,20 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
 		{
 			if (ext->key_len == 13)
 				ieee->pairwise_key_type = alg = KEY_TYPE_WEP104;
-			setKey( dev,
-					idx,//EntryNo
-					idx, //KeyIndex
-					alg,  //KeyType
-					zero, //MacAddr
-					0,              //DefaultKey
-					key);           //KeyContent
+			setKey(priv, idx, idx, alg, zero, 0, key);
 		}
 		else if (group)
 		{
 			ieee->group_key_type = alg;
-			setKey( dev,
-					idx,//EntryNo
-					idx, //KeyIndex
-					alg,  //KeyType
-					broadcast_addr, //MacAddr
-					0,              //DefaultKey
-					key);           //KeyContent
+			setKey(priv, idx, idx, alg, broadcast_addr, 0, key);
 		}
 		else //pairwise key
 		{
 			if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) && ieee->pHTInfo->bCurrentHTSupport){
 							write_nic_byte(priv, 0x173, 1); //fix aes bug
 			}
-			setKey( dev,
-					4,//EntryNo
-					idx, //KeyIndex
-					alg,  //KeyType
-					(u8*)ieee->ap_mac_addr, //MacAddr
-					0,              //DefaultKey
-					key);           //KeyContent
+			setKey(priv, 4, idx, alg,
+			       (u8*)ieee->ap_mac_addr, 0, key);
 		}
 
 
-- 
1.7.4.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux