From d33b74f8690e1acda4ec66998803f3cacc9dff73 Mon Sep 17 00:00:00 2001 From: Vevek Venkatesan Date: Fri, 4 Sep 2020 14:35:28 +0530 Subject: [PATCH] qcacld-3.0: request runtime sync resume while removing driver When __hdd_soc_remove is called from platform driver, for removing the driver, request runtime sync resume before setting unload_in_progress flag, such that runtime resume can happen. Also, remove wlan_hdd_validate_context to skip unload_in_progress flag check and have only SSR check during resume callback. Change-Id: I545c6e10f9c18ff44c05a5d284aa9b82c7ec5ed5 CRs-Fixed: 2750981 --- core/hdd/src/wlan_hdd_driver_ops.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index 516c358bd9d1..6f079c0b23d8 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -676,6 +676,7 @@ static int hdd_soc_recovery_reinit(struct device *dev, static void __hdd_soc_remove(struct device *dev) { struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + void *hif_ctx; QDF_BUG(hdd_ctx); if (!hdd_ctx) @@ -684,6 +685,15 @@ static void __hdd_soc_remove(struct device *dev) pr_info("%s: Removing driver v%s\n", WLAN_MODULE_NAME, QWLAN_VERSIONSTR); + hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); + if (hif_ctx) { + /* + * Trigger runtime sync resume before setting unload in progress + * such that resume can happen successfully + */ + hif_pm_runtime_sync_resume(hif_ctx); + } + cds_set_driver_loaded(false); cds_set_unload_in_progress(true); if (!hdd_wait_for_debugfs_threads_completion()) @@ -1517,8 +1527,12 @@ static int wlan_hdd_runtime_resume(struct device *dev) hdd_debug("Starting runtime resume"); hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); - if (wlan_hdd_validate_context(hdd_ctx)) + + if (cds_is_driver_recovering()) { + hdd_debug("Recovery in progress, state:0x%x", + cds_get_driver_state()); return 0; + } if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) { hdd_debug("Driver module closed skipping runtime resume");