aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-07-29 20:08:07 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-04 16:44:14 -0400
commit42935ecaf4e784d0815afa9a7e5fe7e141157ca3 (patch)
treedc0a0dcfff761e98d8a2a23a7edc8f9182c2774c /drivers/net/wireless/ath
parent64344d78228f6346a0462ba2d5fc03494aef4e6b (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/ath')
-rw-r--r--drivers/net/wireless/ath/ar9170/led.c11
-rw-r--r--drivers/net/wireless/ath/ar9170/main.c26
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c15
-rw-r--r--drivers/net/wireless/ath/ath9k/virtual.c17
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c2
5 files changed, 40 insertions, 31 deletions
diff --git a/drivers/net/wireless/ath/ar9170/led.c b/drivers/net/wireless/ath/ar9170/led.c
index 63fda6cd2101..86c4e79f6bc8 100644
--- a/drivers/net/wireless/ath/ar9170/led.c
+++ b/drivers/net/wireless/ath/ar9170/led.c
@@ -90,9 +90,12 @@ static void ar9170_update_leds(struct work_struct *work)
90 ar9170_set_leds_state(ar, led_val); 90 ar9170_set_leds_state(ar, led_val);
91 mutex_unlock(&ar->mutex); 91 mutex_unlock(&ar->mutex);
92 92
93 if (rerun) 93 if (!rerun)
94 queue_delayed_work(ar->hw->workqueue, &ar->led_work, 94 return;
95 msecs_to_jiffies(blink_delay)); 95
96 ieee80211_queue_delayed_work(ar->hw,
97 &ar->led_work,
98 msecs_to_jiffies(blink_delay));
96} 99}
97 100
98static void ar9170_led_brightness_set(struct led_classdev *led, 101static void ar9170_led_brightness_set(struct led_classdev *led,
@@ -110,7 +113,7 @@ static void ar9170_led_brightness_set(struct led_classdev *led,
110 } 113 }
111 114
112 if (likely(IS_ACCEPTING_CMD(ar) && arl->toggled)) 115 if (likely(IS_ACCEPTING_CMD(ar) && arl->toggled))
113 queue_delayed_work(ar->hw->workqueue, &ar->led_work, HZ/10); 116 ieee80211_queue_delayed_work(ar->hw, &ar->led_work, HZ/10);
114} 117}
115 118
116static int ar9170_register_led(struct ar9170 *ar, int i, char *name, 119static int ar9170_register_led(struct ar9170 *ar, int i, char *name,
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c
index 099ed3c3ba28..4fc389ae74b4 100644
--- a/drivers/net/wireless/ath/ar9170/main.c
+++ b/drivers/net/wireless/ath/ar9170/main.c
@@ -595,10 +595,12 @@ static void ar9170_tx_janitor(struct work_struct *work)
595 595
596 ar9170_tx_fake_ampdu_status(ar); 596 ar9170_tx_fake_ampdu_status(ar);
597 597
598 if (resched) 598 if (!resched)
599 queue_delayed_work(ar->hw->workqueue, 599 return;
600 &ar->tx_janitor, 600
601 msecs_to_jiffies(AR9170_JANITOR_DELAY)); 601 ieee80211_queue_delayed_work(ar->hw,
602 &ar->tx_janitor,
603 msecs_to_jiffies(AR9170_JANITOR_DELAY));
602} 604}
603 605
604void ar9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len) 606void ar9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len)
@@ -648,7 +650,7 @@ void ar9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len)
648 * pre-TBTT event 650 * pre-TBTT event
649 */ 651 */
650 if (ar->vif && ar->vif->type == NL80211_IFTYPE_AP) 652 if (ar->vif && ar->vif->type == NL80211_IFTYPE_AP)
651 queue_work(ar->hw->workqueue, &ar->beacon_work); 653 ieee80211_queue_work(ar->hw, &ar->beacon_work);
652 break; 654 break;
653 655
654 case 0xc2: 656 case 0xc2:
@@ -1825,10 +1827,12 @@ static void ar9170_tx(struct ar9170 *ar)
1825 } 1827 }
1826 } 1828 }
1827 1829
1828 if (schedule_garbagecollector) 1830 if (!schedule_garbagecollector)
1829 queue_delayed_work(ar->hw->workqueue, 1831 return;
1830 &ar->tx_janitor, 1832
1831 msecs_to_jiffies(AR9170_JANITOR_DELAY)); 1833 ieee80211_queue_delayed_work(ar->hw,
1834 &ar->tx_janitor,
1835 msecs_to_jiffies(AR9170_JANITOR_DELAY));
1832} 1836}
1833 1837
1834static bool ar9170_tx_ampdu_queue(struct ar9170 *ar, struct sk_buff *skb) 1838static bool ar9170_tx_ampdu_queue(struct ar9170 *ar, struct sk_buff *skb)
@@ -2157,7 +2161,7 @@ static void ar9170_op_configure_filter(struct ieee80211_hw *hw,
2157 } 2161 }
2158 2162
2159 if (likely(IS_STARTED(ar))) 2163 if (likely(IS_STARTED(ar)))
2160 queue_work(ar->hw->workqueue, &ar->filter_config_work); 2164 ieee80211_queue_work(ar->hw, &ar->filter_config_work);
2161} 2165}
2162 2166
2163static void ar9170_op_bss_info_changed(struct ieee80211_hw *hw, 2167static void ar9170_op_bss_info_changed(struct ieee80211_hw *hw,
@@ -2415,7 +2419,7 @@ static void ar9170_sta_notify(struct ieee80211_hw *hw,
2415 } 2419 }
2416 2420
2417 if (IS_STARTED(ar) && ar->filter_changed) 2421 if (IS_STARTED(ar) && ar->filter_changed)
2418 queue_work(ar->hw->workqueue, &ar->filter_config_work); 2422 ieee80211_queue_work(ar->hw, &ar->filter_config_work);
2419} 2423}
2420 2424
2421static int ar9170_get_stats(struct ieee80211_hw *hw, 2425static int ar9170_get_stats(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index cf44623b5cd2..292ac2b41891 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -973,10 +973,11 @@ static void ath_led_blink_work(struct work_struct *work)
973 ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 973 ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN,
974 (sc->sc_flags & SC_OP_LED_ON) ? 1 : 0); 974 (sc->sc_flags & SC_OP_LED_ON) ? 1 : 0);
975 975
976 queue_delayed_work(sc->hw->workqueue, &sc->ath_led_blink_work, 976 ieee80211_queue_delayed_work(sc->hw,
977 (sc->sc_flags & SC_OP_LED_ON) ? 977 &sc->ath_led_blink_work,
978 msecs_to_jiffies(sc->led_off_duration) : 978 (sc->sc_flags & SC_OP_LED_ON) ?
979 msecs_to_jiffies(sc->led_on_duration)); 979 msecs_to_jiffies(sc->led_off_duration) :
980 msecs_to_jiffies(sc->led_on_duration));
980 981
981 sc->led_on_duration = sc->led_on_cnt ? 982 sc->led_on_duration = sc->led_on_cnt ?
982 max((ATH_LED_ON_DURATION_IDLE - sc->led_on_cnt), 25) : 983 max((ATH_LED_ON_DURATION_IDLE - sc->led_on_cnt), 25) :
@@ -1013,8 +1014,8 @@ static void ath_led_brightness(struct led_classdev *led_cdev,
1013 case LED_FULL: 1014 case LED_FULL:
1014 if (led->led_type == ATH_LED_ASSOC) { 1015 if (led->led_type == ATH_LED_ASSOC) {
1015 sc->sc_flags |= SC_OP_LED_ASSOCIATED; 1016 sc->sc_flags |= SC_OP_LED_ASSOCIATED;
1016 queue_delayed_work(sc->hw->workqueue, 1017 ieee80211_queue_delayed_work(sc->hw,
1017 &sc->ath_led_blink_work, 0); 1018 &sc->ath_led_blink_work, 0);
1018 } else if (led->led_type == ATH_LED_RADIO) { 1019 } else if (led->led_type == ATH_LED_RADIO) {
1019 ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 0); 1020 ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 0);
1020 sc->sc_flags |= SC_OP_LED_ON; 1021 sc->sc_flags |= SC_OP_LED_ON;
@@ -1972,7 +1973,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
1972 1973
1973 ieee80211_wake_queues(hw); 1974 ieee80211_wake_queues(hw);
1974 1975
1975 queue_delayed_work(sc->hw->workqueue, &sc->tx_complete_work, 0); 1976 ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0);
1976 1977
1977mutex_unlock: 1978mutex_unlock:
1978 mutex_unlock(&sc->mutex); 1979 mutex_unlock(&sc->mutex);
diff --git a/drivers/net/wireless/ath/ath9k/virtual.c b/drivers/net/wireless/ath/ath9k/virtual.c
index e1d419e02b4a..19b88f8177fd 100644
--- a/drivers/net/wireless/ath/ath9k/virtual.c
+++ b/drivers/net/wireless/ath/ath9k/virtual.c
@@ -351,7 +351,7 @@ void ath9k_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
351 * Drop from tasklet to work to allow mutex for channel 351 * Drop from tasklet to work to allow mutex for channel
352 * change. 352 * change.
353 */ 353 */
354 queue_work(aphy->sc->hw->workqueue, 354 ieee80211_queue_work(aphy->sc->hw,
355 &aphy->sc->chan_work); 355 &aphy->sc->chan_work);
356 } 356 }
357 } 357 }
@@ -367,7 +367,7 @@ static void ath9k_mark_paused(struct ath_wiphy *aphy)
367 struct ath_softc *sc = aphy->sc; 367 struct ath_softc *sc = aphy->sc;
368 aphy->state = ATH_WIPHY_PAUSED; 368 aphy->state = ATH_WIPHY_PAUSED;
369 if (!__ath9k_wiphy_pausing(sc)) 369 if (!__ath9k_wiphy_pausing(sc))
370 queue_work(sc->hw->workqueue, &sc->chan_work); 370 ieee80211_queue_work(sc->hw, &sc->chan_work);
371} 371}
372 372
373static void ath9k_pause_iter(void *data, u8 *mac, struct ieee80211_vif *vif) 373static void ath9k_pause_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
@@ -521,7 +521,7 @@ int ath9k_wiphy_select(struct ath_wiphy *aphy)
521 spin_unlock_bh(&sc->wiphy_lock); 521 spin_unlock_bh(&sc->wiphy_lock);
522 ath_radio_disable(sc); 522 ath_radio_disable(sc);
523 ath_radio_enable(sc); 523 ath_radio_enable(sc);
524 queue_work(aphy->sc->hw->workqueue, 524 ieee80211_queue_work(aphy->sc->hw,
525 &aphy->sc->chan_work); 525 &aphy->sc->chan_work);
526 return -EBUSY; /* previous select still in progress */ 526 return -EBUSY; /* previous select still in progress */
527 } 527 }
@@ -541,7 +541,7 @@ int ath9k_wiphy_select(struct ath_wiphy *aphy)
541 541
542 if (now) { 542 if (now) {
543 /* Ready to request channel change immediately */ 543 /* Ready to request channel change immediately */
544 queue_work(aphy->sc->hw->workqueue, &aphy->sc->chan_work); 544 ieee80211_queue_work(aphy->sc->hw, &aphy->sc->chan_work);
545 } 545 }
546 546
547 /* 547 /*
@@ -648,8 +648,9 @@ try_again:
648 "change\n"); 648 "change\n");
649 } 649 }
650 650
651 queue_delayed_work(sc->hw->workqueue, &sc->wiphy_work, 651 ieee80211_queue_delayed_work(sc->hw,
652 sc->wiphy_scheduler_int); 652 &sc->wiphy_work,
653 sc->wiphy_scheduler_int);
653} 654}
654 655
655void ath9k_wiphy_set_scheduler(struct ath_softc *sc, unsigned int msec_int) 656void ath9k_wiphy_set_scheduler(struct ath_softc *sc, unsigned int msec_int)
@@ -657,8 +658,8 @@ void ath9k_wiphy_set_scheduler(struct ath_softc *sc, unsigned int msec_int)
657 cancel_delayed_work_sync(&sc->wiphy_work); 658 cancel_delayed_work_sync(&sc->wiphy_work);
658 sc->wiphy_scheduler_int = msecs_to_jiffies(msec_int); 659 sc->wiphy_scheduler_int = msecs_to_jiffies(msec_int);
659 if (sc->wiphy_scheduler_int) 660 if (sc->wiphy_scheduler_int)
660 queue_delayed_work(sc->hw->workqueue, &sc->wiphy_work, 661 ieee80211_queue_delayed_work(sc->hw, &sc->wiphy_work,
661 sc->wiphy_scheduler_int); 662 sc->wiphy_scheduler_int);
662} 663}
663 664
664/* caller must hold wiphy_lock */ 665/* caller must hold wiphy_lock */
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index b7806e2ca0e1..87762da0383b 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -2063,7 +2063,7 @@ static void ath_tx_complete_poll_work(struct work_struct *work)
2063 ath_reset(sc, false); 2063 ath_reset(sc, false);
2064 } 2064 }
2065 2065
2066 queue_delayed_work(sc->hw->workqueue, &sc->tx_complete_work, 2066 ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work,
2067 msecs_to_jiffies(ATH_TX_COMPLETE_POLL_INT)); 2067 msecs_to_jiffies(ATH_TX_COMPLETE_POLL_INT));
2068} 2068}
2069 2069