diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 8e80656c0c6a..b7aad8f3a1cd 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1889,6 +1889,20 @@ enum QDF_GLOBAL_MODE hdd_get_conparam(void); void crda_regulatory_entry_default(uint8_t *countryCode, int domain_id); void wlan_hdd_reset_prob_rspies(struct hdd_adapter *adapter); void hdd_prevent_suspend(uint32_t reason); + +/* + * hdd_get_first_valid_adapter() - Get the first valid adapter from adapter list + * + * This function is used to fetch the first valid adapter from the adapter + * list. If there is no valid adapter then it returns NULL + * + * @hdd_ctx: HDD context handler + * + * Return: NULL if no valid adapter found in the adapter list + * + */ +struct hdd_adapter *hdd_get_first_valid_adapter(struct hdd_context *hdd_ctx); + void hdd_allow_suspend(uint32_t reason); void hdd_prevent_suspend_timeout(uint32_t timeout, uint32_t reason); diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index 5e5fc1f5e18f..8e482be71700 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -531,12 +531,6 @@ static void wlan_hdd_shutdown(void) { void *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); - if (hdd_get_conparam() == QDF_GLOBAL_FTM_MODE) { - hdd_err("Crash recovery is not allowed in FTM mode"); - QDF_BUG(0); - return; - } - if (!hif_ctx) { hdd_err("Failed to get HIF context, ignore SSR shutdown"); return; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 9db13bb6b26c..b68287f5ef62 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -6670,6 +6670,18 @@ QDF_STATUS hdd_post_cds_enable_config(struct hdd_context *hdd_ctx) return QDF_STATUS_SUCCESS; } +struct hdd_adapter *hdd_get_first_valid_adapter(struct hdd_context *hdd_ctx) +{ + struct hdd_adapter *adapter; + + hdd_for_each_adapter(hdd_ctx, adapter) { + if (adapter && adapter->magic == WLAN_HDD_ADAPTER_MAGIC) + return adapter; + } + + return NULL; +} + /* wake lock APIs for HDD */ void hdd_prevent_suspend(uint32_t reason) { diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index f8b57f37ae50..cc89100ad83e 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1365,23 +1365,9 @@ QDF_STATUS hdd_wlan_re_init(void) } bug_on_reinit_failure = hdd_ctx->config->bug_on_reinit_failure; - /* The driver should always be initialized in STA mode after SSR */ - hdd_set_conparam(0); - /* Try to get an adapter from mode ID */ - adapter = hdd_get_adapter(hdd_ctx, QDF_STA_MODE); - if (!adapter) { - adapter = hdd_get_adapter(hdd_ctx, QDF_SAP_MODE); - if (!adapter) { - adapter = hdd_get_adapter(hdd_ctx, QDF_IBSS_MODE); - if (!adapter) { - adapter = hdd_get_adapter(hdd_ctx, - QDF_MONITOR_MODE); - if (!adapter) - hdd_err("Failed to get Adapter!"); - } - - } - } + adapter = hdd_get_first_valid_adapter(hdd_ctx); + if (!adapter) + hdd_err("Failed to get adapter"); if (hdd_ctx->config->enable_dp_trace) hdd_dp_trace_init(hdd_ctx->config); @@ -1418,21 +1404,12 @@ QDF_STATUS hdd_wlan_re_init(void) sme_set_chip_pwr_save_fail_cb(hdd_ctx->hHal, hdd_chip_pwr_save_fail_detected_cb); - ret = hdd_register_cb(hdd_ctx); - if (ret) { - hdd_err("Failed to register HDD callbacks!"); - goto err_cds_disable; - } - hdd_lpass_notify_start(hdd_ctx); hdd_send_default_scan_ies(hdd_ctx); hdd_info("WLAN host driver reinitiation completed!"); goto success; -err_cds_disable: - hdd_wlan_stop_modules(hdd_ctx, false); - err_re_init: /* Allow the phone to go to sleep */ hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT);