[ep93xx] package more board specific modules:
[openwrt.git] / package / mac80211 / patches / 860-b43_restart_config.patch
1 --- a/drivers/net/wireless/b43/main.c
2 +++ b/drivers/net/wireless/b43/main.c
3 @@ -326,6 +326,10 @@ static void b43_wireless_core_exit(struc
4  static int b43_wireless_core_init(struct b43_wldev *dev);
5  static struct b43_wldev * b43_wireless_core_stop(struct b43_wldev *dev);
6  static int b43_wireless_core_start(struct b43_wldev *dev);
7 +static void b43_op_bss_info_changed(struct ieee80211_hw *hw,
8 +                                   struct ieee80211_vif *vif,
9 +                                   struct ieee80211_bss_conf *conf,
10 +                                   u32 changed);
11  
12  static int b43_ratelimit(struct b43_wl *wl)
13  {
14 @@ -3762,14 +3766,24 @@ static int b43_op_config(struct ieee8021
15         struct ieee80211_conf *conf = &hw->conf;
16         int antenna;
17         int err = 0;
18 +       bool reload_bss = false;
19  
20         mutex_lock(&wl->mutex);
21  
22 +       dev = wl->current_dev;
23 +
24         /* Switch the band (if necessary). This might change the active core. */
25         err = b43_switch_band(wl, conf->channel);
26         if (err)
27                 goto out_unlock_mutex;
28 -       dev = wl->current_dev;
29 +
30 +       /* Need to reload all settings if the core changed */
31 +       if (dev != wl->current_dev) {
32 +               dev = wl->current_dev;
33 +               changed = ~0;
34 +               reload_bss = true;
35 +       }
36 +
37         phy = &dev->phy;
38  
39         if (conf_is_ht(conf))
40 @@ -3830,6 +3844,9 @@ out_mac_enable:
41  out_unlock_mutex:
42         mutex_unlock(&wl->mutex);
43  
44 +       if (wl->vif && reload_bss)
45 +               b43_op_bss_info_changed(hw, wl->vif, &wl->vif->bss_conf, ~0);
46 +
47         return err;
48  }
49  
50 @@ -3918,7 +3935,8 @@ static void b43_op_bss_info_changed(stru
51         if (changed & BSS_CHANGED_BEACON_INT &&
52             (b43_is_mode(wl, NL80211_IFTYPE_AP) ||
53              b43_is_mode(wl, NL80211_IFTYPE_MESH_POINT) ||
54 -            b43_is_mode(wl, NL80211_IFTYPE_ADHOC)))
55 +            b43_is_mode(wl, NL80211_IFTYPE_ADHOC)) &&
56 +           conf->beacon_int)
57                 b43_set_beacon_int(dev, conf->beacon_int);
58  
59         if (changed & BSS_CHANGED_BASIC_RATES)
60 @@ -4699,6 +4717,9 @@ static int b43_op_add_interface(struct i
61   out_mutex_unlock:
62         mutex_unlock(&wl->mutex);
63  
64 +       if (err == 0)
65 +               b43_op_bss_info_changed(hw, vif, &vif->bss_conf, ~0);
66 +
67         return err;
68  }
69  
70 @@ -4769,6 +4790,9 @@ static int b43_op_start(struct ieee80211
71   out_mutex_unlock:
72         mutex_unlock(&wl->mutex);
73  
74 +       /* reload configuration */
75 +       b43_op_config(hw, ~0);
76 +
77         return err;
78  }
79  
80 @@ -4925,10 +4949,18 @@ out:
81         if (err)
82                 wl->current_dev = NULL; /* Failed to init the dev. */
83         mutex_unlock(&wl->mutex);
84 -       if (err)
85 +
86 +       if (err) {
87                 b43err(wl, "Controller restart FAILED\n");
88 -       else
89 -               b43info(wl, "Controller restarted\n");
90 +               return;
91 +       }
92 +
93 +       /* reload configuration */
94 +       b43_op_config(wl->hw, ~0);
95 +       if (wl->vif)
96 +               b43_op_bss_info_changed(wl->hw, wl->vif, &wl->vif->bss_conf, ~0);
97 +
98 +       b43info(wl, "Controller restarted\n");
99  }
100  
101  static int b43_setup_bands(struct b43_wldev *dev,