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");