Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rtlwifi / core.c
index ab6a4068764f4eb928bc561e83e30c0d56981d4f..f231b9180436ba75043aa9320489908cb17eb75e 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2009-2010  Realtek Corporation.
+ * Copyright(c) 2009-2012  Realtek Corporation.
  *
  * 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
 #include "core.h"
 #include "cam.h"
 #include "base.h"
+#include "pci.h"
 #include "ps.h"
 
+#include <linux/export.h>
+
+void rtl_fw_cb(const struct firmware *firmware, void *context)
+{
+       struct ieee80211_hw *hw = context;
+       struct rtl_priv *rtlpriv = rtl_priv(hw);
+       int err;
+
+       RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD,
+                        "Firmware callback routine entered!\n");
+       complete(&rtlpriv->firmware_loading_complete);
+       if (!firmware) {
+               pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name);
+               rtlpriv->max_fw_size = 0;
+               return;
+       }
+       if (firmware->size > rtlpriv->max_fw_size) {
+               RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
+                        "Firmware is too big!\n");
+               release_firmware(firmware);
+               return;
+       }
+       memcpy(rtlpriv->rtlhal.pfirmware, firmware->data, firmware->size);
+       rtlpriv->rtlhal.fwsize = firmware->size;
+       release_firmware(firmware);
+
+       err = ieee80211_register_hw(hw);
+       if (err) {
+               RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
+                        "Can't register mac80211 hw\n");
+               return;
+       } else {
+               rtlpriv->mac80211.mac80211_registered = 1;
+       }
+       set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
+
+       /*init rfkill */
+       rtl_init_rfkill(hw);
+}
+EXPORT_SYMBOL(rtl_fw_cb);
+
 /*mutex for start & stop is must here. */
 static int rtl_op_start(struct ieee80211_hw *hw)
 {
@@ -112,6 +154,8 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
        struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
        int err = 0;
 
+       vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
+
        if (mac->vif) {
                RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
                         "vif has been set!! mac->vif = 0x%p\n", mac->vif);
@@ -252,10 +296,12 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
                         * because that will cause nullfunc send by mac80211
                         * fail, and cause pkt loss, we have tested that 5mA
                         * is worked very well */
-                       if (!rtlpriv->psc.multi_buffered)
+                       if (!rtlpriv->psc.multi_buffered) {
                                queue_delayed_work(rtlpriv->works.rtl_wq,
                                                &rtlpriv->works.ps_work,
                                                MSECS(5));
+                               pr_info("In section\n");
+                       }
                } else {
                        rtl_swlps_rf_awake(hw);
                        rtlpriv->psc.sw_ps_enabled = false;