*/
struct mutex csr_mutex;
+ /*
+ * Mutex to synchronize config and link tuner.
+ */
+ struct mutex conf_mutex;
/*
* Current packet filter configuration for the device.
* This contains all currently active FIF_* flags send
spin_lock_init(&rt2x00dev->irqmask_lock);
mutex_init(&rt2x00dev->csr_mutex);
+ mutex_init(&rt2x00dev->conf_mutex);
INIT_LIST_HEAD(&rt2x00dev->bar_list);
spin_lock_init(&rt2x00dev->bar_list_lock);
test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags))
return;
+ /* Do not race with rt2x00mac_config(). */
+ mutex_lock(&rt2x00dev->conf_mutex);
+
if (rt2x00dev->intf_sta_count)
rt2x00link_tuner_sta(rt2x00dev, link);
(link->count % (VCO_SECONDS / LINK_TUNE_SECONDS)) == 0)
rt2x00dev->ops->lib->vco_calibration(rt2x00dev);
+ mutex_unlock(&rt2x00dev->conf_mutex);
+
/*
* Increase tuner counter, and reschedule the next link tuner run.
*/
*/
rt2x00queue_stop_queue(rt2x00dev->rx);
+ /* Do not race with with link tuner. */
+ mutex_lock(&rt2x00dev->conf_mutex);
+
/*
* When we've just turned on the radio, we want to reprogram
* everything to ensure a consistent state
*/
rt2x00lib_config_antenna(rt2x00dev, rt2x00dev->default_ant);
+ mutex_unlock(&rt2x00dev->conf_mutex);
+
/* Turn RX back on */
rt2x00queue_start_queue(rt2x00dev->rx);