[PATCH v6 20/26] drm/debugfs: bridges_show: show refcount

Luca Ceresoli
2025-02-06T18:15:32Z

Now that bridges are optionally refcounted, it is useful to know about that
in debugfs.

Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

---

This patch was added in v6.
---
drivers/gpu/drm/drm_debugfs.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 7424d5237e7615d63de6bba572ee6050da6709d0..629074247ffec4fa18df7af2d9023255abed501c 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -743,6 +743,12 @@ void drm_debugfs_crtc_remove(struct drm_crtc *crtc)
static void bridge_print(struct drm_printer *p, struct drm_bridge *bridge, unsigned int idx)
{
drm_printf(p, "bridge[%u]: %ps\n", idx, bridge->funcs);
+
+ if (drm_bridge_is_refcounted(bridge))
+ drm_printf(p, "\trefcount: %u\n", kref_read(&bridge->refcount));
+ else
+ drm_printf(p, "\trefcount: N/A\n");
+
drm_printf(p, "\ttype: [%d] %s\n",
bridge->type,
drm_get_connector_type_name(bridge->type));

--
2.34.1