Commit 18874173 authored by Jiri Slaby's avatar Jiri Slaby Committed by John W. Linville

ath5k: cleanup channel to eprom_mode function

Stop returning negative values from ath5k_eeprom_mode_from_channel.
Yell loudly about that case in that function instead and return the
default/zero/mode A. This cleans up the callers, but needs to pass ah
down to ath5k_eeprom_mode_from_channel for ATH5K_WARN. For that
purpose we also need the declaration to be moved to ath5k.h.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Acked-by: default avatarNick Kossifidis <mickflemm@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent cd3d03d5
...@@ -1523,7 +1523,8 @@ int ath5k_hw_dma_stop(struct ath5k_hw *ah); ...@@ -1523,7 +1523,8 @@ int ath5k_hw_dma_stop(struct ath5k_hw *ah);
/* EEPROM access functions */ /* EEPROM access functions */
int ath5k_eeprom_init(struct ath5k_hw *ah); int ath5k_eeprom_init(struct ath5k_hw *ah);
void ath5k_eeprom_detach(struct ath5k_hw *ah); void ath5k_eeprom_detach(struct ath5k_hw *ah);
int ath5k_eeprom_mode_from_channel(struct ath5k_hw *ah,
struct ieee80211_channel *channel);
/* Protocol Control Unit Functions */ /* Protocol Control Unit Functions */
/* Helpers */ /* Helpers */
......
...@@ -1779,7 +1779,8 @@ ath5k_eeprom_detach(struct ath5k_hw *ah) ...@@ -1779,7 +1779,8 @@ ath5k_eeprom_detach(struct ath5k_hw *ah)
} }
int int
ath5k_eeprom_mode_from_channel(struct ieee80211_channel *channel) ath5k_eeprom_mode_from_channel(struct ath5k_hw *ah,
struct ieee80211_channel *channel)
{ {
switch (channel->hw_value) { switch (channel->hw_value) {
case AR5K_MODE_11A: case AR5K_MODE_11A:
...@@ -1789,6 +1790,7 @@ ath5k_eeprom_mode_from_channel(struct ieee80211_channel *channel) ...@@ -1789,6 +1790,7 @@ ath5k_eeprom_mode_from_channel(struct ieee80211_channel *channel)
case AR5K_MODE_11B: case AR5K_MODE_11B:
return AR5K_EEPROM_MODE_11B; return AR5K_EEPROM_MODE_11B;
default: default:
return -1; ATH5K_WARN(ah, "channel is not A/B/G!");
return AR5K_EEPROM_MODE_11A;
} }
} }
...@@ -493,6 +493,3 @@ struct ath5k_eeprom_info { ...@@ -493,6 +493,3 @@ struct ath5k_eeprom_info {
/* Antenna raw switch tables */ /* Antenna raw switch tables */
u32 ee_antenna[AR5K_EEPROM_N_MODES][AR5K_ANT_MAX]; u32 ee_antenna[AR5K_EEPROM_N_MODES][AR5K_ANT_MAX];
}; };
int
ath5k_eeprom_mode_from_channel(struct ieee80211_channel *channel);
...@@ -1612,11 +1612,7 @@ ath5k_hw_update_noise_floor(struct ath5k_hw *ah) ...@@ -1612,11 +1612,7 @@ ath5k_hw_update_noise_floor(struct ath5k_hw *ah)
ah->ah_cal_mask |= AR5K_CALIBRATION_NF; ah->ah_cal_mask |= AR5K_CALIBRATION_NF;
ee_mode = ath5k_eeprom_mode_from_channel(ah->ah_current_channel); ee_mode = ath5k_eeprom_mode_from_channel(ah, ah->ah_current_channel);
if (WARN_ON(ee_mode < 0)) {
ah->ah_cal_mask &= ~AR5K_CALIBRATION_NF;
return;
}
/* completed NF calibration, test threshold */ /* completed NF calibration, test threshold */
nf = ath5k_hw_read_measured_noise_floor(ah); nf = ath5k_hw_read_measured_noise_floor(ah);
...@@ -2317,12 +2313,7 @@ ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode) ...@@ -2317,12 +2313,7 @@ ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode)
def_ant = ah->ah_def_ant; def_ant = ah->ah_def_ant;
ee_mode = ath5k_eeprom_mode_from_channel(channel); ee_mode = ath5k_eeprom_mode_from_channel(ah, channel);
if (ee_mode < 0) {
ATH5K_ERR(ah,
"invalid channel: %d\n", channel->center_freq);
return;
}
switch (ant_mode) { switch (ant_mode) {
case AR5K_ANTMODE_DEFAULT: case AR5K_ANTMODE_DEFAULT:
...@@ -3622,12 +3613,7 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, ...@@ -3622,12 +3613,7 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
return -EINVAL; return -EINVAL;
} }
ee_mode = ath5k_eeprom_mode_from_channel(channel); ee_mode = ath5k_eeprom_mode_from_channel(ah, channel);
if (ee_mode < 0) {
ATH5K_ERR(ah,
"invalid channel: %d\n", channel->center_freq);
return -EINVAL;
}
/* Initialize TX power table */ /* Initialize TX power table */
switch (ah->ah_radio) { switch (ah->ah_radio) {
......
...@@ -984,9 +984,7 @@ ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah, ...@@ -984,9 +984,7 @@ ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
if (ah->ah_version == AR5K_AR5210) if (ah->ah_version == AR5K_AR5210)
return; return;
ee_mode = ath5k_eeprom_mode_from_channel(channel); ee_mode = ath5k_eeprom_mode_from_channel(ah, channel);
if (WARN_ON(ee_mode < 0))
return;
/* Adjust power delta for channel 14 */ /* Adjust power delta for channel 14 */
if (channel->center_freq == 2484) if (channel->center_freq == 2484)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment