diff options
author | Bruno Randolf <br1@einfach.org> | 2011-01-19 04:20:36 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-01-21 15:34:18 -0500 |
commit | 90c02d72ffbec3804f48c517ecfc72f9440a67b3 (patch) | |
tree | db2b8d5f32d4c47ec00c4102a8044f644c2d2b4d /drivers/net/wireless | |
parent | 7755bad9ffe56e0faacb13bc9484ccc0194aaa75 (diff) |
ath5k: Use mac80211 channel mapping function
Use mac80211 channel mapping function instead of own homegrown version.
Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 019a74d533a6..c0177587856b 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -242,18 +242,6 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re | |||
242 | \********************/ | 242 | \********************/ |
243 | 243 | ||
244 | /* | 244 | /* |
245 | * Convert IEEE channel number to MHz frequency. | ||
246 | */ | ||
247 | static inline short | ||
248 | ath5k_ieee2mhz(short chan) | ||
249 | { | ||
250 | if (chan <= 14 || chan >= 27) | ||
251 | return ieee80211chan2mhz(chan); | ||
252 | else | ||
253 | return 2212 + chan * 20; | ||
254 | } | ||
255 | |||
256 | /* | ||
257 | * Returns true for the channel numbers used without all_channels modparam. | 245 | * Returns true for the channel numbers used without all_channels modparam. |
258 | */ | 246 | */ |
259 | static bool ath5k_is_standard_channel(short chan) | 247 | static bool ath5k_is_standard_channel(short chan) |
@@ -274,6 +262,7 @@ ath5k_copy_channels(struct ath5k_hw *ah, | |||
274 | unsigned int max) | 262 | unsigned int max) |
275 | { | 263 | { |
276 | unsigned int i, count, size, chfreq, freq, ch; | 264 | unsigned int i, count, size, chfreq, freq, ch; |
265 | enum ieee80211_band band; | ||
277 | 266 | ||
278 | if (!test_bit(mode, ah->ah_modes)) | 267 | if (!test_bit(mode, ah->ah_modes)) |
279 | return 0; | 268 | return 0; |
@@ -283,11 +272,13 @@ ath5k_copy_channels(struct ath5k_hw *ah, | |||
283 | /* 1..220, but 2GHz frequencies are filtered by check_channel */ | 272 | /* 1..220, but 2GHz frequencies are filtered by check_channel */ |
284 | size = 220 ; | 273 | size = 220 ; |
285 | chfreq = CHANNEL_5GHZ; | 274 | chfreq = CHANNEL_5GHZ; |
275 | band = IEEE80211_BAND_5GHZ; | ||
286 | break; | 276 | break; |
287 | case AR5K_MODE_11B: | 277 | case AR5K_MODE_11B: |
288 | case AR5K_MODE_11G: | 278 | case AR5K_MODE_11G: |
289 | size = 26; | 279 | size = 26; |
290 | chfreq = CHANNEL_2GHZ; | 280 | chfreq = CHANNEL_2GHZ; |
281 | band = IEEE80211_BAND_2GHZ; | ||
291 | break; | 282 | break; |
292 | default: | 283 | default: |
293 | ATH5K_WARN(ah->ah_sc, "bad mode, not copying channels\n"); | 284 | ATH5K_WARN(ah->ah_sc, "bad mode, not copying channels\n"); |
@@ -296,7 +287,10 @@ ath5k_copy_channels(struct ath5k_hw *ah, | |||
296 | 287 | ||
297 | for (i = 0, count = 0; i < size && max > 0; i++) { | 288 | for (i = 0, count = 0; i < size && max > 0; i++) { |
298 | ch = i + 1 ; | 289 | ch = i + 1 ; |
299 | freq = ath5k_ieee2mhz(ch); | 290 | freq = ieee80211_channel_to_frequency(ch, band); |
291 | |||
292 | if (freq == 0) /* mapping failed - not a standard channel */ | ||
293 | continue; | ||
300 | 294 | ||
301 | /* Check if channel is supported by the chipset */ | 295 | /* Check if channel is supported by the chipset */ |
302 | if (!ath5k_channel_ok(ah, freq, chfreq)) | 296 | if (!ath5k_channel_ok(ah, freq, chfreq)) |
@@ -307,8 +301,7 @@ ath5k_copy_channels(struct ath5k_hw *ah, | |||
307 | 301 | ||
308 | /* Write channel info and increment counter */ | 302 | /* Write channel info and increment counter */ |
309 | channels[count].center_freq = freq; | 303 | channels[count].center_freq = freq; |
310 | channels[count].band = (chfreq == CHANNEL_2GHZ) ? | 304 | channels[count].band = band; |
311 | IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; | ||
312 | switch (mode) { | 305 | switch (mode) { |
313 | case AR5K_MODE_11A: | 306 | case AR5K_MODE_11A: |
314 | case AR5K_MODE_11G: | 307 | case AR5K_MODE_11G: |