diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-10-09 06:18:51 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-10-31 19:00:07 -0400 |
commit | e8975581f63870be42ff4662b293d1b0c8c21350 (patch) | |
tree | 3d0d67e73d009ea6480b459585c0a70fc35fa9da /net/mac80211/main.c | |
parent | 0f4ac38b5999c3d51adad52d61c56c1b99c247ec (diff) |
mac80211: introduce hw config change flags
This makes mac80211 notify the driver which configuration
actually changed, e.g. channel etc.
No driver changes, this is just plumbing, driver authors are
expected to act on this if they want to.
Also remove the HW CONFIG debug printk, it's incorrect, often
we configure something else.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/main.c')
-rw-r--r-- | net/mac80211/main.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 07f812755e55..c936017f6d48 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -197,31 +197,34 @@ int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed) | |||
197 | &sdata->vif, &conf); | 197 | &sdata->vif, &conf); |
198 | } | 198 | } |
199 | 199 | ||
200 | int ieee80211_hw_config(struct ieee80211_local *local) | 200 | int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) |
201 | { | 201 | { |
202 | struct ieee80211_channel *chan; | 202 | struct ieee80211_channel *chan; |
203 | int ret = 0; | 203 | int ret = 0; |
204 | int power; | ||
204 | 205 | ||
205 | if (local->sw_scanning) | 206 | if (local->sw_scanning) |
206 | chan = local->scan_channel; | 207 | chan = local->scan_channel; |
207 | else | 208 | else |
208 | chan = local->oper_channel; | 209 | chan = local->oper_channel; |
209 | 210 | ||
210 | local->hw.conf.channel = chan; | 211 | if (chan != local->hw.conf.channel) { |
212 | local->hw.conf.channel = chan; | ||
213 | changed |= IEEE80211_CONF_CHANGE_CHANNEL; | ||
214 | } | ||
215 | |||
211 | 216 | ||
212 | if (!local->hw.conf.power_level) | 217 | if (!local->hw.conf.power_level) |
213 | local->hw.conf.power_level = chan->max_power; | 218 | power = chan->max_power; |
214 | else | 219 | else |
215 | local->hw.conf.power_level = min(chan->max_power, | 220 | power = min(chan->max_power, local->hw.conf.power_level); |
216 | local->hw.conf.power_level); | 221 | if (local->hw.conf.power_level != power) { |
217 | 222 | changed |= IEEE80211_CONF_CHANGE_POWER; | |
218 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 223 | local->hw.conf.power_level = power; |
219 | printk(KERN_DEBUG "%s: HW CONFIG: freq=%d\n", | 224 | } |
220 | wiphy_name(local->hw.wiphy), chan->center_freq); | ||
221 | #endif | ||
222 | 225 | ||
223 | if (local->open_count) { | 226 | if (changed && local->open_count) { |
224 | ret = local->ops->config(local_to_hw(local), &local->hw.conf); | 227 | ret = local->ops->config(local_to_hw(local), changed); |
225 | /* | 228 | /* |
226 | * HW reconfiguration should never fail, the driver has told | 229 | * HW reconfiguration should never fail, the driver has told |
227 | * us what it can support so it should live up to that promise. | 230 | * us what it can support so it should live up to that promise. |
@@ -672,7 +675,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | |||
672 | local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD; | 675 | local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD; |
673 | local->short_retry_limit = 7; | 676 | local->short_retry_limit = 7; |
674 | local->long_retry_limit = 4; | 677 | local->long_retry_limit = 4; |
675 | local->hw.conf.radio_enabled = 1; | 678 | local->hw.conf.radio_enabled = true; |
676 | 679 | ||
677 | INIT_LIST_HEAD(&local->interfaces); | 680 | INIT_LIST_HEAD(&local->interfaces); |
678 | 681 | ||