浏览代码

staging: rtl8192e: Pass priv to firmware download functions

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Mike McCormack 14 年之前
父节点
当前提交
ef8efe5b2d

+ 2 - 2
drivers/staging/rtl8192e/r8192E.h

@@ -1108,7 +1108,7 @@ typedef struct r8192_priv
 	struct workqueue_struct *priv_wq;
 	struct workqueue_struct *priv_wq;
 }r8192_priv;
 }r8192_priv;
 
 
-bool init_firmware(struct net_device *dev);
+bool init_firmware(struct r8192_priv *priv);
 u32 read_cam(struct r8192_priv *priv, u8 addr);
 u32 read_cam(struct r8192_priv *priv, u8 addr);
 void write_cam(struct r8192_priv *priv, u8 addr, u32 data);
 void write_cam(struct r8192_priv *priv, u8 addr, u32 data);
 u8 read_nic_byte(struct r8192_priv *priv, int x);
 u8 read_nic_byte(struct r8192_priv *priv, int x);
@@ -1126,7 +1126,7 @@ void CamResetAllEntry(struct r8192_priv *priv);
 void EnableHWSecurityConfig8192(struct r8192_priv *priv);
 void EnableHWSecurityConfig8192(struct r8192_priv *priv);
 void setKey(struct r8192_priv *priv, u8 EntryNo, u8 KeyIndex, u16 KeyType,
 void setKey(struct r8192_priv *priv, u8 EntryNo, u8 KeyIndex, u16 KeyType,
 	    const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent);
 	    const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent);
-void firmware_init_param(struct net_device *dev);
+void firmware_init_param(struct r8192_priv *priv);
 RT_STATUS cmpk_message_handle_tx(struct net_device *dev, u8* codevirtualaddress, u32 packettype, u32 buffer_len);
 RT_STATUS cmpk_message_handle_tx(struct net_device *dev, u8* codevirtualaddress, u32 packettype, u32 buffer_len);
 
 
 #ifdef ENABLE_IPS
 #ifdef ENABLE_IPS

+ 1 - 1
drivers/staging/rtl8192e/r8192E_core.c

@@ -2713,7 +2713,7 @@ static RT_STATUS rtl8192_adapter_start(struct r8192_priv *priv)
 
 
 	//Firmware download
 	//Firmware download
 	RT_TRACE(COMP_INIT, "Load Firmware!\n");
 	RT_TRACE(COMP_INIT, "Load Firmware!\n");
-	bfirmwareok = init_firmware(dev);
+	bfirmwareok = init_firmware(priv);
 	if(bfirmwareok != true) {
 	if(bfirmwareok != true) {
 		rtStatus = RT_STATUS_FAILURE;
 		rtStatus = RT_STATUS_FAILURE;
 		return rtStatus;
 		return rtStatus;

+ 1 - 1
drivers/staging/rtl8192e/r819xE_cmdpkt.c

@@ -53,7 +53,7 @@ RT_STATUS cmpk_message_handle_tx(
         int i;
         int i;
 
 
 	RT_TRACE(COMP_CMDPKT,"%s(),buffer_len is %d\n",__FUNCTION__,buffer_len);
 	RT_TRACE(COMP_CMDPKT,"%s(),buffer_len is %d\n",__FUNCTION__,buffer_len);
-	firmware_init_param(dev);
+	firmware_init_param(priv);
 	//Fragmentation might be required
 	//Fragmentation might be required
 	frag_threshold = pfirmware->cmdpacket_frag_thresold;
 	frag_threshold = pfirmware->cmdpacket_frag_thresold;
         do {
         do {

+ 10 - 14
drivers/staging/rtl8192e/r819xE_firmware.c

@@ -25,9 +25,8 @@ enum opt_rst_type {
 	OPT_FIRMWARE_RESET = 1,
 	OPT_FIRMWARE_RESET = 1,
 };
 };
 
 
-void firmware_init_param(struct net_device *dev)
+void firmware_init_param(struct r8192_priv *priv)
 {
 {
-	struct r8192_priv *priv = ieee80211_priv(dev);
 	rt_firmware *pfirmware = priv->pFirmware;
 	rt_firmware *pfirmware = priv->pFirmware;
 
 
 	pfirmware->cmdpacket_frag_thresold =
 	pfirmware->cmdpacket_frag_thresold =
@@ -37,10 +36,10 @@ void firmware_init_param(struct net_device *dev)
 /*
 /*
  * segment the img and use the ptr and length to remember info on each segment
  * segment the img and use the ptr and length to remember info on each segment
  */
  */
-static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,
+static bool fw_download_code(struct r8192_priv *priv, u8 *code_virtual_address,
 			     u32 buffer_len)
 			     u32 buffer_len)
 {
 {
-	struct r8192_priv *priv = ieee80211_priv(dev);
+	struct net_device *dev = priv->ieee80211->dev;
 	bool rt_status = true;
 	bool rt_status = true;
 	u16 frag_threshold;
 	u16 frag_threshold;
 	u16 frag_length, frag_offset = 0;
 	u16 frag_length, frag_offset = 0;
@@ -52,7 +51,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,
 	cb_desc *tcb_desc;
 	cb_desc *tcb_desc;
 	u8 bLastIniPkt;
 	u8 bLastIniPkt;
 
 
-	firmware_init_param(dev);
+	firmware_init_param(priv);
 
 
 	/* Fragmentation might be required */
 	/* Fragmentation might be required */
 	frag_threshold = pfirmware->cmdpacket_frag_thresold;
 	frag_threshold = pfirmware->cmdpacket_frag_thresold;
@@ -113,9 +112,8 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,
  * register.  Switch to CPU register in the begin and switch
  * register.  Switch to CPU register in the begin and switch
  * back before return
  * back before return
  */
  */
-static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev)
+static bool CPUcheck_maincodeok_turnonCPU(struct r8192_priv *priv)
 {
 {
-	struct r8192_priv *priv = ieee80211_priv(dev);
 	unsigned long timeout;
 	unsigned long timeout;
 	bool rt_status = true;
 	bool rt_status = true;
 	u32 CPU_status = 0;
 	u32 CPU_status = 0;
@@ -166,9 +164,8 @@ CPUCheckMainCodeOKAndTurnOnCPU_Fail:
 	return rt_status;
 	return rt_status;
 }
 }
 
 
-static bool CPUcheck_firmware_ready(struct net_device *dev)
+static bool CPUcheck_firmware_ready(struct r8192_priv *priv)
 {
 {
-	struct r8192_priv *priv = ieee80211_priv(dev);
 	unsigned long timeout;
 	unsigned long timeout;
 	bool rt_status = true;
 	bool rt_status = true;
 	u32 CPU_status = 0;
 	u32 CPU_status = 0;
@@ -197,9 +194,8 @@ CPUCheckFirmwareReady_Fail:
 
 
 }
 }
 
 
-bool init_firmware(struct net_device *dev)
+bool init_firmware(struct r8192_priv *priv)
 {
 {
-	struct r8192_priv *priv = ieee80211_priv(dev);
 	bool rt_status = true;
 	bool rt_status = true;
 	u32 file_length = 0;
 	u32 file_length = 0;
 	u8 *mapped_file = NULL;
 	u8 *mapped_file = NULL;
@@ -289,7 +285,7 @@ bool init_firmware(struct net_device *dev)
 		 * 3. each skb_buff packet data content will already include
 		 * 3. each skb_buff packet data content will already include
 		 *    the firmware info and Tx descriptor info
 		 *    the firmware info and Tx descriptor info
 		 */
 		 */
-		rt_status = fw_download_code(dev, mapped_file, file_length);
+		rt_status = fw_download_code(priv, mapped_file, file_length);
 		if (rt_status != TRUE)
 		if (rt_status != TRUE)
 			goto download_firmware_fail;
 			goto download_firmware_fail;
 
 
@@ -314,7 +310,7 @@ bool init_firmware(struct net_device *dev)
 			pfirmware->firmware_status = FW_STATUS_2_MOVE_MAIN_CODE;
 			pfirmware->firmware_status = FW_STATUS_2_MOVE_MAIN_CODE;
 
 
 			/* Check Put Code OK and Turn On CPU */
 			/* Check Put Code OK and Turn On CPU */
-			rt_status = CPUcheck_maincodeok_turnonCPU(dev);
+			rt_status = CPUcheck_maincodeok_turnonCPU(priv);
 			if (rt_status != TRUE) {
 			if (rt_status != TRUE) {
 				RT_TRACE(COMP_FIRMWARE,
 				RT_TRACE(COMP_FIRMWARE,
 					"CPUcheck_maincodeok_turnonCPU fail!\n");
 					"CPUcheck_maincodeok_turnonCPU fail!\n");
@@ -329,7 +325,7 @@ bool init_firmware(struct net_device *dev)
 			pfirmware->firmware_status = FW_STATUS_4_MOVE_DATA_CODE;
 			pfirmware->firmware_status = FW_STATUS_4_MOVE_DATA_CODE;
 			mdelay(1);
 			mdelay(1);
 
 
-			rt_status = CPUcheck_firmware_ready(dev);
+			rt_status = CPUcheck_firmware_ready(priv);
 			if (rt_status != TRUE) {
 			if (rt_status != TRUE) {
 				RT_TRACE(COMP_FIRMWARE,
 				RT_TRACE(COMP_FIRMWARE,
 					"CPUcheck_firmware_ready fail(%d)!\n",
 					"CPUcheck_firmware_ready fail(%d)!\n",