Commit 4870e166 authored by Sven Joachim's avatar Sven Joachim Committed by Greg Kroah-Hartman

rtlwifi: Fix fallback firmware loading

commit 1d9b168d upstream.

Commit f70e4df2 ("rtlwifi: Add code to read new versions of
firmware") added code to load an old firmware file if the new one is
not available.  Unfortunately that code is never reached because
request_firmware_nowait() does not wait for the firmware to show up
and returns 0 even if the file is not there.

Use the existing fallback mechanism introduced by commit 62009b7f
("rtlwifi: rtl8192cu: Add new firmware") instead.

Fixes: f70e4df2 ("rtlwifi: Add code to read new versions of firmware")
Signed-off-by: default avatarSven Joachim <svenjoac@gmx.de>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cf37a1b9
...@@ -183,13 +183,6 @@ int rtl8723be_init_sw_vars(struct ieee80211_hw *hw) ...@@ -183,13 +183,6 @@ int rtl8723be_init_sw_vars(struct ieee80211_hw *hw)
rtlpriv->max_fw_size = 0x8000; rtlpriv->max_fw_size = 0x8000;
pr_info("Using firmware %s\n", fw_name); pr_info("Using firmware %s\n", fw_name);
err = request_firmware_nowait(THIS_MODULE, 1, fw_name,
rtlpriv->io.dev, GFP_KERNEL, hw,
rtl_fw_cb);
if (err) {
/* Failed to get firmware. Check if old version available */
fw_name = "rtlwifi/rtl8723befw.bin";
pr_info("Using firmware %s\n", fw_name);
err = request_firmware_nowait(THIS_MODULE, 1, fw_name, err = request_firmware_nowait(THIS_MODULE, 1, fw_name,
rtlpriv->io.dev, GFP_KERNEL, hw, rtlpriv->io.dev, GFP_KERNEL, hw,
rtl_fw_cb); rtl_fw_cb);
...@@ -199,7 +192,6 @@ int rtl8723be_init_sw_vars(struct ieee80211_hw *hw) ...@@ -199,7 +192,6 @@ int rtl8723be_init_sw_vars(struct ieee80211_hw *hw)
rtlpriv->rtlhal.pfirmware = NULL; rtlpriv->rtlhal.pfirmware = NULL;
return 1; return 1;
} }
}
return 0; return 0;
} }
...@@ -289,6 +281,7 @@ static const struct rtl_hal_cfg rtl8723be_hal_cfg = { ...@@ -289,6 +281,7 @@ static const struct rtl_hal_cfg rtl8723be_hal_cfg = {
.bar_id = 2, .bar_id = 2,
.write_readback = true, .write_readback = true,
.name = "rtl8723be_pci", .name = "rtl8723be_pci",
.alt_fw_name = "rtlwifi/rtl8723befw.bin",
.ops = &rtl8723be_hal_ops, .ops = &rtl8723be_hal_ops,
.mod_params = &rtl8723be_mod_params, .mod_params = &rtl8723be_mod_params,
.maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
......
...@@ -212,13 +212,6 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw) ...@@ -212,13 +212,6 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
rtlpriv->max_fw_size = 0x8000; rtlpriv->max_fw_size = 0x8000;
/*load normal firmware*/ /*load normal firmware*/
pr_info("Using firmware %s\n", fw_name); pr_info("Using firmware %s\n", fw_name);
err = request_firmware_nowait(THIS_MODULE, 1, fw_name,
rtlpriv->io.dev, GFP_KERNEL, hw,
rtl_fw_cb);
if (err) {
/* Failed to get firmware. Check if old version available */
fw_name = "rtlwifi/rtl8821aefw.bin";
pr_info("Using firmware %s\n", fw_name);
err = request_firmware_nowait(THIS_MODULE, 1, fw_name, err = request_firmware_nowait(THIS_MODULE, 1, fw_name,
rtlpriv->io.dev, GFP_KERNEL, hw, rtlpriv->io.dev, GFP_KERNEL, hw,
rtl_fw_cb); rtl_fw_cb);
...@@ -228,7 +221,6 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw) ...@@ -228,7 +221,6 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
vfree(rtlpriv->rtlhal.pfirmware); vfree(rtlpriv->rtlhal.pfirmware);
return 1; return 1;
} }
}
/*load wowlan firmware*/ /*load wowlan firmware*/
pr_info("Using firmware %s\n", wowlan_fw_name); pr_info("Using firmware %s\n", wowlan_fw_name);
err = request_firmware_nowait(THIS_MODULE, 1, err = request_firmware_nowait(THIS_MODULE, 1,
...@@ -331,6 +323,7 @@ static const struct rtl_hal_cfg rtl8821ae_hal_cfg = { ...@@ -331,6 +323,7 @@ static const struct rtl_hal_cfg rtl8821ae_hal_cfg = {
.bar_id = 2, .bar_id = 2,
.write_readback = true, .write_readback = true,
.name = "rtl8821ae_pci", .name = "rtl8821ae_pci",
.alt_fw_name = "rtlwifi/rtl8821aefw.bin",
.ops = &rtl8821ae_hal_ops, .ops = &rtl8821ae_hal_ops,
.mod_params = &rtl8821ae_mod_params, .mod_params = &rtl8821ae_mod_params,
.maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment