From: "Vivek Natarajan" <vivek.natraj@gmail.com>
To: "Johannes Berg" <johannes@sipsolutions.net>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org
Subject: Re: [PATCH v2] ath9k: Enable dynamic power save in ath9k.
Date: Mon, 29 Dec 2008 19:54:07 +0530 [thread overview]
Message-ID: <8e92b4100812290624i7a7eebc0t75a2868dd8532994@mail.gmail.com> (raw)
In-Reply-To: <1230559969.3116.56.camel@johannes>
On Mon, Dec 29, 2008 at 7:42 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Mon, 2008-12-29 at 19:23 +0530, Vivek Natarajan wrote:
>
>> +static inline void ath9k_ps_wakeup(struct ath_softc *sc)
>> +{
>> + if ((atomic_inc_return(&sc->ps_usecount) == 1) &&
>> + (sc->sc_ah->ah_powerMode != ATH9K_PM_AWAKE)) {
>> + sc->sc_ah->ah_restoreMode = sc->sc_ah->ah_powerMode;
>> + ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
>> + }
>> +}
>> +
>> +static inline void ath9k_ps_restore(struct ath_softc *sc)
>> +{
>> + if (atomic_dec_and_test(&sc->ps_usecount) &&
>> + (sc->hw->conf.flags & IEEE80211_CONF_PS))
>> + ath9k_hw_setpower(sc->sc_ah, sc->sc_ah->ah_restoreMode);
>
> Not sure which is intended, but maybe you should do the flags/powermode
> check before doing the refcount change? In either case, I would probably
> nest it into two if statements so it's clear which one is intended?
The count has to be incremented or decremented for every call.
Otherwise, the mode might not be restored in some corner case
conditions. Anyhow, I will nest it as two if
statements.
Thanks,
Vivek.
prev parent reply other threads:[~2008-12-29 14:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-29 13:53 [PATCH v2] ath9k: Enable dynamic power save in ath9k Vivek Natarajan
2008-12-29 14:12 ` Johannes Berg
2008-12-29 14:24 ` Vivek Natarajan [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=8e92b4100812290624i7a7eebc0t75a2868dd8532994@mail.gmail.com \
--to=vivek.natraj@gmail.com \
--cc=johannes@sipsolutions.net \
--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