]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
rtlwifi: Convert to asynchronous firmware load
[mv-sheeva.git] / drivers / net / wireless / rtlwifi / rtl8192cu / sw.c
index 6d2ca773bbc7d9b6a9db6e28a91d2562c23ea37a..82c85286ab2e25852eb7e45f878fc7b783e07f97 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2009-2010  Realtek Corporation. All rights reserved.
+ * Copyright(c) 2009-2012  Realtek Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -41,7 +41,6 @@
 #include "trx.h"
 #include "led.h"
 #include "hw.h"
-#include <linux/vmalloc.h>
 #include <linux/module.h>
 
 MODULE_AUTHOR("Georgia         <georgia@realtek.com>");
@@ -54,7 +53,6 @@ MODULE_FIRMWARE("rtlwifi/rtl8192cufw.bin");
 static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
-       const struct firmware *firmware;
        int err;
 
        rtlpriv->dm.dm_initialgain_enable = true;
@@ -62,29 +60,21 @@ static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw)
        rtlpriv->dm.disable_framebursting = false;
        rtlpriv->dm.thermalvalue = 0;
        rtlpriv->dbg.global_debuglevel = rtlpriv->cfg->mod_params->debug;
-       rtlpriv->rtlhal.pfirmware = vmalloc(0x4000);
+
+       /* for firmware buf */
+       rtlpriv->rtlhal.pfirmware = vzalloc(0x4000);
        if (!rtlpriv->rtlhal.pfirmware) {
                RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-                        ("Can't alloc buffer for fw.\n"));
+                        "Can't alloc buffer for fw\n");
                return 1;
        }
-       /* request fw */
-       err = request_firmware(&firmware, rtlpriv->cfg->fw_name,
-                       rtlpriv->io.dev);
-       if (err) {
-               RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-                        ("Failed to request firmware!\n"));
-               return 1;
-       }
-       if (firmware->size > 0x4000) {
-               RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-                        ("Firmware is too big!\n"));
-               release_firmware(firmware);
-               return 1;
-       }
-       memcpy(rtlpriv->rtlhal.pfirmware, firmware->data, firmware->size);
-       rtlpriv->rtlhal.fwsize = firmware->size;
-       release_firmware(firmware);
+
+       pr_info("Loading firmware %s\n", rtlpriv->cfg->fw_name);
+       rtlpriv->max_fw_size = 0x4000;
+       err = request_firmware_nowait(THIS_MODULE, 1,
+                                     rtlpriv->cfg->fw_name, rtlpriv->io.dev,
+                                     GFP_KERNEL, hw, rtl_fw_cb);
+
 
        return 0;
 }