From 0b489132375e5d9a1f08e1b98df78a6cadbf7a7c Mon Sep 17 00:00:00 2001 From: Houston Hoffman Date: Mon, 14 Mar 2016 21:11:57 -0700 Subject: [PATCH] qcacmn: Unify A_TARGET_ACCESS_LIKELY Sleep state adjust has been added the the bus_ops table and the macros using it can be unified. Change-Id: Ib788800c83457919ae7eee01f6687cbb57c84a4b CRs-Fixed: 986480 --- hif/src/hif_io32.h | 37 ++++++++++++++++++++++++++++++++++ hif/src/pcie/hif_io32_pci.h | 39 ------------------------------------ hif/src/snoc/hif_io32_snoc.h | 2 -- 3 files changed, 37 insertions(+), 41 deletions(-) diff --git a/hif/src/hif_io32.h b/hif/src/hif_io32.h index 3d5338fc75..a1596321fd 100644 --- a/hif/src/hif_io32.h +++ b/hif/src/hif_io32.h @@ -41,6 +41,43 @@ #define Q_TARGET_ACCESS_END(scn) \ hif_target_sleep_state_adjust(scn, true, false) +/* + * A_TARGET_ACCESS_LIKELY will not wait for the target to wake up before + * continuing execution. Because A_TARGET_ACCESS_LIKELY does not guarantee + * that the target is awake before continuing, Q_TARGET_ACCESS macros must + * protect the actual target access. Since Q_TARGET_ACCESS protect the actual + * target access, A_TARGET_ACCESS_LIKELY hints are optional. + * + * To ignore "LIKELY" hints, set CONFIG_TARGET_ACCESS_LIKELY to 0 + * (slightly worse performance, less power) + * + * To use "LIKELY" hints, set CONFIG_TARGET_ACCESS_LIKELY to 1 + * (slightly better performance, more power) + * + * note: if a bus doesn't use hif_target_sleep_state_adjust, this will have + * no impact. + */ +#define CONFIG_TARGET_ACCESS_LIKELY 0 +#if CONFIG_TARGET_ACCESS_LIKELY +#define A_TARGET_ACCESS_LIKELY(scn) \ + hif_target_sleep_state_adjust(scn, false, false) +#define A_TARGET_ACCESS_UNLIKELY(scn) \ + hif_target_sleep_state_adjust(scn, true, false) +#else /* CONFIG_ATH_PCIE_ACCESS_LIKELY */ +#define A_TARGET_ACCESS_LIKELY(scn) \ + do { \ + unsigned long unused = (unsigned long)(scn); \ + unused = unused; \ + } while (0) + +#define A_TARGET_ACCESS_UNLIKELY(scn) \ + do { \ + unsigned long unused = (unsigned long)(scn); \ + unused = unused; \ + } while (0) +#endif /* CONFIG_ATH_PCIE_ACCESS_LIKELY */ + + #ifdef HIF_PCI #include "hif_io32_pci.h" #endif diff --git a/hif/src/pcie/hif_io32_pci.h b/hif/src/pcie/hif_io32_pci.h index a79faf1efa..c7dbc0ad5c 100644 --- a/hif/src/pcie/hif_io32_pci.h +++ b/hif/src/pcie/hif_io32_pci.h @@ -47,18 +47,6 @@ */ #define CONFIG_ATH_PCIE_AWAKE_WHILE_DRIVER_LOAD 1 -/* - * When CONFIG_ATH_PCIE_MAX_PERF is 0: - * To use LIKELY hints, set this to 1 (slightly better performance, more power) - * To ignore "LIKELY" hints, set this to 0 (slightly worse performance, - * less power) - */ -#if defined(CONFIG_ATH_PCIE_MAX_PERF) -#define CONFIG_ATH_PCIE_ACCESS_LIKELY 0 -#else -#define CONFIG_ATH_PCIE_ACCESS_LIKELY 1 -#endif - /* * PCI-E L1 ASPPM sub-states * To enable clock gating in L1 state, set this to 1. @@ -93,14 +81,6 @@ do {struct hif_softc *unused = scn; \ unused = unused; } while (0) -#define A_TARGET_ACCESS_LIKELY(scn) \ - do {struct hif_softc *unused = scn; \ - unused = unused; } while (0) - -#define A_TARGET_ACCESS_UNLIKELY(scn) \ - do {struct hif_softc *unused = scn; \ - unused = unused; } while (0) - #define A_TARGET_ACCESS_BEGIN_RET(scn) \ do {struct hif_softc *unused = scn; \ unused = unused; } while (0) @@ -180,25 +160,6 @@ do { \ if (Q_TARGET_ACCESS_END(scn) < 0) \ return; \ } while (0) - -#if CONFIG_ATH_PCIE_ACCESS_LIKELY -#define A_TARGET_ACCESS_LIKELY(scn) \ - hif_target_sleep_state_adjust(scn, false, false) -#define A_TARGET_ACCESS_UNLIKELY(scn) \ - hif_target_sleep_state_adjust(scn, true, false) -#else /* CONFIG_ATH_PCIE_ACCESS_LIKELY */ -#define A_TARGET_ACCESS_LIKELY(scn) \ - do { \ - unsigned long unused = (unsigned long)(scn); \ - unused = unused; \ - } while (0) - -#define A_TARGET_ACCESS_UNLIKELY(scn) \ - do { \ - unsigned long unused = (unsigned long)(scn); \ - unused = unused; \ - } while (0) -#endif /* CONFIG_ATH_PCIE_ACCESS_LIKELY */ #endif /* CONFIG_ATH_PCIE_MAX_PERF */ irqreturn_t hif_fw_interrupt_handler(int irq, void *arg); diff --git a/hif/src/snoc/hif_io32_snoc.h b/hif/src/snoc/hif_io32_snoc.h index 2a73cebb73..106bdec1ff 100644 --- a/hif/src/snoc/hif_io32_snoc.h +++ b/hif/src/snoc/hif_io32_snoc.h @@ -47,8 +47,6 @@ * Force 0 and consider moving corresponding code into * pci specific files */ -#define A_TARGET_ACCESS_LIKELY(scn) -#define A_TARGET_ACCESS_UNLIKELY(scn) #define A_TARGET_ACCESS_BEGIN_RET_PTR(scn) #define A_TARGET_ACCESS_END_RET_PTR(scn) #define A_TARGET_ACCESS_BEGIN(scn)