From 9d12d493c1d9feb207afb1e4628fff46e6b615df Mon Sep 17 00:00:00 2001 From: Arunk Khandavalli Date: Fri, 27 Jan 2017 18:35:35 +0530 Subject: qcacld-3.0: Use wrapper to reset the log_completion variables qcacld-2.0 to qcacld-3.0 propagation. Presently, cds_init_log_completion is used to reset the log_completion variables, which also initializes the spin_lock along with setting the log_completion variables to default. In case of SMP platforms, spin_lock would have been acquired on the different CPU and on the different CPU if the spin_lock is initialized again, it would change the magic of lock. So, the spin_lock acquired on CPU0 while releasing would result in error, since the magic content of the lock is changed by re-initializing without unlocking the spin_lock. use a wrapper function just to reset the log_completion variables to default. Change-Id: I2c6754b41d05707103f1c39248829ba6033bfc4f CRs-Fixed: 1101839 --- core/cds/src/cds_api.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index e2e538d823b2..df24b60a344f 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -1896,6 +1896,16 @@ uint8_t cds_is_multicast_logging(void) return cds_multicast_logging; } +static void cds_reset_log_completion(p_cds_contextType p_cds_context) +{ + /* reset */ + p_cds_context->log_complete.indicator = WLAN_LOG_INDICATOR_UNUSED; + p_cds_context->log_complete.is_fatal = WLAN_LOG_TYPE_NON_FATAL; + p_cds_context->log_complete.is_report_in_progress = false; + p_cds_context->log_complete.reason_code = WLAN_LOG_REASON_CODE_UNUSED; + p_cds_context->log_complete.recovery_needed = false; + +} /* * cds_init_log_completion() - Initialize log param structure * @@ -1919,9 +1929,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); } @@ -2013,14 +2020,9 @@ void cds_get_and_reset_log_completion(uint32_t *is_fatal, *indicator = p_cds_context->log_complete.indicator; *reason_code = p_cds_context->log_complete.reason_code; *recovery_needed = p_cds_context->log_complete.recovery_needed; - - /* reset */ - p_cds_context->log_complete.indicator = WLAN_LOG_INDICATOR_UNUSED; - p_cds_context->log_complete.is_fatal = WLAN_LOG_TYPE_NON_FATAL; - p_cds_context->log_complete.is_report_in_progress = false; - p_cds_context->log_complete.reason_code = WLAN_LOG_REASON_CODE_UNUSED; - p_cds_context->log_complete.recovery_needed = false; + cds_reset_log_completion(p_cds_context); qdf_spinlock_release(&p_cds_context->bug_report_lock); + } /** @@ -2181,7 +2183,7 @@ QDF_STATUS cds_flush_logs(uint32_t is_fatal, if (0 != ret) { QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, "%s: Failed to send flush FW log", __func__); - cds_init_log_completion(); + cds_reset_log_completion(p_cds_context); return QDF_STATUS_E_FAILURE; } -- cgit v1.2.3