qcacmn: Add object manager API to iterate psoc list

Add object manager to iterate through all the psoc in
the system and call the provided callback with relevant
arguments

Change-Id: I92f4c1248447ce14413b666076e515c0569385a0
CRs-Fixed: 2413775
这个提交包含在:
Santosh Anbu
2019-03-14 18:29:24 +05:30
提交者 nshrivas
父节点 8f70862cd8
当前提交 e0f17e57bb
修改 2 个文件,包含 50 行新增1 行删除

查看文件

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -480,4 +480,29 @@ QDF_STATUS wlan_objmgr_unregister_peer_status_handler(
wlan_objmgr_peer_status_handler handler,
void *args);
/**
* APIs to operations on psoc
*/
typedef void (*wlan_objmgr_psoc_handler)(struct wlan_objmgr_psoc *psoc,
void *arg,
uint8_t index);
/**
* wlan_objmgr_iterate_psoc_list() - iterate through all psocs
*
* @handler: the handler will be called for each psoc
* the handler should be implemented to perform required operation
* @arg: agruments passed by caller
* @dbg_id: id of the caller
*
* API to be used for performing the operations on all psoc
* The "handler" here shouldn't take g_umac_glb_obj->global_lock lock when
* processing
*
* Return: SUCCESS/FAILURE
*/
QDF_STATUS wlan_objmgr_iterate_psoc_list(
wlan_objmgr_psoc_handler handler,
void *arg, wlan_objmgr_ref_dbgid dbg_id);
#endif /* _WLAN_OBJMGR_GLOBAL_OBJ_H_*/

查看文件

@@ -785,3 +785,27 @@ void wlan_objmgr_print_ref_ids(qdf_atomic_t *id,
return;
}
QDF_STATUS wlan_objmgr_iterate_psoc_list(
wlan_objmgr_psoc_handler handler,
void *arg, wlan_objmgr_ref_dbgid dbg_id)
{
uint8_t index = 0;
qdf_spin_lock_bh(&g_umac_glb_obj->global_lock);
while (index < WLAN_OBJMGR_MAX_DEVICES) {
if (g_umac_glb_obj->psoc[index]) {
handler((void *)g_umac_glb_obj->psoc[index],
arg, index);
}
index++;
}
qdf_spin_unlock_bh(&g_umac_glb_obj->global_lock);
return QDF_STATUS_SUCCESS;
}
qdf_export_symbol(wlan_objmgr_iterate_psoc_list);