summaryrefslogtreecommitdiffstats
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
authorKalle Valo <kalle.valo@nokia.com>2009-10-27 17:36:09 +0200
committerJohn W. Linville <linville@tuxdriver.com>2009-10-30 16:49:18 -0400
commited620590de15021f6baf08ca098c90f47470efd7 (patch)
tree2d04e564a1b7d0559a62af1c652c49e09bd807ec /net/mac80211/tx.c
parent7bcfaf2f431c09c51fe776fc06638b25d3b421c5 (diff)
mac80211: refactor dynamic power save check
Refactor dynamic power save checks to a function of it's own for better readibility. No functional changes. Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Reviewed-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index eaa4118de98..498cdd435d7 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1387,6 +1387,26 @@ static int ieee80211_skb_resize(struct ieee80211_local *local,
return 0;
}
+static bool need_dynamic_ps(struct ieee80211_local *local)
+{
+ /* driver doesn't support power save */
+ if (!(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK))
+ return false;
+
+ /* dynamic power save disabled */
+ if (local->hw.conf.dynamic_ps_timeout <= 0)
+ return false;
+
+ /* we are scanning, don't enable power save */
+ if (local->scanning)
+ return false;
+
+ if (!local->ps_sdata)
+ return false;
+
+ return true;
+}
+
static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb)
{
@@ -1399,9 +1419,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
dev_hold(sdata->dev);
- if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) &&
- local->hw.conf.dynamic_ps_timeout > 0 &&
- !(local->scanning) && local->ps_sdata) {
+ if (need_dynamic_ps(local)) {
if (local->hw.conf.flags & IEEE80211_CONF_PS) {
ieee80211_stop_queues_by_reason(&local->hw,
IEEE80211_QUEUE_STOP_REASON_PS);