commit 77ed58d5f9f022d808eac8dee773d8adf8d8155a Author: Jiri Slaby Date: Mon Jul 16 08:57:25 2007 +0200 hal: channels cleanup (remove ath_hal_mhz2ieee and co.) diff --git a/ath.c b/ath.c index 77c5acc..4be0b04 100644 --- a/ath.c +++ b/ath.c @@ -1400,7 +1400,7 @@ static unsigned int ath_copy_channels(struct ath_hw *ah, ch = all ? i + 1 : chans[i].chan; f = ath_ieee2mhz(ch); /* Check if channel is supported by the chipset */ - if (ath5k_check_channel(ah, f, chfreq) == false) + if (!ath5k_channel_ok(ah, f, chfreq)) continue; /* Match regulation domain */ diff --git a/ath5k.h b/ath5k.h index 5bdb6da..d89245e 100644 --- a/ath5k.h +++ b/ath5k.h @@ -1054,10 +1054,7 @@ u32 ath5k_hw_get_gpio(struct ath_hw *hal, u32 gpio); int ath5k_hw_set_gpio(struct ath_hw *hal, u32 gpio, u32 val); void ath5k_hw_set_gpio_intr(struct ath_hw *hal, unsigned int gpio, u32 interrupt_level); /* Regulatory Domain/Channels Setup */ -unsigned int ath_hal_mhz2ieee(unsigned int freq, u_int flags); -unsigned int ath_hal_ieee2mhz(unsigned int chan, u_int flags); -bool ath5k_check_channel(struct ath_hw *hal, u16 freq, unsigned int flags); -bool ath_hal_init_channels(struct ath_hw *hal, struct ieee80211_channel *channels, unsigned int max_channels, u_int *channels_size, enum ieee80211_countrycode country, u16 mode, bool outdoor, bool extended); +bool ath5k_channel_ok(struct ath_hw *hal, u16 freq, unsigned int flags); u16 ath5k_get_regdomain(struct ath_hw *hal); /* PHY/RF access functions */ int ath5k_hw_phy_calibrate(struct ath_hw *hal, struct ieee80211_channel *channel); diff --git a/ath5k_hw.c b/ath5k_hw.c index 4460105..00faf4d 100644 --- a/ath5k_hw.c +++ b/ath5k_hw.c @@ -4444,43 +4444,9 @@ void ath5k_hw_set_gpio_intr(struct ath_hw *hal, unsigned int gpio, \*********************************/ /* - * Following 2 functions come from net80211 - * TODO: These do not belong here, they have nothing - * to do with hw. I left them here temporarily for - * combatibility. - * M.F. - */ - -/* - * Convert MHz frequency to IEEE channel number. - */ -unsigned int -ath_hal_mhz2ieee(unsigned int freq, u_int flags) -{ - if (flags & CHANNEL_2GHZ) { /* 2GHz band */ - if (freq == 2484) /* Japan */ - return 14; - /* don't number non-IEEE channels unless we do channel tests */ - if ((freq >= 2412) && (freq < 2484)) - return (freq - 2407) / 5; - if (CHAN_DEBUG == 1) /* 15-26 */ - return ((freq - 2512)/20) + 15; - return 0; - } else if (flags & CHANNEL_5GHZ) { /* 5Ghz band */ - /* don't number non-IEEE channels unless we do channel tests */ - if (((freq >= 5150) && (freq <= 5825))|| CHAN_DEBUG == 1) - return (freq - 5000) / 5; - return 0; - } else - /* something is fishy, don't do anything */ - return 0; -} - -/* * Check if a channel is supported */ -bool -ath5k_check_channel(struct ath_hw *hal, u16 freq, unsigned int flags) +bool ath5k_channel_ok(struct ath_hw *hal, u16 freq, unsigned int flags) { /* Check if the channel is in our supported range */ if (flags & CHANNEL_2GHZ) { @@ -4495,8 +4461,7 @@ ath5k_check_channel(struct ath_hw *hal, u16 freq, unsigned int flags) return false; } -u16 -ath5k_get_regdomain(struct ath_hw *hal) +u16 ath5k_get_regdomain(struct ath_hw *hal) { u16 regdomain; enum ieee80211_regdomain ieee_regdomain; @@ -4539,8 +4504,8 @@ static u32 ath5k_hw_rf5110_chan2athchan(struct ieee80211_channel *channel) * newer chipsets like the AR5212A who have a completely * different RF/PHY part. */ - athchan = (ath5k_hw_bitswap((ath_hal_mhz2ieee(channel->freq, - channel->val) - 24) / 2, 5) << 1) | (1 << 6) | 0x1; + athchan = (ath5k_hw_bitswap((channel->chan - 24) / 2, 5) << 1) | + (1 << 6) | 0x1; return athchan; } @@ -4599,7 +4564,7 @@ static int ath5k_hw_rf5111_channel(struct ath_hw *hal, struct ieee80211_channel *channel) { struct ath5k_athchan_2ghz ath_channel_2ghz; - unsigned int ieee_channel, ath_channel; + unsigned int ath_channel = channel->chan; u32 data0, data1, clock; int ret; @@ -4607,12 +4572,10 @@ static int ath5k_hw_rf5111_channel(struct ath_hw *hal, * Set the channel on the RF5111 radio */ data0 = data1 = 0; - ath_channel = ieee_channel = ath_hal_mhz2ieee(channel->freq, - channel->val); if (channel->val & CHANNEL_2GHZ) { /* Map 2GHz channel to 5GHz Atheros channel ID */ - ret = ath5k_hw_rf5111_chan2athchan(ieee_channel, + ret = ath5k_hw_rf5111_chan2athchan(channel->chan, &ath_channel_2ghz); if (ret) return ret;