Forráskód Böngészése

qcacmn: Add API to get PSOC by PSOC ID

This change defines an API to get PSOC object
with PSOC ID.

Change-Id: I4c0d63fa480ac33e0471a6e679934b30e3670f8e
Srinivas Pitla 3 éve
szülő
commit
df5958c77b

+ 18 - 0
umac/cmn_services/obj_mgr/inc/wlan_objmgr_global_obj.h

@@ -539,6 +539,24 @@ QDF_STATUS wlan_objmgr_iterate_psoc_list(
 		wlan_objmgr_psoc_handler handler,
 		void *arg, wlan_objmgr_ref_dbgid dbg_id);
 
+/**
+ * wlan_objmgr_get_psoc_by_id() - find psoc by psoc id
+ *
+ * @psoc_id: Id of PSOC to be retrieved
+ * @dbg_id: id of the caller
+ *
+ * API to find psoc object pointer by psoc id
+ *
+ * This API increments the ref count of the psoc object internally, the
+ * caller has to invoke the wlan_objmgr_psoc_release_ref() to decrement
+ * ref count
+ *
+ * Return: psoc pointer
+ *         NULL on FAILURE
+ */
+struct wlan_objmgr_psoc
+*wlan_objmgr_get_psoc_by_id(uint8_t psoc_id, wlan_objmgr_ref_dbgid dbg_id);
+
 #ifdef WLAN_FEATURE_11BE_MLO
 /**
  * wlan_objmgr_get_mlo_ctx() - Get MLO context from global umac object

+ 24 - 0
umac/cmn_services/obj_mgr/src/wlan_objmgr_global_obj.c

@@ -866,6 +866,30 @@ QDF_STATUS wlan_objmgr_iterate_psoc_list(
 
 qdf_export_symbol(wlan_objmgr_iterate_psoc_list);
 
+struct wlan_objmgr_psoc
+*wlan_objmgr_get_psoc_by_id(uint8_t psoc_id, wlan_objmgr_ref_dbgid dbg_id)
+{
+	struct wlan_objmgr_psoc *psoc;
+
+	if (psoc_id >= WLAN_OBJMGR_MAX_DEVICES) {
+		obj_mgr_err(" PSOC id[%d] is invalid", psoc_id);
+		return NULL;
+	}
+
+	qdf_spin_lock_bh(&g_umac_glb_obj->global_lock);
+
+	psoc = g_umac_glb_obj->psoc[psoc_id];
+	if (psoc) {
+		if (QDF_IS_STATUS_ERROR(wlan_objmgr_psoc_try_get_ref(psoc,
+								     dbg_id)))
+			psoc = NULL;
+	}
+
+	qdf_spin_unlock_bh(&g_umac_glb_obj->global_lock);
+
+	return psoc;
+}
+
 #ifdef WLAN_FEATURE_11BE_MLO
 struct mlo_mgr_context *wlan_objmgr_get_mlo_ctx(void)
 {