Skip to content

Commit 89f9dba

Browse files
T.J. MercierAlexei Starovoitov
authored andcommitted
dma-buf: Rename debugfs symbols
Rename the debugfs list and mutex so it's clear they are now usable without the need for CONFIG_DEBUG_FS. The list will always be populated to support the creation of a BPF iterator for dmabufs. Signed-off-by: T.J. Mercier <tjmercier@google.com> Reviewed-by: Christian König <christian.koenig@amd.com> Acked-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20250522230429.941193-2-tjmercier@google.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 079e5c5 commit 89f9dba

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed

drivers/dma-buf/dma-buf.c

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,25 @@
3535

3636
static inline int is_dma_buf_file(struct file *);
3737

38-
#if IS_ENABLED(CONFIG_DEBUG_FS)
39-
static DEFINE_MUTEX(debugfs_list_mutex);
40-
static LIST_HEAD(debugfs_list);
38+
static DEFINE_MUTEX(dmabuf_list_mutex);
39+
static LIST_HEAD(dmabuf_list);
4140

42-
static void __dma_buf_debugfs_list_add(struct dma_buf *dmabuf)
41+
static void __dma_buf_list_add(struct dma_buf *dmabuf)
4342
{
44-
mutex_lock(&debugfs_list_mutex);
45-
list_add(&dmabuf->list_node, &debugfs_list);
46-
mutex_unlock(&debugfs_list_mutex);
43+
mutex_lock(&dmabuf_list_mutex);
44+
list_add(&dmabuf->list_node, &dmabuf_list);
45+
mutex_unlock(&dmabuf_list_mutex);
4746
}
4847

49-
static void __dma_buf_debugfs_list_del(struct dma_buf *dmabuf)
48+
static void __dma_buf_list_del(struct dma_buf *dmabuf)
5049
{
5150
if (!dmabuf)
5251
return;
5352

54-
mutex_lock(&debugfs_list_mutex);
53+
mutex_lock(&dmabuf_list_mutex);
5554
list_del(&dmabuf->list_node);
56-
mutex_unlock(&debugfs_list_mutex);
55+
mutex_unlock(&dmabuf_list_mutex);
5756
}
58-
#else
59-
static void __dma_buf_debugfs_list_add(struct dma_buf *dmabuf)
60-
{
61-
}
62-
63-
static void __dma_buf_debugfs_list_del(struct dma_buf *dmabuf)
64-
{
65-
}
66-
#endif
6757

6858
static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen)
6959
{
@@ -115,7 +105,7 @@ static int dma_buf_file_release(struct inode *inode, struct file *file)
115105
if (!is_dma_buf_file(file))
116106
return -EINVAL;
117107

118-
__dma_buf_debugfs_list_del(file->private_data);
108+
__dma_buf_list_del(file->private_data);
119109

120110
return 0;
121111
}
@@ -689,7 +679,7 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
689679
file->f_path.dentry->d_fsdata = dmabuf;
690680
dmabuf->file = file;
691681

692-
__dma_buf_debugfs_list_add(dmabuf);
682+
__dma_buf_list_add(dmabuf);
693683

694684
return dmabuf;
695685

@@ -1630,7 +1620,7 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused)
16301620
size_t size = 0;
16311621
int ret;
16321622

1633-
ret = mutex_lock_interruptible(&debugfs_list_mutex);
1623+
ret = mutex_lock_interruptible(&dmabuf_list_mutex);
16341624

16351625
if (ret)
16361626
return ret;
@@ -1639,7 +1629,7 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused)
16391629
seq_printf(s, "%-8s\t%-8s\t%-8s\t%-8s\texp_name\t%-8s\tname\n",
16401630
"size", "flags", "mode", "count", "ino");
16411631

1642-
list_for_each_entry(buf_obj, &debugfs_list, list_node) {
1632+
list_for_each_entry(buf_obj, &dmabuf_list, list_node) {
16431633

16441634
ret = dma_resv_lock_interruptible(buf_obj->resv, NULL);
16451635
if (ret)
@@ -1676,11 +1666,11 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused)
16761666

16771667
seq_printf(s, "\nTotal %d objects, %zu bytes\n", count, size);
16781668

1679-
mutex_unlock(&debugfs_list_mutex);
1669+
mutex_unlock(&dmabuf_list_mutex);
16801670
return 0;
16811671

16821672
error_unlock:
1683-
mutex_unlock(&debugfs_list_mutex);
1673+
mutex_unlock(&dmabuf_list_mutex);
16841674
return ret;
16851675
}
16861676

include/linux/dma-buf.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,8 @@ struct dma_buf {
370370
*/
371371
struct module *owner;
372372

373-
#if IS_ENABLED(CONFIG_DEBUG_FS)
374373
/** @list_node: node for dma_buf accounting and debugging. */
375374
struct list_head list_node;
376-
#endif
377375

378376
/** @priv: exporter specific private data for this buffer object. */
379377
void *priv;

0 commit comments

Comments
 (0)