From 699d90e4b0017a75b41e3590d9bf8f5f2e3f2e82 Mon Sep 17 00:00:00 2001 From: SaidiReddy Yenuga Date: Fri, 14 Apr 2017 16:09:24 +0530 Subject: [PATCH] qcacld-3.0: Create and Destroy bug report lock over insmod and rmmod Logging thread creates the bug report spinlock initially. ifconfig thread tries to create the same spinlock again, this leads to change in spinlock magic. Create and Destroy the same lock on insmod/rmmod only. CRs-Fixed: 2033886 Change-Id: Iea2fe4f9bd47b0d7f4ad1a176a361bac242b9d4d --- core/cds/inc/cds_api.h | 1 - core/cds/src/cds_api.c | 27 ---------------------- core/hdd/src/wlan_hdd_main.c | 44 ++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 28 deletions(-) diff --git a/core/cds/inc/cds_api.h b/core/cds/inc/cds_api.h index 610219b21b47..e58c09231b31 100644 --- a/core/cds/inc/cds_api.h +++ b/core/cds/inc/cds_api.h @@ -270,7 +270,6 @@ void cds_set_fatal_event(bool value); void cds_wlan_flush_host_logs_for_fatal(void); void cds_init_log_completion(void); -void cds_deinit_log_completion(void); QDF_STATUS cds_flush_logs(uint32_t is_fatal, uint32_t indicator, uint32_t reason_code, diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index 9f5a1b79a2e1..86c7ff6ddbc2 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -1088,7 +1088,6 @@ QDF_STATUS cds_close(struct wlan_objmgr_psoc *psoc, v_CONTEXT_t cds_context) QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); } - cds_deinit_log_completion(); cds_deinit_ini_config(); qdf_timer_module_deinit(); @@ -1925,32 +1924,6 @@ void cds_init_log_completion(void) p_cds_context->log_complete.indicator = WLAN_LOG_INDICATOR_UNUSED; p_cds_context->log_complete.reason_code = WLAN_LOG_REASON_CODE_UNUSED; p_cds_context->log_complete.is_report_in_progress = false; - /* Attempting to initialize an already initialized lock - * results in a failure. This must be ok here. - */ - qdf_spinlock_create(&p_cds_context->bug_report_lock); -} - -/** - * cds_deinit_log_completion() - Deinitialize log param structure - * - * This function is used to deinitialize the logging related - * parameters - * - * Return: None - */ -void cds_deinit_log_completion(void) -{ - p_cds_contextType p_cds_context; - - p_cds_context = cds_get_global_context(); - if (!p_cds_context) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: cds context is Invalid", __func__); - return; - } - - qdf_spinlock_destroy(&p_cds_context->bug_report_lock); } /** diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index fbc286554fd9..aceca81b7114 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -5334,6 +5334,26 @@ static void hdd_context_destroy(hdd_context_t *hdd_ctx) wiphy_free(hdd_ctx->wiphy); } +/** + * wlan_destroy_bug_report_lock() - Destroy bug report lock + * + * This function is used to destroy bug report lock + * + * Return: None + */ +static void wlan_destroy_bug_report_lock(void) +{ + p_cds_contextType p_cds_context; + + p_cds_context = cds_get_global_context(); + if (!p_cds_context) { + hdd_err("cds context is NULL"); + return; + } + + qdf_spinlock_destroy(&p_cds_context->bug_report_lock); +} + /** * hdd_wlan_exit() - HDD WLAN exit function * @hdd_ctx: Pointer to the HDD Context @@ -5420,6 +5440,8 @@ static void hdd_wlan_exit(hdd_context_t *hdd_ctx) hdd_stop_all_adapters(hdd_ctx); } + wlan_destroy_bug_report_lock(); + /* * Close the scheduler before calling cds_close to make sure * no thread is scheduled after the each module close is @@ -9083,6 +9105,26 @@ static void hdd_register_debug_callback(void) qdf_register_debug_callback(QDF_MODULE_ID_HDD, &hdd_state_info_dump); } +/* + * wlan_init_bug_report_lock() - Initialize bug report lock + * + * This function is used to create bug report lock + * + * Return: None + */ +static void wlan_init_bug_report_lock(void) +{ + p_cds_contextType p_cds_context; + + p_cds_context = cds_get_global_context(); + if (!p_cds_context) { + hdd_err("cds context is NULL"); + return; + } + + qdf_spinlock_create(&p_cds_context->bug_report_lock); +} + /** * hdd_wlan_startup() - HDD init function * @dev: Pointer to the underlying device @@ -9132,6 +9174,8 @@ int hdd_wlan_startup(struct device *dev) goto err_exit_nl_srv; } + wlan_init_bug_report_lock(); + wlan_hdd_update_wiphy(hdd_ctx); if (0 != wlan_hdd_set_wow_pulse(hdd_ctx, true))