[PATCH] media:v4l2-async:debugfs for registered subdevices
From: luo.liu
Date: Fri Mar 13 2026 - 03:59:34 EST
Add a new debugfs file "registered_subdevices" under the "v4l2-async"
directory to display all registered subdevices in the subdev_list. This
helps with debugging by providing a clear view of all currently registered
V4L2 subdevices.
The new file displays each subdevice's name and device path (if available).
Signed-off-by: luo.liu <luo.liu.linux@xxxxxxx>
---
drivers/media/v4l2-core/v4l2-async.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index 888a2e213b08..0f90ee268d99 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -966,6 +966,25 @@ static int pending_subdevs_show(struct seq_file *s, void *data)
}
DEFINE_SHOW_ATTRIBUTE(pending_subdevs);
+static int registered_subdevs_show(struct seq_file *s, void *data)
+{
+ struct v4l2_subdev *sd;
+
+ mutex_lock(&list_lock);
+
+ list_for_each_entry(sd, &subdev_list, async_list) {
+ seq_printf(s, "%s", sd->name);
+ if (sd->dev)
+ seq_printf(s, " (dev: %s)", dev_name(sd->dev));
+ seq_putc(s, '\n');
+ }
+
+ mutex_unlock(&list_lock);
+
+ return 0;
+}
+DEFINE_SHOW_ATTRIBUTE(registered_subdevs);
+
static struct dentry *v4l2_async_debugfs_dir;
static int __init v4l2_async_init(void)
@@ -974,6 +993,9 @@ static int __init v4l2_async_init(void)
debugfs_create_file("pending_async_subdevices", 0444,
v4l2_async_debugfs_dir, NULL,
&pending_subdevs_fops);
+ debugfs_create_file("registered_subdevices", 0444,
+ v4l2_async_debugfs_dir, NULL,
+ ®istered_subdevs_fops);
return 0;
}
base-commit: 5c9e55fecf9365890c64f14761a80f9413a3b1d1
--
2.25.1