From a7163174a3dcf6e3eb123ac28d07c017614ab362 Mon Sep 17 00:00:00 2001 From: Houston Hoffman Date: Thu, 3 Sep 2015 12:47:01 -0700 Subject: [PATCH] qcacld-3.0: Remove target_lock from cb regsitration Send and recv callback registration currently occurs durring init and after bmi download is complete. In either case no transactions are in progress and no race condition can exist. Similarly watermark callback registration would happen at the same time if it were used. Change-Id: Ia77bf30fb3bcefa500465cea9ad9927990bb7ced CRs-Fixed: 941355 --- core/hif/src/ce/ce_service.c | 44 +++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/core/hif/src/ce/ce_service.c b/core/hif/src/ce/ce_service.c index 99afda9bd9..710b4149b4 100644 --- a/core/hif/src/ce/ce_service.c +++ b/core/hif/src/ce/ce_service.c @@ -1505,6 +1505,20 @@ void ce_enable_any_copy_compl_intr(struct ol_softc *scn) cdf_spin_unlock(&scn->target_lock); } +/** + * ce_send_cb_register(): register completion handler + * @copyeng: CE_state representing the ce we are adding the behavior to + * @fn_ptr: callback that the ce should use when processing tx completions + * @disable_interrupts: if the interupts should be enabled or not. + * + * Caller should guarantee that no transactions are in progress before + * switching the callback function. + * + * Registers the send context before the fn pointer so that if the cb is valid + * the context should be valid. + * + * Beware that currently this function will enable completion interrupts. + */ void ce_send_cb_register(struct CE_handle *copyeng, ce_send_cb fn_ptr, @@ -1516,13 +1530,23 @@ ce_send_cb_register(struct CE_handle *copyeng, pr_err("%s: Error CE state = NULL\n", __func__); return; } - cdf_spin_lock(&CE_state->scn->target_lock); - CE_state->send_cb = fn_ptr; CE_state->send_context = ce_send_context; + CE_state->send_cb = fn_ptr; ce_per_engine_handler_adjust(CE_state, disable_interrupts); - cdf_spin_unlock(&CE_state->scn->target_lock); } +/** + * ce_recv_cb_register(): register completion handler + * @copyeng: CE_state representing the ce we are adding the behavior to + * @fn_ptr: callback that the ce should use when processing rx completions + * @disable_interrupts: if the interupts should be enabled or not. + * + * Registers the send context before the fn pointer so that if the cb is valid + * the context should be valid. + * + * Caller should guarantee that no transactions are in progress before + * switching the callback function. + */ void ce_recv_cb_register(struct CE_handle *copyeng, CE_recv_cb fn_ptr, @@ -1534,27 +1558,31 @@ ce_recv_cb_register(struct CE_handle *copyeng, pr_err("%s: ERROR CE state = NULL\n", __func__); return; } - cdf_spin_lock(&CE_state->scn->target_lock); - CE_state->recv_cb = fn_ptr; CE_state->recv_context = CE_recv_context; + CE_state->recv_cb = fn_ptr; ce_per_engine_handler_adjust(CE_state, disable_interrupts); - cdf_spin_unlock(&CE_state->scn->target_lock); } +/** + * ce_watermark_cb_register(): register completion handler + * @copyeng: CE_state representing the ce we are adding the behavior to + * @fn_ptr: callback that the ce should use when processing watermark events + * + * Caller should guarantee that no watermark events are being processed before + * switching the callback function. + */ void ce_watermark_cb_register(struct CE_handle *copyeng, CE_watermark_cb fn_ptr, void *CE_wm_context) { struct CE_state *CE_state = (struct CE_state *)copyeng; - cdf_spin_lock(&CE_state->scn->target_lock); CE_state->watermark_cb = fn_ptr; CE_state->wm_context = CE_wm_context; ce_per_engine_handler_adjust(CE_state, 0); if (fn_ptr) { CE_state->misc_cbs = 1; } - cdf_spin_unlock(&CE_state->scn->target_lock); } #ifdef WLAN_FEATURE_FASTPATH