rtlwifi: rtl8188ee: Fix too long disable of IRQs
authorLarry Finger <Larry.Finger@lwfinger.net>
Tue, 4 Mar 2014 22:53:52 +0000 (16:53 -0600)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 6 Mar 2014 19:29:57 +0000 (14:29 -0500)
In commit f78bccd79ba3cd9d9664981b501d57bdb81ab8a4 entitled "rtlwifi:
rtl8192ce: Fix too long disable of IRQs", Olivier Langlois
<olivier@trillion01.com> fixed a problem caused by an extra long disabling
of interrupts. This patch makes the same fix for rtl8188ee.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rtlwifi/rtl8188ee/hw.c

index 6561805c3a88a3b3cdee29bf12dbe0f673f55ab4..bd2a26bafb695c750b47d4d164a7f357e3ee9488 100644 (file)
@@ -1024,9 +1024,20 @@ int rtl88ee_hw_init(struct ieee80211_hw *hw)
        bool rtstatus = true;
        int err = 0;
        u8 tmp_u1b, u1byte;
+       unsigned long flags;
 
        RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Rtl8188EE hw init\n");
        rtlpriv->rtlhal.being_init_adapter = true;
+       /* As this function can take a very long time (up to 350 ms)
+        * and can be called with irqs disabled, reenable the irqs
+        * to let the other devices continue being serviced.
+        *
+        * It is safe doing so since our own interrupts will only be enabled
+        * in a subsequent step.
+        */
+       local_save_flags(flags);
+       local_irq_enable();
+
        rtlpriv->intf_ops->disable_aspm(hw);
 
        tmp_u1b = rtl_read_byte(rtlpriv, REG_SYS_CLKR+1);
@@ -1042,7 +1053,7 @@ int rtl88ee_hw_init(struct ieee80211_hw *hw)
        if (rtstatus != true) {
                RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Init MAC failed\n");
                err = 1;
-               return err;
+               goto exit;
        }
 
        err = rtl88e_download_fw(hw, false);
@@ -1050,8 +1061,7 @@ int rtl88ee_hw_init(struct ieee80211_hw *hw)
                RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
                         "Failed to download FW. Init HW without FW now..\n");
                err = 1;
-               rtlhal->fw_ready = false;
-               return err;
+               goto exit;
        } else {
                rtlhal->fw_ready = true;
        }
@@ -1134,10 +1144,12 @@ int rtl88ee_hw_init(struct ieee80211_hw *hw)
        }
        rtl_write_byte(rtlpriv, REG_NAV_CTRL+2,  ((30000+127)/128));
        rtl88e_dm_init(hw);
+exit:
+       local_irq_restore(flags);
        rtlpriv->rtlhal.being_init_adapter = false;
        RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "end of Rtl8188EE hw init %x\n",
                 err);
-       return 0;
+       return err;
 }
 
 static enum version_8188e _rtl88ee_read_chip_version(struct ieee80211_hw *hw)