diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index 9aa5bf6d4203..896e9575c73b 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -1466,6 +1466,7 @@ static void wlan_hdd_set_the_pld_uevent(struct pld_uevent_data *uevent) static void wlan_hdd_handle_the_pld_uevent(struct pld_uevent_data *uevent) { enum cds_driver_state driver_state; + struct hdd_context *hdd_ctx; driver_state = cds_get_driver_state(); @@ -1482,6 +1483,10 @@ static void wlan_hdd_handle_the_pld_uevent(struct pld_uevent_data *uevent) case PLD_FW_DOWN: qdf_complete_wait_events(); cds_set_target_ready(false); + hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + if (hdd_ctx != NULL) + wlan_cfg80211_cleanup_scan_queue( + hdd_ctx->hdd_pdev); break; case PLD_FW_READY: default: diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index faf111b8d3cd..43e74477f16d 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -552,6 +552,13 @@ static int __hdd_netdev_notifier_call(struct notifier_block *nb, cds_flush_work(&adapter->scan_block_work); hdd_debug("Scan is not Pending from user"); } + /* + * After NETDEV_GOING_DOWN, kernel calls hdd_stop.Irrespective + * of return status of hdd_stop call, kernel resets the IFF_UP + * flag after which driver does not send the cfg80211_scan_done. + * Ensure to cleanup the scan queue in NETDEV_GOING_DOWN + */ + wlan_cfg80211_cleanup_scan_queue(hdd_ctx->hdd_pdev); break; default: diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index ba52464dfea9..f445af6a0db1 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -82,6 +82,7 @@ #include "scheduler_api.h" #include "cds_utils.h" #include "wlan_hdd_packet_filter_api.h" +#include "wlan_cfg80211_scan.h" /* Preprocessor definitions and constants */ #ifdef QCA_WIFI_NAPIER_EMULATION @@ -1272,7 +1273,6 @@ QDF_STATUS hdd_wlan_shutdown(void) hdd_debug("Invoking packetdump deregistration API"); wlan_deregister_txrx_packetdump(); - wlan_cfg80211_cleanup_scan_queue(hdd_ctx->hdd_pdev); hdd_reset_all_adapters(hdd_ctx); /* Flush cached rx frame queue */