Search Linux Wireless

Re: [PATCH v2] ath9k: Enable dynamic power save in ath9k.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 29, 2008 at 7:42 PM, Johannes Berg
<johannes@xxxxxxxxxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux