diff options
| author | Yue Ma <yuem@qca.qualcomm.com> | 2015-08-31 14:35:23 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-09-01 02:20:01 -0700 |
| commit | 47516692a6a43bf7a3b07ef7a8a14539dbf05cdb (patch) | |
| tree | da2acbe01572be58f8f5795d49811d71d0d897ec | |
| parent | e329572a88009f24fed55f0ad0d1f26a2fc7f97e (diff) | |
qcacld: Ensure runtime suspend immediately returns during load/unload
Add the change that runtime suspend immediately returns during driver
load/unload to avoid the race condition between runtime PM suspend and
driver load/unload.
Change-Id: I0d4f646029231333c5a903bd97cc0d652894b8c3
CRs-fixed: 899526
| -rw-r--r-- | CORE/SERVICES/HIF/PCIe/if_pci.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/CORE/SERVICES/HIF/PCIe/if_pci.c b/CORE/SERVICES/HIF/PCIe/if_pci.c index f9ad96dff4ef..b2851e784940 100644 --- a/CORE/SERVICES/HIF/PCIe/if_pci.c +++ b/CORE/SERVICES/HIF/PCIe/if_pci.c @@ -845,7 +845,7 @@ static const struct file_operations hif_pci_autopm_fops = { static int __hif_pci_runtime_suspend(struct pci_dev *pdev) { - struct hif_pci_softc *sc = pci_get_drvdata(pdev); + struct hif_pci_softc *sc = NULL; void *vos_context = vos_get_global_context(VOS_MODULE_ID_HIF, NULL); pm_message_t state = { .event = PM_EVENT_SUSPEND }; v_VOID_t *temp_module; @@ -854,12 +854,18 @@ static int __hif_pci_runtime_suspend(struct pci_dev *pdev) if (vos_is_load_unload_in_progress(VOS_MODULE_ID_HIF, NULL)) { pr_err("%s: Load/Unload in Progress\n", __func__); - goto out; + goto end; } if (vos_is_logp_in_progress(VOS_MODULE_ID_HIF, NULL)) { pr_err("%s: LOGP in progress\n", __func__); - goto out; + goto end; + } + + sc = pci_get_drvdata(pdev); + if (!sc) { + pr_err("%s: sc is NULL!\n", __func__); + goto end; } adf_os_atomic_set(&sc->pm_state, HIF_PM_RUNTIME_STATE_INPROGRESS); @@ -931,9 +937,8 @@ out: adf_os_atomic_set(&sc->pm_state, HIF_PM_RUNTIME_STATE_ON); sc->pm_stats.suspend_err++; hif_pm_runtime_mark_last_busy(sc->dev); - +end: ASSERT(ret == -EAGAIN || ret == -EBUSY); - return ret; } |
