mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media:v4l2-async:debugfs for registered subdevices
@ 2026-03-13  7:58 luo.liu
  2026-03-13 10:28 ` Sakari Ailus
  0 siblings, 1 reply; 11+ messages in thread
From: luo.liu @ 2026-03-13  7:58 UTC (permalink / raw)
  To: sakari.ailus, mchehab; +Cc: linux-media, linux-kernel, luo.liu.linux

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@163.com>
---
 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,
+			    &registered_subdevs_fops);
 
 	return 0;
 }

base-commit: 5c9e55fecf9365890c64f14761a80f9413a3b1d1
-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-03-20  6:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-13  7:58 [PATCH] media:v4l2-async:debugfs for registered subdevices luo.liu
2026-03-13 10:28 ` Sakari Ailus
2026-03-13 11:21   ` luo.liu.linux
2026-03-13 11:42     ` Sakari Ailus
2026-03-13 13:50       ` luo.liu.linux
2026-03-16 16:48         ` Sakari Ailus
2026-03-17  3:37           ` luo.liu.linux
2026-03-17  8:21             ` Sakari Ailus
2026-03-17 11:14               ` luo.liu.linux
2026-03-19 20:30                 ` Laurent Pinchart
2026-03-20  6:52                   ` luo.liu.linux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome