Return-path: Received: from phoenix3.szarvasnet.hu ([87.101.127.16]:35637 "EHLO phoenix3.szarvasnet.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752549AbZGWIeO (ORCPT ); Thu, 23 Jul 2009 04:34:14 -0400 From: Gabor Juhos To: John Linville Cc: "Luis R. Rodriguez" , Jouni Malinen , "ath9k-devel@lists.ath9k.org" , "linux-wireless@vger.kernel.org" , Gabor Juhos Subject: [PATCH 2/2] ath9k: get rid of unnecessary setpower calls Date: Thu, 23 Jul 2009 10:34:12 +0200 Message-Id: <1248338052-10435-2-git-send-email-juhosg@openwrt.org> In-Reply-To: <1248338052-10435-1-git-send-email-juhosg@openwrt.org> References: <1248338052-10435-1-git-send-email-juhosg@openwrt.org> Sender: linux-wireless-owner@vger.kernel.org List-ID: We are using setpower routines regardless of the current power mode. Don't bother the hardware, if it is not necessary. Changes-licensed-under: ISC Signed-off-by: Gabor Juhos --- drivers/net/wireless/ath/ath9k/hw.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 53dfc6d..d958a0e 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -475,6 +475,8 @@ static struct ath_hw *ath9k_hw_newstate(u16 devid, struct ath_softc *sc, ah->gbeacon_rate = 0; + ah->power_mode = ATH9K_PM_UNDEFINED; + return ah; } @@ -2739,6 +2741,9 @@ static bool ath9k_hw_setpower_nolock(struct ath_hw *ah, "UNDEFINED" }; + if (ah->power_mode == mode) + return status; + DPRINTF(ah->ah_sc, ATH_DBG_RESET, "%s -> %s\n", modes[ah->power_mode], modes[mode]); @@ -2783,8 +2788,7 @@ void ath9k_ps_wakeup(struct ath_softc *sc) if (++sc->ps_usecount != 1) goto unlock; - if (sc->sc_ah->power_mode != ATH9K_PM_AWAKE) - ath9k_hw_setpower_nolock(sc->sc_ah, ATH9K_PM_AWAKE); + ath9k_hw_setpower_nolock(sc->sc_ah, ATH9K_PM_AWAKE); unlock: spin_unlock_irqrestore(&sc->sc_pm_lock, flags); -- 1.5.3.2