aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath5k/phy.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@winlab.rutgers.edu>2008-02-03 21:51:49 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-02-29 15:19:37 -0500
commit400ec45a02b2a9ef75c26c490ba80801d19b7e7b (patch)
tree46e284462d150443c173519be9b7e680792f18e7 /drivers/net/wireless/ath5k/phy.c
parentd8ee398d183df36083e41e9162b0cf014f38f482 (diff)
ath5k: Cleanup after API changes
Cleanup after API changes patch (checkpatch.pl stuff) and on ath5k_hw_channel() make use of the existing ath5k_channel_ok() instead of re-implementing the checks again. This was necessary to make the code cleaner and fit the 80-chars wide limit so sending it within the same patch. Finally make a note that we *may* eventually move cap_range stuff to struct wiphy (band frequency range capabilities). This information can later be exported to userspace, for example, and giving it access to mac80211 and drivers in general can come in handy. Changes to initvals.c, phy.c Changes-licensed-under: ISC Changes to ath5k.h, base.c Changes-licensed-under: 3-Clause-BSD Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath5k/phy.c')
-rw-r--r--drivers/net/wireless/ath5k/phy.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/net/wireless/ath5k/phy.c b/drivers/net/wireless/ath5k/phy.c
index 8b576b314cf5..248c0f545f24 100644
--- a/drivers/net/wireless/ath5k/phy.c
+++ b/drivers/net/wireless/ath5k/phy.c
@@ -1124,7 +1124,7 @@ static int ath5k_hw_rf5112_rfregs(struct ath5k_hw *ah,
1124 rf = ah->ah_rf_banks; 1124 rf = ah->ah_rf_banks;
1125 1125
1126 if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_2112A 1126 if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_2112A
1127 && !test_bit(AR5K_MODE_11A, ah->ah_capabilities.cap_mode)){ 1127 && !test_bit(AR5K_MODE_11A, ah->ah_capabilities.cap_mode)) {
1128 rf_ini = rfregs_2112a; 1128 rf_ini = rfregs_2112a;
1129 rf_size = ARRAY_SIZE(rfregs_5112a); 1129 rf_size = ARRAY_SIZE(rfregs_5112a);
1130 if (mode < 2) { 1130 if (mode < 2) {
@@ -1445,9 +1445,10 @@ static u32 ath5k_hw_rf5110_chan2athchan(struct ieee80211_channel *channel)
1445 * newer chipsets like the AR5212A who have a completely 1445 * newer chipsets like the AR5212A who have a completely
1446 * different RF/PHY part. 1446 * different RF/PHY part.
1447 */ 1447 */
1448 athchan = (ath5k_hw_bitswap((ieee80211_frequency_to_channel(channel->center_freq) - 24) / 2, 5) << 1) | 1448 athchan = (ath5k_hw_bitswap(
1449 (1 << 6) | 0x1; 1449 (ieee80211_frequency_to_channel(
1450 1450 channel->center_freq) - 24) / 2, 5)
1451 << 1) | (1 << 6) | 0x1;
1451 return athchan; 1452 return athchan;
1452} 1453}
1453 1454
@@ -1506,7 +1507,8 @@ static int ath5k_hw_rf5111_channel(struct ath5k_hw *ah,
1506 struct ieee80211_channel *channel) 1507 struct ieee80211_channel *channel)
1507{ 1508{
1508 struct ath5k_athchan_2ghz ath5k_channel_2ghz; 1509 struct ath5k_athchan_2ghz ath5k_channel_2ghz;
1509 unsigned int ath5k_channel = ieee80211_frequency_to_channel(channel->center_freq); 1510 unsigned int ath5k_channel =
1511 ieee80211_frequency_to_channel(channel->center_freq);
1510 u32 data0, data1, clock; 1512 u32 data0, data1, clock;
1511 int ret; 1513 int ret;
1512 1514
@@ -1517,8 +1519,9 @@ static int ath5k_hw_rf5111_channel(struct ath5k_hw *ah,
1517 1519
1518 if (channel->hw_value & CHANNEL_2GHZ) { 1520 if (channel->hw_value & CHANNEL_2GHZ) {
1519 /* Map 2GHz channel to 5GHz Atheros channel ID */ 1521 /* Map 2GHz channel to 5GHz Atheros channel ID */
1520 ret = ath5k_hw_rf5111_chan2athchan(ieee80211_frequency_to_channel(channel->center_freq), 1522 ret = ath5k_hw_rf5111_chan2athchan(
1521 &ath5k_channel_2ghz); 1523 ieee80211_frequency_to_channel(channel->center_freq),
1524 &ath5k_channel_2ghz);
1522 if (ret) 1525 if (ret)
1523 return ret; 1526 return ret;
1524 1527
@@ -1599,19 +1602,17 @@ static int ath5k_hw_rf5112_channel(struct ath5k_hw *ah,
1599int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel) 1602int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
1600{ 1603{
1601 int ret; 1604 int ret;
1602
1603 /* 1605 /*
1604 * Check bounds supported by the PHY 1606 * Check bounds supported by the PHY (we don't care about regultory
1605 * (don't care about regulation restrictions at this point) 1607 * restrictions at this point). Note: hw_value already has the band
1606 */ 1608 * (CHANNEL_2GHZ, or CHANNEL_5GHZ) so we inform ath5k_channel_ok()
1607 if ((channel->center_freq < ah->ah_capabilities.cap_range.range_2ghz_min || 1609 * of the band by that */
1608 channel->center_freq > ah->ah_capabilities.cap_range.range_2ghz_max) && 1610 if (!ath5k_channel_ok(ah, channel->center_freq, channel->hw_value)) {
1609 (channel->center_freq < ah->ah_capabilities.cap_range.range_5ghz_min ||
1610 channel->center_freq > ah->ah_capabilities.cap_range.range_5ghz_max)) {
1611 ATH5K_ERR(ah->ah_sc, 1611 ATH5K_ERR(ah->ah_sc,
1612 "channel out of supported range (%u MHz)\n", 1612 "channel frequency (%u MHz) out of supported "
1613 "band range\n",
1613 channel->center_freq); 1614 channel->center_freq);
1614 return -EINVAL; 1615 return -EINVAL;
1615 } 1616 }
1616 1617
1617 /* 1618 /*