ANDROID: dma-buf: Export API to iterate through dmabuf debugfs info

Export API to iterate through debugfs_list information for external users
who would like to access the dmabuf debug information.

This effectively reverts commit "dbaf8b29f246876fc0055a868656b2f675bfb23f"
in favor of this approach.

Bug: 394900912
Change-Id: I07d97de94989ed2c65a4e4a3c65605fc563ea777
Signed-off-by: Oreoluwa Babatunde <quic_obabatun@quicinc.com>
This commit is contained in:
Oreoluwa Babatunde
2025-04-02 11:08:15 -07:00
committed by Treehugger Robot
parent c61d305397
commit 4e54be02ff
2 changed files with 30 additions and 6 deletions
+28 -4
View File
@@ -34,11 +34,28 @@
#include "dma-buf-sysfs-stats.h"
#if IS_ENABLED(CONFIG_DEBUG_FS)
DEFINE_MUTEX(debugfs_list_mutex);
EXPORT_SYMBOL_NS_GPL(debugfs_list_mutex, DMA_BUF);
static DEFINE_MUTEX(debugfs_list_mutex);
static LIST_HEAD(debugfs_list);
LIST_HEAD(debugfs_list);
EXPORT_SYMBOL_NS_GPL(debugfs_list, DMA_BUF);
int get_dmabuf_debugfs_data(int (*fn)(const struct dma_buf *, void *),
void *private)
{
int ret;
struct dma_buf *dmabuf;
mutex_lock(&debugfs_list_mutex);
list_for_each_entry(dmabuf, &debugfs_list, list_node) {
ret = fn(dmabuf, private);
if (ret)
break;
}
mutex_unlock(&debugfs_list_mutex);
return ret;
}
EXPORT_SYMBOL_NS_GPL(get_dmabuf_debugfs_data, DMA_BUF);
static void __dma_buf_debugfs_list_add(struct dma_buf *dmabuf)
{
@@ -57,6 +74,13 @@ static void __dma_buf_debugfs_list_del(struct dma_buf *dmabuf)
mutex_unlock(&debugfs_list_mutex);
}
#else
int get_dmabuf_debugfs_data(int (*fn)(const struct dma_buf *, void *),
void *private)
{
return -EINVAL;
}
EXPORT_SYMBOL_NS_GPL(get_dmabuf_debugfs_data, DMA_BUF);
static void __dma_buf_debugfs_list_add(struct dma_buf *dmabuf)
{
}
+2 -2
View File
@@ -629,8 +629,8 @@ struct dma_buf_export_info {
};
#if IS_ENABLED(CONFIG_DEBUG_FS)
extern struct list_head debugfs_list;
extern struct mutex debugfs_list_mutex;
int get_dmabuf_debugfs_data(int (*fn)(const struct dma_buf *, void *),
void *private);
#endif
/**