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>
This commit is contained in:
committed by
John W. Linville
parent
7755bad9ff
commit
90c02d72ff
@@ -241,18 +241,6 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re
|
|||||||
* Channel/mode setup *
|
* Channel/mode setup *
|
||||||
\********************/
|
\********************/
|
||||||
|
|
||||||
/*
|
|
||||||
* Convert IEEE channel number to MHz frequency.
|
|
||||||
*/
|
|
||||||
static inline short
|
|
||||||
ath5k_ieee2mhz(short chan)
|
|
||||||
{
|
|
||||||
if (chan <= 14 || chan >= 27)
|
|
||||||
return ieee80211chan2mhz(chan);
|
|
||||||
else
|
|
||||||
return 2212 + chan * 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns true for the channel numbers used without all_channels modparam.
|
* Returns true for the channel numbers used without all_channels modparam.
|
||||||
*/
|
*/
|
||||||
@@ -274,6 +262,7 @@ ath5k_copy_channels(struct ath5k_hw *ah,
|
|||||||
unsigned int max)
|
unsigned int max)
|
||||||
{
|
{
|
||||||
unsigned int i, count, size, chfreq, freq, ch;
|
unsigned int i, count, size, chfreq, freq, ch;
|
||||||
|
enum ieee80211_band band;
|
||||||
|
|
||||||
if (!test_bit(mode, ah->ah_modes))
|
if (!test_bit(mode, ah->ah_modes))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -283,11 +272,13 @@ ath5k_copy_channels(struct ath5k_hw *ah,
|
|||||||
/* 1..220, but 2GHz frequencies are filtered by check_channel */
|
/* 1..220, but 2GHz frequencies are filtered by check_channel */
|
||||||
size = 220 ;
|
size = 220 ;
|
||||||
chfreq = CHANNEL_5GHZ;
|
chfreq = CHANNEL_5GHZ;
|
||||||
|
band = IEEE80211_BAND_5GHZ;
|
||||||
break;
|
break;
|
||||||
case AR5K_MODE_11B:
|
case AR5K_MODE_11B:
|
||||||
case AR5K_MODE_11G:
|
case AR5K_MODE_11G:
|
||||||
size = 26;
|
size = 26;
|
||||||
chfreq = CHANNEL_2GHZ;
|
chfreq = CHANNEL_2GHZ;
|
||||||
|
band = IEEE80211_BAND_2GHZ;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ATH5K_WARN(ah->ah_sc, "bad mode, not copying channels\n");
|
ATH5K_WARN(ah->ah_sc, "bad mode, not copying channels\n");
|
||||||
@@ -296,7 +287,10 @@ ath5k_copy_channels(struct ath5k_hw *ah,
|
|||||||
|
|
||||||
for (i = 0, count = 0; i < size && max > 0; i++) {
|
for (i = 0, count = 0; i < size && max > 0; i++) {
|
||||||
ch = i + 1 ;
|
ch = i + 1 ;
|
||||||
freq = ath5k_ieee2mhz(ch);
|
freq = ieee80211_channel_to_frequency(ch, band);
|
||||||
|
|
||||||
|
if (freq == 0) /* mapping failed - not a standard channel */
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Check if channel is supported by the chipset */
|
/* Check if channel is supported by the chipset */
|
||||||
if (!ath5k_channel_ok(ah, freq, chfreq))
|
if (!ath5k_channel_ok(ah, freq, chfreq))
|
||||||
@@ -307,8 +301,7 @@ ath5k_copy_channels(struct ath5k_hw *ah,
|
|||||||
|
|
||||||
/* Write channel info and increment counter */
|
/* Write channel info and increment counter */
|
||||||
channels[count].center_freq = freq;
|
channels[count].center_freq = freq;
|
||||||
channels[count].band = (chfreq == CHANNEL_2GHZ) ?
|
channels[count].band = band;
|
||||||
IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case AR5K_MODE_11A:
|
case AR5K_MODE_11A:
|
||||||
case AR5K_MODE_11G:
|
case AR5K_MODE_11G:
|
||||||
|
Reference in New Issue
Block a user