From 13835b1aa206f9974d909695594a9f26cf8cd9e4 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Mon, 25 Mar 2019 13:34:35 -0700 Subject: [PATCH] qcacmn: Do not access bus in suspend_noirq The WLAN suspend process has three phases: 1) protocol suspend 2) bus suspend 3) bus suspend, no-irq Currently, it is assumed by the WLAN driver that the bus will not be put down until after step 3. Moving forward, however, the PCIe driver will be putting the bus link down between steps 2 and 3. In order to accommodate this, move flushing the tasklets to phase 2, up from phase 3. This will ensure the WLAN driver is done accessing the bus before the PCIe driver puts it down. Change-Id: I47a22b7fd940ddc1bad78265b59461c178ee7ad4 CRs-Fixed: 2423628 --- hif/src/pcie/if_pci.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c index 323935c5a337..b41e3f296c04 100644 --- a/hif/src/pcie/if_pci.c +++ b/hif/src/pcie/if_pci.c @@ -2532,8 +2532,16 @@ void hif_pci_prevent_linkdown(struct hif_softc *scn, bool flag) */ int hif_pci_bus_suspend(struct hif_softc *scn) { + hif_apps_irqs_disable(GET_HIF_OPAQUE_HDL(scn)); + + if (hif_drain_tasklets(scn)) { + hif_apps_irqs_enable(GET_HIF_OPAQUE_HDL(scn)); + return -EBUSY; + } + /* Stop the HIF Sleep Timer */ hif_cancel_deferred_target_sleep(scn); + return 0; } @@ -2583,7 +2591,15 @@ static int __hif_check_link_status(struct hif_softc *scn) */ int hif_pci_bus_resume(struct hif_softc *scn) { - return __hif_check_link_status(scn); + int errno; + + errno = __hif_check_link_status(scn); + if (errno) + return errno; + + hif_apps_irqs_enable(GET_HIF_OPAQUE_HDL(scn)); + + return 0; } /** @@ -2597,12 +2613,11 @@ int hif_pci_bus_resume(struct hif_softc *scn) */ int hif_pci_bus_suspend_noirq(struct hif_softc *scn) { - if (hif_drain_tasklets(scn) != 0) - return -EBUSY; - if (hif_can_suspend_link(GET_HIF_OPAQUE_HDL(scn))) qdf_atomic_set(&scn->link_suspended, 1); + hif_apps_wake_irq_enable(GET_HIF_OPAQUE_HDL(scn)); + return 0; } @@ -2617,6 +2632,8 @@ int hif_pci_bus_suspend_noirq(struct hif_softc *scn) */ int hif_pci_bus_resume_noirq(struct hif_softc *scn) { + hif_apps_wake_irq_disable(GET_HIF_OPAQUE_HDL(scn)); + if (hif_can_suspend_link(GET_HIF_OPAQUE_HDL(scn))) qdf_atomic_set(&scn->link_suspended, 0);