瀏覽代碼

qcacmn: update the wmi context during unregister

When unregistering wmi handlers, the position of the
old handler is replaced with the last handler in the table.
But at this stage only handler was getting replaced, but
not the context. Hence, make sure to update the context
as well.

Change-Id: If90ea9d7663fb105e8e8ad7d7e6c70da20264e44
Pavankumar Nandeshwar 4 年之前
父節點
當前提交
635a1c8eb9
共有 1 個文件被更改,包括 25 次插入1 次删除
  1. 25 1
      wmi/src/wmi_unified.c

+ 25 - 1
wmi/src/wmi_unified.c

@@ -2216,8 +2216,14 @@ QDF_STATUS wmi_unified_unregister_event(wmi_unified_t wmi_handle,
 {
 	uint32_t idx = 0;
 	uint32_t evt_id;
-	struct wmi_soc *soc = wmi_handle->soc;
+	struct wmi_soc *soc;
 
+	if (!wmi_handle) {
+		wmi_err("WMI handle is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	soc = wmi_handle->soc;
 	if (event_id >= wmi_events_max ||
 		wmi_handle->wmi_events[event_id] == WMI_EVENT_ID_INVALID) {
 		QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_INFO,
@@ -2241,6 +2247,15 @@ QDF_STATUS wmi_unified_unregister_event(wmi_unified_t wmi_handle,
 	wmi_handle->event_id[idx] =
 		wmi_handle->event_id[soc->max_event_idx];
 
+	qdf_spin_lock_bh(&soc->ctx_lock);
+
+	wmi_handle->ctx[idx].exec_ctx =
+		wmi_handle->ctx[soc->max_event_idx].exec_ctx;
+	wmi_handle->ctx[idx].buff_type =
+		wmi_handle->ctx[soc->max_event_idx].buff_type;
+
+	qdf_spin_unlock_bh(&soc->ctx_lock);
+
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -2279,6 +2294,15 @@ QDF_STATUS wmi_unified_unregister_event_handler(wmi_unified_t wmi_handle,
 	wmi_handle->event_id[idx] =
 		wmi_handle->event_id[soc->max_event_idx];
 
+	qdf_spin_lock_bh(&soc->ctx_lock);
+
+	wmi_handle->ctx[idx].exec_ctx =
+		wmi_handle->ctx[soc->max_event_idx].exec_ctx;
+	wmi_handle->ctx[idx].buff_type =
+		wmi_handle->ctx[soc->max_event_idx].buff_type;
+
+	qdf_spin_unlock_bh(&soc->ctx_lock);
+
 	return QDF_STATUS_SUCCESS;
 }
 qdf_export_symbol(wmi_unified_unregister_event_handler);