diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-07-29 20:08:07 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-04 16:44:14 -0400 |
commit | 42935ecaf4e784d0815afa9a7e5fe7e141157ca3 (patch) | |
tree | dc0a0dcfff761e98d8a2a23a7edc8f9182c2774c /drivers/net/wireless/rtl818x | |
parent | 64344d78228f6346a0462ba2d5fc03494aef4e6b (diff) |
mac80211: redefine usage of the mac80211 workqueue
The mac80211 workqueue exists to enable mac80211 and drivers
to queue their own work on a single threaded workqueue. mac80211
takes care to flush the workqueue during suspend but we never
really had requirements on drivers for how they should use
the workqueue in consideration for suspend.
We extend mac80211 to document how the mac80211 workqueue should
be used, how it should not be used and finally move raw access to
the workqueue to mac80211 only. Drivers and mac80211 use helpers
to queue work onto the mac80211 workqueue:
* ieee80211_queue_work()
* ieee80211_queue_delayed_work()
These helpers will now warn if mac80211 already completed its
suspend cycle and someone is trying to queue work. mac80211
flushes the mac80211 workqueue prior to suspend a few times,
but we haven't taken the care to ensure drivers won't add more
work after suspend. To help with this we add a warning when
someone tries to add work and mac80211 already completed the
suspend cycle.
Drivers should ensure they cancel any work or delayed work
in the mac80211 stop() callback.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtl818x')
-rw-r--r-- | drivers/net/wireless/rtl818x/rtl8187_dev.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rtl818x/rtl8187_leds.c | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c index c9b9dbe584c6..53f57dc52226 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c | |||
@@ -220,7 +220,7 @@ static void rtl8187_tx_cb(struct urb *urb) | |||
220 | * reading a register in the device. We are in interrupt mode | 220 | * reading a register in the device. We are in interrupt mode |
221 | * here, thus queue the skb and finish on a work queue. */ | 221 | * here, thus queue the skb and finish on a work queue. */ |
222 | skb_queue_tail(&priv->b_tx_status.queue, skb); | 222 | skb_queue_tail(&priv->b_tx_status.queue, skb); |
223 | queue_delayed_work(hw->workqueue, &priv->work, 0); | 223 | ieee80211_queue_delayed_work(hw, &priv->work, 0); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
diff --git a/drivers/net/wireless/rtl818x/rtl8187_leds.c b/drivers/net/wireless/rtl818x/rtl8187_leds.c index cf9f899fe0e6..a6cfb7e77994 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_leds.c +++ b/drivers/net/wireless/rtl818x/rtl8187_leds.c | |||
@@ -108,11 +108,11 @@ static void rtl8187_led_brightness_set(struct led_classdev *led_dev, | |||
108 | struct rtl8187_priv *priv = hw->priv; | 108 | struct rtl8187_priv *priv = hw->priv; |
109 | 109 | ||
110 | if (brightness == LED_OFF) { | 110 | if (brightness == LED_OFF) { |
111 | queue_delayed_work(hw->workqueue, &priv->led_off, 0); | 111 | ieee80211_queue_delayed_work(hw, &priv->led_off, 0); |
112 | /* The LED is off for 1/20 sec so that it just blinks. */ | 112 | /* The LED is off for 1/20 sec so that it just blinks. */ |
113 | queue_delayed_work(hw->workqueue, &priv->led_on, HZ / 20); | 113 | ieee80211_queue_delayed_work(hw, &priv->led_on, HZ / 20); |
114 | } else | 114 | } else |
115 | queue_delayed_work(hw->workqueue, &priv->led_on, 0); | 115 | ieee80211_queue_delayed_work(hw, &priv->led_on, 0); |
116 | } | 116 | } |
117 | 117 | ||
118 | static int rtl8187_register_led(struct ieee80211_hw *dev, | 118 | static int rtl8187_register_led(struct ieee80211_hw *dev, |
@@ -193,7 +193,7 @@ void rtl8187_leds_init(struct ieee80211_hw *dev, u16 custid) | |||
193 | err = rtl8187_register_led(dev, &priv->led_rx, name, | 193 | err = rtl8187_register_led(dev, &priv->led_rx, name, |
194 | ieee80211_get_rx_led_name(dev), ledpin); | 194 | ieee80211_get_rx_led_name(dev), ledpin); |
195 | if (!err) { | 195 | if (!err) { |
196 | queue_delayed_work(dev->workqueue, &priv->led_on, 0); | 196 | ieee80211_queue_delayed_work(dev, &priv->led_on, 0); |
197 | return; | 197 | return; |
198 | } | 198 | } |
199 | /* registration of RX LED failed - unregister TX */ | 199 | /* registration of RX LED failed - unregister TX */ |
@@ -209,7 +209,7 @@ void rtl8187_leds_exit(struct ieee80211_hw *dev) | |||
209 | struct rtl8187_priv *priv = dev->priv; | 209 | struct rtl8187_priv *priv = dev->priv; |
210 | 210 | ||
211 | /* turn the LED off before exiting */ | 211 | /* turn the LED off before exiting */ |
212 | queue_delayed_work(dev->workqueue, &priv->led_off, 0); | 212 | ieee80211_queue_delayed_work(dev, &priv->led_off, 0); |
213 | cancel_delayed_work_sync(&priv->led_off); | 213 | cancel_delayed_work_sync(&priv->led_off); |
214 | cancel_delayed_work_sync(&priv->led_on); | 214 | cancel_delayed_work_sync(&priv->led_on); |
215 | rtl8187_unregister_led(&priv->led_rx); | 215 | rtl8187_unregister_led(&priv->led_rx); |