]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
rt2x00: Move watchdog work to kernel work_queue
authorIvo van Doorn <ivdoorn@gmail.com>
Mon, 11 Oct 2010 13:37:47 +0000 (15:37 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 11 Oct 2010 19:04:25 +0000 (15:04 -0400)
The watchdog function must run on a work_queue
which is independent of any other work inside rt2x00.

The main reasons, being that a broken work on the mac80211
work_queue can otherwise prevent the watchdog to run (while
in fact the watchdog could fix the issue). And on the other
hand because the watchdog relies on the completion of the
completion handlers for RX/TX which for the USB case, occur
on the mac80211 workqueue.

This fixes some "Queue %d failed to flush" errors, which were
caused by the watchdog function waiting on the completion
handler which was scheduled to run right after the watchdog.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00link.c

index 2322c84adc1c81d8ccc0a251b36fadc6769ffeb8..94fe589acfaabff06eac097fe7e3ae3e2f7ea310 100644 (file)
@@ -338,6 +338,11 @@ struct link {
 
        /*
         * Work structure for scheduling periodic watchdog monitoring.
+        * This work must be scheduled on the kernel workqueue, while
+        * all other work structures must be queued on the mac80211
+        * workqueue. This guarantees that the watchdog can schedule
+        * other work structures and wait for their completion in order
+        * to bring the device/driver back into the desired state.
         */
        struct delayed_work watchdog_work;
 };
index 46836f801b3545110cdd028abdede1d1993bf59c..b971d8798ebf8ce23e7efbc2d7b1c7b88233d107 100644 (file)
@@ -417,8 +417,7 @@ void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev)
            !test_bit(DRIVER_SUPPORT_WATCHDOG, &rt2x00dev->flags))
                return;
 
-       ieee80211_queue_delayed_work(rt2x00dev->hw,
-                                    &link->watchdog_work, WATCHDOG_INTERVAL);
+       schedule_delayed_work(&link->watchdog_work, WATCHDOG_INTERVAL);
 }
 
 void rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev)
@@ -442,8 +441,7 @@ static void rt2x00link_watchdog(struct work_struct *work)
        rt2x00dev->ops->lib->watchdog(rt2x00dev);
 
        if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
-               ieee80211_queue_delayed_work(rt2x00dev->hw,
-                                            &link->watchdog_work, WATCHDOG_INTERVAL);
+               schedule_delayed_work(&link->watchdog_work, WATCHDOG_INTERVAL);
 }
 
 void rt2x00link_register(struct rt2x00_dev *rt2x00dev)