Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

T.J. Mercier and committed by
Alexei Starovoitov
89f9dba3 079e5c56

+15 -27
+15 -25
drivers/dma-buf/dma-buf.c
··· 35 35 36 36 static inline int is_dma_buf_file(struct file *); 37 37 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); 41 40 42 - static void __dma_buf_debugfs_list_add(struct dma_buf *dmabuf) 41 + static void __dma_buf_list_add(struct dma_buf *dmabuf) 43 42 { 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); 47 46 } 48 47 49 - static void __dma_buf_debugfs_list_del(struct dma_buf *dmabuf) 48 + static void __dma_buf_list_del(struct dma_buf *dmabuf) 50 49 { 51 50 if (!dmabuf) 52 51 return; 53 52 54 - mutex_lock(&debugfs_list_mutex); 53 + mutex_lock(&dmabuf_list_mutex); 55 54 list_del(&dmabuf->list_node); 56 - mutex_unlock(&debugfs_list_mutex); 55 + mutex_unlock(&dmabuf_list_mutex); 57 56 } 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 67 57 68 58 static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen) 69 59 { ··· 105 115 if (!is_dma_buf_file(file)) 106 116 return -EINVAL; 107 117 108 - __dma_buf_debugfs_list_del(file->private_data); 118 + __dma_buf_list_del(file->private_data); 109 119 110 120 return 0; 111 121 } ··· 679 689 file->f_path.dentry->d_fsdata = dmabuf; 680 690 dmabuf->file = file; 681 691 682 - __dma_buf_debugfs_list_add(dmabuf); 692 + __dma_buf_list_add(dmabuf); 683 693 684 694 return dmabuf; 685 695 ··· 1620 1630 size_t size = 0; 1621 1631 int ret; 1622 1632 1623 - ret = mutex_lock_interruptible(&debugfs_list_mutex); 1633 + ret = mutex_lock_interruptible(&dmabuf_list_mutex); 1624 1634 1625 1635 if (ret) 1626 1636 return ret; ··· 1629 1639 seq_printf(s, "%-8s\t%-8s\t%-8s\t%-8s\texp_name\t%-8s\tname\n", 1630 1640 "size", "flags", "mode", "count", "ino"); 1631 1641 1632 - list_for_each_entry(buf_obj, &debugfs_list, list_node) { 1642 + list_for_each_entry(buf_obj, &dmabuf_list, list_node) { 1633 1643 1634 1644 ret = dma_resv_lock_interruptible(buf_obj->resv, NULL); 1635 1645 if (ret) ··· 1666 1676 1667 1677 seq_printf(s, "\nTotal %d objects, %zu bytes\n", count, size); 1668 1678 1669 - mutex_unlock(&debugfs_list_mutex); 1679 + mutex_unlock(&dmabuf_list_mutex); 1670 1680 return 0; 1671 1681 1672 1682 error_unlock: 1673 - mutex_unlock(&debugfs_list_mutex); 1683 + mutex_unlock(&dmabuf_list_mutex); 1674 1684 return ret; 1675 1685 } 1676 1686
-2
include/linux/dma-buf.h
··· 370 370 */ 371 371 struct module *owner; 372 372 373 - #if IS_ENABLED(CONFIG_DEBUG_FS) 374 373 /** @list_node: node for dma_buf accounting and debugging. */ 375 374 struct list_head list_node; 376 - #endif 377 375 378 376 /** @priv: exporter specific private data for this buffer object. */ 379 377 void *priv;