staging: rtl8192e: Pass priv to firmware download functions
authorMike McCormack <mikem@ring3k.org>
Thu, 10 Mar 2011 13:40:36 +0000 (22:40 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Mar 2011 19:24:47 +0000 (12:24 -0700)
Signed-off-by: Mike McCormack <mikem@ring3k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rtl8192e/r8192E.h
drivers/staging/rtl8192e/r8192E_core.c
drivers/staging/rtl8192e/r819xE_cmdpkt.c
drivers/staging/rtl8192e/r819xE_firmware.c

index 8052d0c..fc231a0 100644 (file)
@@ -1108,7 +1108,7 @@ typedef struct r8192_priv
        struct workqueue_struct *priv_wq;
 }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);
 void write_cam(struct r8192_priv *priv, u8 addr, u32 data);
 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 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);
+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);
 
 #ifdef ENABLE_IPS
index 933574c..b29c37f 100644 (file)
@@ -2713,7 +2713,7 @@ static RT_STATUS rtl8192_adapter_start(struct r8192_priv *priv)
 
        //Firmware download
        RT_TRACE(COMP_INIT, "Load Firmware!\n");
-       bfirmwareok = init_firmware(dev);
+       bfirmwareok = init_firmware(priv);
        if(bfirmwareok != true) {
                rtStatus = RT_STATUS_FAILURE;
                return rtStatus;
index a8310c9..f603960 100644 (file)
@@ -53,7 +53,7 @@ RT_STATUS cmpk_message_handle_tx(
         int i;
 
        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
        frag_threshold = pfirmware->cmdpacket_frag_thresold;
         do {
index af99d0e..1557d80 100644 (file)
@@ -25,9 +25,8 @@ enum opt_rst_type {
        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;
 
        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
  */
-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)
 {
-       struct r8192_priv *priv = ieee80211_priv(dev);
+       struct net_device *dev = priv->ieee80211->dev;
        bool rt_status = true;
        u16 frag_threshold;
        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;
        u8 bLastIniPkt;
 
-       firmware_init_param(dev);
+       firmware_init_param(priv);
 
        /* Fragmentation might be required */
        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
  * 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;
        bool rt_status = true;
        u32 CPU_status = 0;
@@ -166,9 +164,8 @@ CPUCheckMainCodeOKAndTurnOnCPU_Fail:
        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;
        bool rt_status = true;
        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;
        u32 file_length = 0;
        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
                 *    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)
                        goto download_firmware_fail;
 
@@ -314,7 +310,7 @@ bool init_firmware(struct net_device *dev)
                        pfirmware->firmware_status = FW_STATUS_2_MOVE_MAIN_CODE;
 
                        /* Check Put Code OK and Turn On CPU */
-                       rt_status = CPUcheck_maincodeok_turnonCPU(dev);
+                       rt_status = CPUcheck_maincodeok_turnonCPU(priv);
                        if (rt_status != TRUE) {
                                RT_TRACE(COMP_FIRMWARE,
                                        "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;
                        mdelay(1);
 
-                       rt_status = CPUcheck_firmware_ready(dev);
+                       rt_status = CPUcheck_firmware_ready(priv);
                        if (rt_status != TRUE) {
                                RT_TRACE(COMP_FIRMWARE,
                                        "CPUcheck_firmware_ready fail(%d)!\n",