From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sujith Manoharan Date: Mon, 22 Apr 2013 16:51:38 +0530 Subject: [ath9k-devel] [PATCH] ath10k: Fix PCI probe Message-ID: <1366629698-12754-1-git-send-email-sujith@msujith.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ath9k-devel@lists.ath9k.org From: Sujith Manoharan The target should always be woken up when the device is being probed and this shouldn't depend on the module parameter "ath10k_target_ps", which is used to enable target PowerSave. Signed-off-by: Sujith Manoharan --- drivers/net/wireless/ath/ath10k/pci.c | 12 +++--------- drivers/net/wireless/ath/ath10k/pci.h | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index e75b36b..dbe9fe4 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -442,7 +442,7 @@ static void ath10k_pci_wait_for_target_to_awake(struct ath10k *ar) ath10k_warn("Unable to wakeup target\n"); } -void ath10k_pci_wake(struct ath10k *ar) +void ath10k_do_pci_wake(struct ath10k *ar) { struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); void __iomem *pci_addr = ar_pci->mem; @@ -450,9 +450,6 @@ void ath10k_pci_wake(struct ath10k *ar) int tot_delay = 0; int curr_delay = 5; - if (!ath10k_target_ps) - return; - if (atomic_read(&ar_pci->keep_awake_count) == 0) { /* Force AWAKE */ iowrite32(PCIE_SOC_WAKE_V_MASK_T(ar), @@ -483,14 +480,11 @@ void ath10k_pci_wake(struct ath10k *ar) max_delay = tot_delay; } -void ath10k_pci_sleep(struct ath10k *ar) +void ath10k_do_pci_sleep(struct ath10k *ar) { struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); void __iomem *pci_addr = ar_pci->mem; - if (!ath10k_target_ps) - return; - if (atomic_dec_and_test(&ar_pci->keep_awake_count)) { /* Allow sleep */ ar_pci->verified_awake = false; @@ -1688,7 +1682,7 @@ static int ath10k_pci_probe_device(struct ath10k *ar) else { /* Force AWAKE forever */ ath10k_dbg(ATH10K_DBG_PCI, "on-chip power save disabled\n"); - ath10k_pci_wake(ar); + ath10k_do_pci_wake(ar); } ath10k_pci_ce_init(ar); diff --git a/drivers/net/wireless/ath/ath10k/pci.h b/drivers/net/wireless/ath/ath10k/pci.h index a3b5e88..fd2cd71 100644 --- a/drivers/net/wireless/ath/ath10k/pci.h +++ b/drivers/net/wireless/ath/ath10k/pci.h @@ -355,7 +355,19 @@ static inline void WAR_CE_SRC_RING_WRITE_IDX_SET(struct ath10k *ar, extern unsigned int ath10k_target_ps; -void ath10k_pci_wake(struct ath10k *ar); -void ath10k_pci_sleep(struct ath10k *ar); +void ath10k_do_pci_wake(struct ath10k *ar); +void ath10k_do_pci_sleep(struct ath10k *ar); + +static inline void ath10k_pci_wake(struct ath10k *ar) +{ + if (ath10k_target_ps) + ath10k_do_pci_wake(ar); +} + +static inline void ath10k_pci_sleep(struct ath10k *ar) +{ + if (ath10k_target_ps) + ath10k_do_pci_sleep(ar); +} #endif /* _PCI_H_ */ -- 1.8.2.1