Search Linux Wireless

Re: [PATCH] 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 5:41 PM, Johannes Berg
<johannes@xxxxxxxxxxxxxxxx> wrote:
> On Mon, 2008-12-29 at 15:53 -0800, Vivek Natarajan wrote:
>
>> +#define ATH9K_PS_WAKEUP(sc)                                                \
>> +     do {                                                                  \
>> +             if (!atomic_read(&sc->ps_usecount) &&                         \
>> +                (ah->ah_powerMode !=  ATH9K_PM_AWAKE)) {                   \
>> +                     ah->ah_restoreMode = ah->ah_powerMode;                \
>> +                     ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);         \
>> +             }                                                             \
>> +             atomic_inc(&sc->ps_usecount);                                 \
>> +     } while (0);
>> +
>> +#define ATH9K_PS_RESTORE(sc)                                               \
>> +     do {                                                                  \
>> +             if (atomic_dec_and_test(&sc->ps_usecount) &&                  \
>> +                (sc->hw->conf.flags & IEEE80211_CONF_PS))                  \
>> +                     ath9k_hw_setpower(sc->sc_ah, ah->ah_restoreMode);     \
>> +     } while (0);
>
> I think those would be better as static inlines rather than macros.
>
> johannes

Thanks Johannes. I'll change them.

> Also, this seems racy, shouldn't it use something like if
> (atomic_inc_return() == 1) ?

Thanks.This seems much better.

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