Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf4747d7 authored by Larry Finger's avatar Larry Finger Committed by Kalle Valo
Browse files

rtlwifi: Fix regression caused by commit d86e6476



In commit d86e6476 ("rtlwifi: rtl818x: constify local structures"),
the configuration struct for most of the drivers was changed to be
constant. The problem is that five of the modified drivers need to be
able to update the firmware name based on the exact model of the card.
As the file names were stored in one of the members of that struct,
these drivers would fail with a kernel BUG splat when they tried to
update the firmware name.

Rather than reverting the previous commit, I used a suggestion by
Johannes Berg and made the firmware file name pointers be local to
the routines that update the software variables.

The configuration struct of rtl8192cu, which was not touched in the
previous patch, is now constantfied.

Fixes: d86e6476 ("rtlwifi: rtl818x: constify local structures")
Suggested-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> # 4.8
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 29d5e6fb
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -111,7 +111,7 @@ static void rtl_fw_do_work(const struct firmware *firmware, void *context,
			if (!err)
			if (!err)
				goto found_alt;
				goto found_alt;
		}
		}
		pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name);
		pr_err("Selected firmware is not available\n");
		rtlpriv->max_fw_size = 0;
		rtlpriv->max_fw_size = 0;
		return;
		return;
	}
	}
+4 −4
Original line number Original line Diff line number Diff line
@@ -86,6 +86,7 @@ int rtl88e_init_sw_vars(struct ieee80211_hw *hw)
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
	u8 tid;
	u8 tid;
	char *fw_name;


	rtl8188ee_bt_reg_init(hw);
	rtl8188ee_bt_reg_init(hw);
	rtlpriv->dm.dm_initialgain_enable = 1;
	rtlpriv->dm.dm_initialgain_enable = 1;
@@ -169,10 +170,10 @@ int rtl88e_init_sw_vars(struct ieee80211_hw *hw)
		return 1;
		return 1;
	}
	}


	rtlpriv->cfg->fw_name = "rtlwifi/rtl8188efw.bin";
	fw_name = "rtlwifi/rtl8188efw.bin";
	rtlpriv->max_fw_size = 0x8000;
	rtlpriv->max_fw_size = 0x8000;
	pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name);
	pr_info("Using firmware %s\n", fw_name);
	err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->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);
	if (err) {
	if (err) {
@@ -284,7 +285,6 @@ static const struct rtl_hal_cfg rtl88ee_hal_cfg = {
	.bar_id = 2,
	.bar_id = 2,
	.write_readback = true,
	.write_readback = true,
	.name = "rtl88e_pci",
	.name = "rtl88e_pci",
	.fw_name = "rtlwifi/rtl8188efw.bin",
	.ops = &rtl8188ee_hal_ops,
	.ops = &rtl8188ee_hal_ops,
	.mod_params = &rtl88ee_mod_params,
	.mod_params = &rtl88ee_mod_params,


+5 −8
Original line number Original line Diff line number Diff line
@@ -96,6 +96,7 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw)
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
	char *fw_name = "rtlwifi/rtl8192cfwU.bin";


	rtl8192ce_bt_reg_init(hw);
	rtl8192ce_bt_reg_init(hw);


@@ -167,15 +168,12 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw)
	}
	}


	/* request fw */
	/* request fw */
	if (IS_VENDOR_UMC_A_CUT(rtlhal->version) &&
	if (IS_81XXC_VENDOR_UMC_B_CUT(rtlhal->version))
	    !IS_92C_SERIAL(rtlhal->version))
		fw_name = "rtlwifi/rtl8192cfwU_B.bin";
		rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU.bin";
	else if (IS_81XXC_VENDOR_UMC_B_CUT(rtlhal->version))
		rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU_B.bin";


	rtlpriv->max_fw_size = 0x4000;
	rtlpriv->max_fw_size = 0x4000;
	pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name);
	pr_info("Using firmware %s\n", fw_name);
	err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->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);
	if (err) {
	if (err) {
@@ -262,7 +260,6 @@ static const struct rtl_hal_cfg rtl92ce_hal_cfg = {
	.bar_id = 2,
	.bar_id = 2,
	.write_readback = true,
	.write_readback = true,
	.name = "rtl92c_pci",
	.name = "rtl92c_pci",
	.fw_name = "rtlwifi/rtl8192cfw.bin",
	.ops = &rtl8192ce_hal_ops,
	.ops = &rtl8192ce_hal_ops,
	.mod_params = &rtl92ce_mod_params,
	.mod_params = &rtl92ce_mod_params,


+6 −6
Original line number Original line Diff line number Diff line
@@ -59,6 +59,7 @@ static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw)
{
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	int err;
	int err;
	char *fw_name;


	rtlpriv->dm.dm_initialgain_enable = true;
	rtlpriv->dm.dm_initialgain_enable = true;
	rtlpriv->dm.dm_flag = 0;
	rtlpriv->dm.dm_flag = 0;
@@ -77,18 +78,18 @@ static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw)
	}
	}
	if (IS_VENDOR_UMC_A_CUT(rtlpriv->rtlhal.version) &&
	if (IS_VENDOR_UMC_A_CUT(rtlpriv->rtlhal.version) &&
	    !IS_92C_SERIAL(rtlpriv->rtlhal.version)) {
	    !IS_92C_SERIAL(rtlpriv->rtlhal.version)) {
		rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cufw_A.bin";
		fw_name = "rtlwifi/rtl8192cufw_A.bin";
	} else if (IS_81XXC_VENDOR_UMC_B_CUT(rtlpriv->rtlhal.version)) {
	} else if (IS_81XXC_VENDOR_UMC_B_CUT(rtlpriv->rtlhal.version)) {
		rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cufw_B.bin";
		fw_name = "rtlwifi/rtl8192cufw_B.bin";
	} else {
	} else {
		rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cufw_TMSC.bin";
		fw_name = "rtlwifi/rtl8192cufw_TMSC.bin";
	}
	}
	/* provide name of alternative file */
	/* provide name of alternative file */
	rtlpriv->cfg->alt_fw_name = "rtlwifi/rtl8192cufw.bin";
	rtlpriv->cfg->alt_fw_name = "rtlwifi/rtl8192cufw.bin";
	pr_info("Loading firmware %s\n", rtlpriv->cfg->fw_name);
	pr_info("Loading firmware %s\n", fw_name);
	rtlpriv->max_fw_size = 0x4000;
	rtlpriv->max_fw_size = 0x4000;
	err = request_firmware_nowait(THIS_MODULE, 1,
	err = request_firmware_nowait(THIS_MODULE, 1,
				      rtlpriv->cfg->fw_name, rtlpriv->io.dev,
				      fw_name, rtlpriv->io.dev,
				      GFP_KERNEL, hw, rtl_fw_cb);
				      GFP_KERNEL, hw, rtl_fw_cb);
	return err;
	return err;
}
}
@@ -187,7 +188,6 @@ static struct rtl_hal_usbint_cfg rtl92cu_interface_cfg = {


static struct rtl_hal_cfg rtl92cu_hal_cfg = {
static struct rtl_hal_cfg rtl92cu_hal_cfg = {
	.name = "rtl92c_usb",
	.name = "rtl92c_usb",
	.fw_name = "rtlwifi/rtl8192cufw.bin",
	.ops = &rtl8192cu_hal_ops,
	.ops = &rtl8192cu_hal_ops,
	.mod_params = &rtl92cu_mod_params,
	.mod_params = &rtl92cu_mod_params,
	.usb_interface_cfg = &rtl92cu_interface_cfg,
	.usb_interface_cfg = &rtl92cu_interface_cfg,
+3 −3
Original line number Original line Diff line number Diff line
@@ -92,6 +92,7 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw)
	u8 tid;
	u8 tid;
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
	struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
	char *fw_name = "rtlwifi/rtl8192defw.bin";


	rtlpriv->dm.dm_initialgain_enable = true;
	rtlpriv->dm.dm_initialgain_enable = true;
	rtlpriv->dm.dm_flag = 0;
	rtlpriv->dm.dm_flag = 0;
@@ -181,10 +182,10 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw)


	rtlpriv->max_fw_size = 0x8000;
	rtlpriv->max_fw_size = 0x8000;
	pr_info("Driver for Realtek RTL8192DE WLAN interface\n");
	pr_info("Driver for Realtek RTL8192DE WLAN interface\n");
	pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name);
	pr_info("Loading firmware file %s\n", fw_name);


	/* request fw */
	/* request fw */
	err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->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);
	if (err) {
	if (err) {
@@ -266,7 +267,6 @@ static const struct rtl_hal_cfg rtl92de_hal_cfg = {
	.bar_id = 2,
	.bar_id = 2,
	.write_readback = true,
	.write_readback = true,
	.name = "rtl8192de",
	.name = "rtl8192de",
	.fw_name = "rtlwifi/rtl8192defw.bin",
	.ops = &rtl8192de_hal_ops,
	.ops = &rtl8192de_hal_ops,
	.mod_params = &rtl92de_mod_params,
	.mod_params = &rtl92de_mod_params,


Loading