diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2009-08-08 17:53:04 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-14 09:13:51 -0400 |
commit | bdfa500b8b8ca87dfe7a311f569fe8b39746c299 (patch) | |
tree | 4b49d31360d0a335154c30165efc422d1e856459 /drivers/net/wireless | |
parent | 4d30d309a3be84dfb01743ceb4652405204a80a0 (diff) |
rt2x00: Remove usage of deprecated radio_enabled & IEEE80211_CONF_CHANGE_RADIO_ENABLED
In the config() callback function the fields radio_enabled and
the change flag IEEE80211_CONF_CHANGE_RADIO_ENABLED have been
deprecated. This removes the usage of those fields by improving
antenna change detection in the antenna configuration function.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00config.c | 22 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00link.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00mac.c | 54 |
4 files changed, 50 insertions, 45 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c index 3845316ccd39..3501788ab498 100644 --- a/drivers/net/wireless/rt2x00/rt2x00config.c +++ b/drivers/net/wireless/rt2x00/rt2x00config.c | |||
@@ -124,8 +124,9 @@ enum antenna rt2x00lib_config_antenna_check(enum antenna current_ant, | |||
124 | } | 124 | } |
125 | 125 | ||
126 | void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, | 126 | void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, |
127 | struct antenna_setup ant) | 127 | struct antenna_setup config) |
128 | { | 128 | { |
129 | struct link_ant *ant = &rt2x00dev->link.ant; | ||
129 | struct antenna_setup *def = &rt2x00dev->default_ant; | 130 | struct antenna_setup *def = &rt2x00dev->default_ant; |
130 | struct antenna_setup *active = &rt2x00dev->link.ant.active; | 131 | struct antenna_setup *active = &rt2x00dev->link.ant.active; |
131 | 132 | ||
@@ -134,14 +135,23 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
134 | * ANTENNA_SW_DIVERSITY state to the driver. | 135 | * ANTENNA_SW_DIVERSITY state to the driver. |
135 | * If that happens, fallback to hardware defaults, | 136 | * If that happens, fallback to hardware defaults, |
136 | * or our own default. | 137 | * or our own default. |
138 | * If diversity handling is active for a particular antenna, | ||
139 | * we shouldn't overwrite that antenna. | ||
137 | * The calls to rt2x00lib_config_antenna_check() | 140 | * The calls to rt2x00lib_config_antenna_check() |
138 | * might have caused that we restore back to the already | 141 | * might have caused that we restore back to the already |
139 | * active setting. If that has happened we can quit. | 142 | * active setting. If that has happened we can quit. |
140 | */ | 143 | */ |
141 | ant.rx = rt2x00lib_config_antenna_check(ant.rx, def->rx); | 144 | if (!(ant->flags & ANTENNA_RX_DIVERSITY)) |
142 | ant.tx = rt2x00lib_config_antenna_check(ant.tx, def->tx); | 145 | config.rx = rt2x00lib_config_antenna_check(config.rx, def->rx); |
146 | else | ||
147 | config.rx = active->rx; | ||
143 | 148 | ||
144 | if (ant.rx == active->rx && ant.tx == active->tx) | 149 | if (!(ant->flags & ANTENNA_TX_DIVERSITY)) |
150 | config.tx = rt2x00lib_config_antenna_check(config.tx, def->tx); | ||
151 | else | ||
152 | config.tx = active->tx; | ||
153 | |||
154 | if (config.rx == active->rx && config.tx == active->tx) | ||
145 | return; | 155 | return; |
146 | 156 | ||
147 | /* | 157 | /* |
@@ -156,11 +166,11 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
156 | * The latter is required since we need to recalibrate the | 166 | * The latter is required since we need to recalibrate the |
157 | * noise-sensitivity ratio for the new setup. | 167 | * noise-sensitivity ratio for the new setup. |
158 | */ | 168 | */ |
159 | rt2x00dev->ops->lib->config_ant(rt2x00dev, &ant); | 169 | rt2x00dev->ops->lib->config_ant(rt2x00dev, &config); |
160 | 170 | ||
161 | rt2x00link_reset_tuner(rt2x00dev, true); | 171 | rt2x00link_reset_tuner(rt2x00dev, true); |
162 | 172 | ||
163 | memcpy(active, &ant, sizeof(ant)); | 173 | memcpy(active, &config, sizeof(config)); |
164 | 174 | ||
165 | if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) | 175 | if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) |
166 | rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK); | 176 | rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index db54fcc94c8f..e0348cc22d16 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -785,6 +785,13 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) | |||
785 | rt2x00dev->intf_sta_count = 0; | 785 | rt2x00dev->intf_sta_count = 0; |
786 | rt2x00dev->intf_associated = 0; | 786 | rt2x00dev->intf_associated = 0; |
787 | 787 | ||
788 | /* Enable the radio */ | ||
789 | retval = rt2x00lib_enable_radio(rt2x00dev); | ||
790 | if (retval) { | ||
791 | rt2x00queue_uninitialize(rt2x00dev); | ||
792 | return retval; | ||
793 | } | ||
794 | |||
788 | set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags); | 795 | set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags); |
789 | 796 | ||
790 | return 0; | 797 | return 0; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c index 917831689ccd..fe951dc9bacf 100644 --- a/drivers/net/wireless/rt2x00/rt2x00link.c +++ b/drivers/net/wireless/rt2x00/rt2x00link.c | |||
@@ -219,6 +219,7 @@ static void rt2x00lib_antenna_diversity_eval(struct rt2x00_dev *rt2x00dev) | |||
219 | static void rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev) | 219 | static void rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev) |
220 | { | 220 | { |
221 | struct link_ant *ant = &rt2x00dev->link.ant; | 221 | struct link_ant *ant = &rt2x00dev->link.ant; |
222 | unsigned int flags = ant->flags; | ||
222 | 223 | ||
223 | /* | 224 | /* |
224 | * Determine if software diversity is enabled for | 225 | * Determine if software diversity is enabled for |
@@ -226,13 +227,13 @@ static void rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev) | |||
226 | * Always perform this check since within the link | 227 | * Always perform this check since within the link |
227 | * tuner interval the configuration might have changed. | 228 | * tuner interval the configuration might have changed. |
228 | */ | 229 | */ |
229 | ant->flags &= ~ANTENNA_RX_DIVERSITY; | 230 | flags &= ~ANTENNA_RX_DIVERSITY; |
230 | ant->flags &= ~ANTENNA_TX_DIVERSITY; | 231 | flags &= ~ANTENNA_TX_DIVERSITY; |
231 | 232 | ||
232 | if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY) | 233 | if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY) |
233 | ant->flags |= ANTENNA_RX_DIVERSITY; | 234 | flags |= ANTENNA_RX_DIVERSITY; |
234 | if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY) | 235 | if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY) |
235 | ant->flags |= ANTENNA_TX_DIVERSITY; | 236 | flags |= ANTENNA_TX_DIVERSITY; |
236 | 237 | ||
237 | if (!(ant->flags & ANTENNA_RX_DIVERSITY) && | 238 | if (!(ant->flags & ANTENNA_RX_DIVERSITY) && |
238 | !(ant->flags & ANTENNA_TX_DIVERSITY)) { | 239 | !(ant->flags & ANTENNA_TX_DIVERSITY)) { |
@@ -240,6 +241,9 @@ static void rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev) | |||
240 | return; | 241 | return; |
241 | } | 242 | } |
242 | 243 | ||
244 | /* Update flags */ | ||
245 | ant->flags = flags; | ||
246 | |||
243 | /* | 247 | /* |
244 | * If we have only sampled the data over the last period | 248 | * If we have only sampled the data over the last period |
245 | * we should now harvest the data. Otherwise just evaluate | 249 | * we should now harvest the data. Otherwise just evaluate |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 81febdfd6639..4164fce05987 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -338,7 +338,6 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed) | |||
338 | { | 338 | { |
339 | struct rt2x00_dev *rt2x00dev = hw->priv; | 339 | struct rt2x00_dev *rt2x00dev = hw->priv; |
340 | struct ieee80211_conf *conf = &hw->conf; | 340 | struct ieee80211_conf *conf = &hw->conf; |
341 | int status; | ||
342 | 341 | ||
343 | /* | 342 | /* |
344 | * mac80211 might be calling this function while we are trying | 343 | * mac80211 might be calling this function while we are trying |
@@ -348,44 +347,29 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed) | |||
348 | return 0; | 347 | return 0; |
349 | 348 | ||
350 | /* | 349 | /* |
351 | * Only change device state when the radio is enabled. It does not | 350 | * Some configuration parameters (e.g. channel and antenna values) can |
352 | * matter what parameters we have configured when the radio is disabled | 351 | * only be set when the radio is enabled, but do require the RX to |
353 | * because we won't be able to send or receive anyway. Also note that | 352 | * be off. |
354 | * some configuration parameters (e.g. channel and antenna values) can | ||
355 | * only be set when the radio is enabled. | ||
356 | */ | 353 | */ |
357 | if (conf->radio_enabled) { | 354 | rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF); |
358 | /* For programming the values, we have to turn RX off */ | ||
359 | rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF); | ||
360 | 355 | ||
361 | /* Enable the radio */ | 356 | /* |
362 | status = rt2x00lib_enable_radio(rt2x00dev); | 357 | * When we've just turned on the radio, we want to reprogram |
363 | if (unlikely(status)) | 358 | * everything to ensure a consistent state |
364 | return status; | 359 | */ |
360 | rt2x00lib_config(rt2x00dev, conf, changed); | ||
365 | 361 | ||
366 | /* | 362 | /* |
367 | * When we've just turned on the radio, we want to reprogram | 363 | * After the radio has been enabled we need to configure |
368 | * everything to ensure a consistent state | 364 | * the antenna to the default settings. rt2x00lib_config_antenna() |
369 | */ | 365 | * should determine if any action should be taken based on |
370 | rt2x00lib_config(rt2x00dev, conf, changed); | 366 | * checking if diversity has been enabled or no antenna changes |
367 | * have been made since the last configuration change. | ||
368 | */ | ||
369 | rt2x00lib_config_antenna(rt2x00dev, rt2x00dev->default_ant); | ||
371 | 370 | ||
372 | /* | 371 | /* Turn RX back on */ |
373 | * The radio was enabled, configure the antenna to the | 372 | rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON); |
374 | * default settings, the link tuner will later start | ||
375 | * continue configuring the antenna based on the software | ||
376 | * diversity. But for non-diversity configurations, we need | ||
377 | * to have configured the correct state now. | ||
378 | */ | ||
379 | if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) | ||
380 | rt2x00lib_config_antenna(rt2x00dev, | ||
381 | rt2x00dev->default_ant); | ||
382 | |||
383 | /* Turn RX back on */ | ||
384 | rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON); | ||
385 | } else { | ||
386 | /* Disable the radio */ | ||
387 | rt2x00lib_disable_radio(rt2x00dev); | ||
388 | } | ||
389 | 373 | ||
390 | return 0; | 374 | return 0; |
391 | } | 375 | } |