From 6f60b107c5749c50d03e55a28618ea93d0044dc6 Mon Sep 17 00:00:00 2001 From: Houston Hoffman Date: Mon, 8 Aug 2016 21:08:04 -0700 Subject: [PATCH] qcacmn: Move tasklet flush up to ce Wish to reuse this logic for snoc Change-Id: Ibd678feec9fe0ee583d32d055d4cb4a4885991ab CRs-Fixed: 1051968 --- hif/src/ce/ce_tasklet.c | 29 +++++++++++++++++++++++++++++ hif/src/ce/ce_tasklet.h | 1 + hif/src/pcie/if_pci.c | 26 -------------------------- hif/src/pcie/if_pci.h | 3 --- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/hif/src/ce/ce_tasklet.c b/hif/src/ce/ce_tasklet.c index 43d21a0474..2f6809fa49 100644 --- a/hif/src/ce/ce_tasklet.c +++ b/hif/src/ce/ce_tasklet.c @@ -240,6 +240,35 @@ void ce_tasklet_kill(struct hif_softc *scn) qdf_atomic_set(&scn->active_tasklet_cnt, 0); } +#define HIF_CE_DRAIN_WAIT_CNT 20 +/** + * hif_drain_tasklets(): wait untill no tasklet is pending + * @scn: hif context + * + * Let running tasklets clear pending trafic. + * + * Return: 0 if no bottom half is in progress when it returns. + * -EFAULT if it times out. + */ +int hif_drain_tasklets(struct hif_softc *scn) +{ + uint32_t ce_drain_wait_cnt = 0; + + while (qdf_atomic_read(&scn->active_tasklet_cnt)) { + if (++ce_drain_wait_cnt > HIF_CE_DRAIN_WAIT_CNT) { + HIF_ERROR("%s: CE still not done with access", + __func__); + + return -EFAULT; + } + HIF_INFO("%s: Waiting for CE to finish access", __func__); + msleep(10); + } + return 0; +} + + + #ifdef WLAN_SUSPEND_RESUME_TEST static bool g_hif_apps_fake_suspended; static hdd_fake_resume_callback hdd_fake_aps_resume; diff --git a/hif/src/ce/ce_tasklet.h b/hif/src/ce/ce_tasklet.h index 1b158aedfd..a6fbdfd848 100644 --- a/hif/src/ce/ce_tasklet.h +++ b/hif/src/ce/ce_tasklet.h @@ -31,6 +31,7 @@ void init_tasklet_workers(struct hif_opaque_softc *scn); void ce_tasklet_init(struct HIF_CE_state *hif_ce_state, uint32_t mask); void ce_tasklet_kill(struct hif_softc *scn); +int hif_drain_tasklets(struct hif_softc *scn); QDF_STATUS ce_register_irq(struct HIF_CE_state *hif_ce_state, uint32_t mask); QDF_STATUS ce_unregister_irq(struct HIF_CE_state *hif_ce_state, uint32_t mask); irqreturn_t ce_dispatch_interrupt(int irq, diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c index 4defde6499..a37d5f3c66 100644 --- a/hif/src/pcie/if_pci.c +++ b/hif/src/pcie/if_pci.c @@ -2504,32 +2504,6 @@ void hif_pci_prevent_linkdown(struct hif_softc *scn, bool flag) } #endif -/** - * hif_drain_tasklets(): wait untill no tasklet is pending - * @scn: hif context - * - * Let running tasklets clear pending trafic. - * - * Return: 0 if no bottom half is in progress when it returns. - * -EFAULT if it times out. - */ -static inline int hif_drain_tasklets(struct hif_softc *scn) -{ - uint32_t ce_drain_wait_cnt = 0; - - while (qdf_atomic_read(&scn->active_tasklet_cnt)) { - if (++ce_drain_wait_cnt > HIF_CE_DRAIN_WAIT_CNT) { - HIF_ERROR("%s: CE still not done with access", - __func__); - - return -EFAULT; - } - HIF_INFO("%s: Waiting for CE to finish access", __func__); - msleep(10); - } - return 0; -} - /** * hif_bus_suspend_link_up() - suspend the bus * diff --git a/hif/src/pcie/if_pci.h b/hif/src/pcie/if_pci.h index 32558e5c2a..ab89f7d6d6 100644 --- a/hif/src/pcie/if_pci.h +++ b/hif/src/pcie/if_pci.h @@ -185,9 +185,6 @@ irqreturn_t hif_pci_interrupt_handler(int irq, void *arg); #define OL_ATH_TX_DRAIN_WAIT_CNT 60 #endif -#define HIF_CE_DRAIN_WAIT_CNT 20 - - #ifdef FEATURE_RUNTIME_PM #include