diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2010-01-25 07:36:36 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-25 16:36:29 -0500 |
commit | 723bae7ee44fd79c1cd3c7531ed581d373920774 (patch) | |
tree | 2f82c098aeb61694d4f6e1ec7f9bb3c29b7d43f3 /net/mac80211/work.c | |
parent | 382b16559d599c4260aeb82a5ea5ba44459d1cd2 (diff) |
mac80211: track work started through callbacks
Currently, the remain_on_channel work callback needs
to track in its own data structure whether the work
was just started or not. By reordering some code this
becomes unnecessary, the generic wk->started variable
can still be 'false' on the first invocation and only
be 'true' on actual timeout invocations, so that the
extra variable can be removed.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/work.c')
-rw-r--r-- | net/mac80211/work.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/net/mac80211/work.c b/net/mac80211/work.c index df8277cdb4d0..7e708d5c88b4 100644 --- a/net/mac80211/work.c +++ b/net/mac80211/work.c | |||
@@ -535,8 +535,7 @@ ieee80211_remain_on_channel_timeout(struct ieee80211_work *wk) | |||
535 | * First time we run, do nothing -- the generic code will | 535 | * First time we run, do nothing -- the generic code will |
536 | * have switched to the right channel etc. | 536 | * have switched to the right channel etc. |
537 | */ | 537 | */ |
538 | if (!wk->remain.started) { | 538 | if (!wk->started) { |
539 | wk->remain.started = true; | ||
540 | wk->timeout = jiffies + msecs_to_jiffies(wk->remain.duration); | 539 | wk->timeout = jiffies + msecs_to_jiffies(wk->remain.duration); |
541 | 540 | ||
542 | cfg80211_ready_on_channel(wk->sdata->dev, (unsigned long) wk, | 541 | cfg80211_ready_on_channel(wk->sdata->dev, (unsigned long) wk, |
@@ -821,15 +820,17 @@ static void ieee80211_work_work(struct work_struct *work) | |||
821 | mutex_lock(&local->work_mtx); | 820 | mutex_lock(&local->work_mtx); |
822 | 821 | ||
823 | list_for_each_entry_safe(wk, tmp, &local->work_list, list) { | 822 | list_for_each_entry_safe(wk, tmp, &local->work_list, list) { |
823 | bool started = wk->started; | ||
824 | |||
824 | /* mark work as started if it's on the current off-channel */ | 825 | /* mark work as started if it's on the current off-channel */ |
825 | if (!wk->started && local->tmp_channel && | 826 | if (!started && local->tmp_channel && |
826 | wk->chan == local->tmp_channel && | 827 | wk->chan == local->tmp_channel && |
827 | wk->chan_type == local->tmp_channel_type) { | 828 | wk->chan_type == local->tmp_channel_type) { |
828 | wk->started = true; | 829 | started = true; |
829 | wk->timeout = jiffies; | 830 | wk->timeout = jiffies; |
830 | } | 831 | } |
831 | 832 | ||
832 | if (!wk->started && !local->tmp_channel) { | 833 | if (!started && !local->tmp_channel) { |
833 | /* | 834 | /* |
834 | * TODO: could optimize this by leaving the | 835 | * TODO: could optimize this by leaving the |
835 | * station vifs in awake mode if they | 836 | * station vifs in awake mode if they |
@@ -842,12 +843,12 @@ static void ieee80211_work_work(struct work_struct *work) | |||
842 | local->tmp_channel = wk->chan; | 843 | local->tmp_channel = wk->chan; |
843 | local->tmp_channel_type = wk->chan_type; | 844 | local->tmp_channel_type = wk->chan_type; |
844 | ieee80211_hw_config(local, 0); | 845 | ieee80211_hw_config(local, 0); |
845 | wk->started = true; | 846 | started = true; |
846 | wk->timeout = jiffies; | 847 | wk->timeout = jiffies; |
847 | } | 848 | } |
848 | 849 | ||
849 | /* don't try to work with items that aren't started */ | 850 | /* don't try to work with items that aren't started */ |
850 | if (!wk->started) | 851 | if (!started) |
851 | continue; | 852 | continue; |
852 | 853 | ||
853 | if (time_is_after_jiffies(wk->timeout)) { | 854 | if (time_is_after_jiffies(wk->timeout)) { |
@@ -882,6 +883,8 @@ static void ieee80211_work_work(struct work_struct *work) | |||
882 | break; | 883 | break; |
883 | } | 884 | } |
884 | 885 | ||
886 | wk->started = started; | ||
887 | |||
885 | switch (rma) { | 888 | switch (rma) { |
886 | case WORK_ACT_NONE: | 889 | case WORK_ACT_NONE: |
887 | /* might have changed the timeout */ | 890 | /* might have changed the timeout */ |