mac80211: backport some upstream mwl8k fixes
[openwrt.git] / package / mac80211 / patches / 702-mwl8k-always-apply-configuration-even-when-device-is.patch
1 From 5d1ed64614ccb21c26bc0ee321e9c51b6359ceb8 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Mon, 25 Mar 2013 15:37:42 +0100
4 Subject: [PATCH] mwl8k: always apply configuration even when device is idle
5
6 Fix settings not being applied when the device is idle and the firmware
7 gets reloaded (because of changing from STA to AP mode). This caused
8 the device using the wrong channel (and likely band), e.g. a 5 GHz only
9 card still defaulted to channel 6 in the 2.4 GHz band when left
10 unconfigured.
11
12 This issue was always present, but only made visible with "mwl8k: Do not
13 call mwl8k_cmd_set_rf_channel unconditionally" (0f4316b9), since before
14 that the channel was (re-)configured at the next _config call even when
15 it did not change from the mac80211 perspective.
16
17 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
18 ---
19  drivers/net/wireless/mwl8k.c |   10 ++++------
20  1 file changed, 4 insertions(+), 6 deletions(-)
21
22 --- a/drivers/net/wireless/mwl8k.c
23 +++ b/drivers/net/wireless/mwl8k.c
24 @@ -4818,16 +4818,14 @@ static int mwl8k_config(struct ieee80211
25         struct mwl8k_priv *priv = hw->priv;
26         int rc;
27  
28 -       if (conf->flags & IEEE80211_CONF_IDLE) {
29 -               mwl8k_cmd_radio_disable(hw);
30 -               return 0;
31 -       }
32 -
33         rc = mwl8k_fw_lock(hw);
34         if (rc)
35                 return rc;
36  
37 -       rc = mwl8k_cmd_radio_enable(hw);
38 +       if (conf->flags & IEEE80211_CONF_IDLE)
39 +               rc = mwl8k_cmd_radio_disable(hw);
40 +       else
41 +               rc = mwl8k_cmd_radio_enable(hw);
42         if (rc)
43                 goto out;
44