rt2x00: Use ieee80211_hw->workqueue again
authorIvo van Doorn <ivdoorn@gmail.com>
Fri, 4 Jul 2008 11:41:31 +0000 (13:41 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 8 Jul 2008 18:16:04 +0000 (14:16 -0400)
Remove the rt2x00 singlethreaded workqueue and move
the link tuner and packet filter scheduled work to
the ieee80211_hw->workqueue again.
The only exception is the interface scheduled work
handler which uses the mac80211 interface iterator
under the RTNL lock. This work needs to be handled
on the kernel workqueue to prevent lockdep issues.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00mac.c

index 1b28dad7f204e0a6e899ecf12168ccb653f4588c..c07d9ef383f0bc56fcabcc308370614f547a78b3 100644 (file)
@@ -787,8 +787,10 @@ struct rt2x00_dev {
 
        /*
         * Scheduled work.
+        * NOTE: intf_work will use ieee80211_iterate_active_interfaces()
+        * which means it cannot be placed on the hw->workqueue
+        * due to RTNL locking requirements.
         */
-       struct workqueue_struct *workqueue;
        struct work_struct intf_work;
        struct work_struct filter_work;
 
index 41b3289b82810b4bbd437b198c63c2c6c3898bd1..8086263e5fa525ac74c0fb071dcdfb615b00b02f 100644 (file)
@@ -74,7 +74,7 @@ static void rt2x00lib_start_link_tuner(struct rt2x00_dev *rt2x00dev)
 
        rt2x00lib_reset_link_tuner(rt2x00dev);
 
-       queue_delayed_work(rt2x00dev->workqueue,
+       queue_delayed_work(rt2x00dev->hw->workqueue,
                           &rt2x00dev->link.work, LINK_TUNE_INTERVAL);
 }
 
@@ -392,7 +392,7 @@ static void rt2x00lib_link_tuner(struct work_struct *work)
         * Increase tuner counter, and reschedule the next link tuner run.
         */
        rt2x00dev->link.count++;
-       queue_delayed_work(rt2x00dev->workqueue,
+       queue_delayed_work(rt2x00dev->hw->workqueue,
                           &rt2x00dev->link.work, LINK_TUNE_INTERVAL);
 }
 
@@ -496,7 +496,7 @@ void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
                                                   rt2x00lib_beacondone_iter,
                                                   rt2x00dev);
 
-       queue_work(rt2x00dev->workqueue, &rt2x00dev->intf_work);
+       schedule_work(&rt2x00dev->intf_work);
 }
 EXPORT_SYMBOL_GPL(rt2x00lib_beacondone);
 
@@ -1064,10 +1064,6 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
        /*
         * Initialize configuration work.
         */
-       rt2x00dev->workqueue = create_singlethread_workqueue("rt2x00lib");
-       if (!rt2x00dev->workqueue)
-               goto exit;
-
        INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled);
        INIT_WORK(&rt2x00dev->filter_work, rt2x00lib_packetfilter_scheduled);
        INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00lib_link_tuner);
@@ -1127,13 +1123,6 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
        rt2x00rfkill_free(rt2x00dev);
        rt2x00leds_unregister(rt2x00dev);
 
-       /*
-        * Stop all queued work. Note that most tasks will already be halted
-        * during rt2x00lib_disable_radio() and rt2x00lib_uninitialize().
-        */
-       flush_workqueue(rt2x00dev->workqueue);
-       destroy_workqueue(rt2x00dev->workqueue);
-
        /*
         * Free ieee80211_hw memory.
         */
index 1253da89295b71e49a60b2f29a88dd3e380a4d28..3a1fb6d47e5d48cddef370ac395ffdf6141ceeac 100644 (file)
@@ -431,7 +431,7 @@ void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
        if (!test_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags))
                rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
        else
-               queue_work(rt2x00dev->workqueue, &rt2x00dev->filter_work);
+               queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->filter_work);
 }
 EXPORT_SYMBOL_GPL(rt2x00mac_configure_filter);
 
@@ -512,7 +512,7 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
        memcpy(&intf->conf, bss_conf, sizeof(*bss_conf));
        if (delayed) {
                intf->delayed_flags |= delayed;
-               queue_work(rt2x00dev->workqueue, &rt2x00dev->intf_work);
+               schedule_work(&rt2x00dev->intf_work);
        }
        spin_unlock(&intf->lock);
 }