diff --git a/core/cds/inc/cds_sched.h b/core/cds/inc/cds_sched.h index 6a1bb7eb009f..e07f15143455 100644 --- a/core/cds/inc/cds_sched.h +++ b/core/cds/inc/cds_sched.h @@ -48,6 +48,7 @@ #include #include #include "qdf_lock.h" +#include "qdf_mc_timer.h" #define TX_POST_EVENT_MASK 0x001 #define TX_SUSPEND_EVENT_MASK 0x002 @@ -286,6 +287,7 @@ typedef struct _cds_context_type { qdf_spinlock_t bug_report_lock; qdf_event_t connection_update_done_evt; qdf_mutex_t qdf_conc_list_lock; + qdf_mc_timer_t dbs_opportunistic_timer; } cds_context_type, *p_cds_contextType; diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c index 68b239d3bde1..3d07ac71c81e 100644 --- a/core/cds/src/cds_concurrency.c +++ b/core/cds/src/cds_concurrency.c @@ -3687,15 +3687,8 @@ void cds_decr_session_set_pcl(enum tQDF_ADAPTER_MODE mode, uint8_t session_id) { QDF_STATUS qdf_status; - hdd_context_t *hdd_ctx; cds_context_type *cds_ctx; - hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); - if (!hdd_ctx) { - cds_err("HDD context is NULL"); - return; - } - cds_ctx = cds_get_context(QDF_MODULE_ID_QDF); if (!cds_ctx) { cds_err("Invalid CDS Context"); @@ -3722,9 +3715,9 @@ void cds_decr_session_set_pcl(enum tQDF_ADAPTER_MODE mode, /* do we need to change the HW mode */ if (cds_need_opportunistic_upgrade()) { /* let's start the timer */ - qdf_mc_timer_stop(&hdd_ctx->dbs_opportunistic_timer); + qdf_mc_timer_stop(&cds_ctx->dbs_opportunistic_timer); qdf_status = qdf_mc_timer_start( - &hdd_ctx->dbs_opportunistic_timer, + &cds_ctx->dbs_opportunistic_timer, DBS_OPPORTUNISTIC_TIME * 1000); if (!QDF_IS_STATUS_SUCCESS(qdf_status)) @@ -3791,7 +3784,7 @@ void cds_decr_active_session(enum tQDF_ADAPTER_MODE mode, /** * cds_dbs_opportunistic_timer_handler() - handler of * dbs_opportunistic_timer - * @data: HDD context + * @data: CDS context * * handler for dbs_opportunistic_timer * @@ -3800,9 +3793,8 @@ void cds_decr_active_session(enum tQDF_ADAPTER_MODE mode, void cds_dbs_opportunistic_timer_handler(void *data) { enum cds_conc_next_action action = CDS_NOP; - cds_context_type *cds_ctx; + cds_context_type *cds_ctx = (cds_context_type *)data; - cds_ctx = cds_get_context(QDF_MODULE_ID_QDF); if (!cds_ctx) { cds_err("Invalid CDS Context"); return; @@ -3846,6 +3838,19 @@ QDF_STATUS cds_deinit_policy_mgr(void) cds_err("Failed to destroy qdf_conc_list_lock"); return QDF_STATUS_E_FAILURE; } + + if (QDF_TIMER_STATE_RUNNING == + qdf_mc_timer_get_current_state( + &cds_ctx->dbs_opportunistic_timer)) { + qdf_mc_timer_stop(&cds_ctx->dbs_opportunistic_timer); + } + + if (!QDF_IS_STATUS_SUCCESS(qdf_mc_timer_destroy( + &cds_ctx->dbs_opportunistic_timer))) { + cds_err("Cannot deallocate dbs opportunistic timer"); + return QDF_STATUS_E_FAILURE; + } + return QDF_STATUS_SUCCESS; } @@ -3889,10 +3894,10 @@ QDF_STATUS cds_init_policy_mgr(void) sme_register_hw_mode_trans_cb(hdd_ctx->hHal, cds_hw_mode_transition_cb); - status = qdf_mc_timer_init(&hdd_ctx->dbs_opportunistic_timer, + status = qdf_mc_timer_init(&cds_ctx->dbs_opportunistic_timer, QDF_TIMER_TYPE_SW, cds_dbs_opportunistic_timer_handler, - (void *)hdd_ctx); + (void *)cds_ctx); if (!QDF_IS_STATUS_SUCCESS(status)) { cds_err("Failed to init DBS opportunistic timer"); return status; diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 0833b9ef8831..010211d3eca4 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1320,7 +1320,6 @@ struct hdd_context_s { bool memdump_in_progress; #endif /* WLAN_FEATURE_MEMDUMP */ - qdf_mc_timer_t dbs_opportunistic_timer; bool connection_in_progress; qdf_spinlock_t connection_status_lock; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 13b4693e18e9..b6d9e5721d8a 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -3725,17 +3725,6 @@ void hdd_wlan_exit(hdd_context_t *hdd_ctx) FL("Cannot deallocate ACS Skip timer")); } #endif - if (QDF_TIMER_STATE_RUNNING == - qdf_mc_timer_get_current_state( - &hdd_ctx->dbs_opportunistic_timer)) { - qdf_mc_timer_stop(&hdd_ctx->dbs_opportunistic_timer); - } - - if (!QDF_IS_STATUS_SUCCESS - (qdf_mc_timer_destroy( - &hdd_ctx->dbs_opportunistic_timer))) { - hdd_err("Cannot deallocate dbs opportunistic timer"); - } /* * Powersave Offload Case