linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Kalle Valo <kalle.valo@iki.fi>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org
Subject: Re: [PATCH v2 1/3] mac80211: refactor dynamic power save check
Date: Tue, 27 Oct 2009 17:07:23 +0100	[thread overview]
Message-ID: <1256659643.4237.20.camel@johannes.local> (raw)
In-Reply-To: <20091027153608.27827.70629.stgit@tikku>

On Tue, 2009-10-27 at 17:36 +0200, Kalle Valo wrote:
> From: Kalle Valo <kalle.valo@nokia.com>
> 
> 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>

> ---
> 
>  net/mac80211/tx.c |   24 +++++++++++++++++++++---
>  1 files changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
> index db4bda6..c59ed84 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);
> 
> 



      parent reply	other threads:[~2009-10-27 16:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-27 15:36 [PATCH v2 1/3] mac80211: refactor dynamic power save check Kalle Valo
2009-10-27 15:36 ` [PATCH v2 2/3] mac80211: fix dynamic power save for devices with nullfunc support in hw Kalle Valo
2009-10-27 16:08   ` Johannes Berg
2009-10-27 16:18     ` Kalle Valo
2009-10-27 15:36 ` [PATCH v2 3/3] wl1251: enable power save Kalle Valo
2009-10-27 16:07 ` Johannes Berg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1256659643.4237.20.camel@johannes.local \
    --to=johannes@sipsolutions.net \
    --cc=kalle.valo@iki.fi \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).