linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] drm/bridge: convert users of of_drm_find_bridge(), part 3
@ 2026-01-07 16:21 Luca Ceresoli
  2026-01-07 16:21 ` [PATCH 1/6] drm/bridge: dw-hdmi: convert to of_drm_find_and_get_bridge() Luca Ceresoli
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Luca Ceresoli @ 2026-01-07 16:21 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Philipp Zabel, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Chun-Kuang Hu, Matthias Brugger, AngeloGioacchino Del Regno,
	Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
	Geert Uytterhoeven, Magnus Damm
  Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, imx, linux-mediatek, linux-samsung-soc,
	linux-renesas-soc, Luca Ceresoli

This series converts many DRM drivers from the now deprecated
of_drm_find_bridge() to its replacement of_drm_find_and_get_bridge() which
allows correct bridge refcounting. Where applicable it also converts
per-driver "next_bridge" pointers to the unified drm_bridge::next_bridge
which puts the reference automatically on bridge deallocation.

This is part of the work to support hotplug of DRM bridges. The grand plan
was discussed in [0].

Here's the work breakdown (➜ marks the current series):

 1. ➜ add refcounting to DRM bridges struct drm_bridge,
      based on devm_drm_bridge_alloc()
    A. ✔ add new alloc API and refcounting (v6.16)
    B. ✔ convert all bridge drivers to new API (v6.17)
    C. ✔ kunit tests (v6.17)
    D. ✔ add get/put to drm_bridge_add/remove() + attach/detach()
         and warn on old allocation pattern (v6.17)
    E. ➜ add get/put on drm_bridge accessors
       1. ✔ drm_bridge_chain_get_first_bridge(), add cleanup action (v6.18)
       2. ✔ drm_bridge_get_prev_bridge() (v6.18)
       3. ✔ drm_bridge_get_next_bridge() (v6.19)
       4. ✔ drm_for_each_bridge_in_chain() (v6.19)
       5. ✔ drm_bridge_connector_init (v6.19)
       6. … protect encoder bridge chain with a mutex
       7. ➜ of_drm_find_bridge
          a. ✔… add of_drm_get_bridge(), convert basic direct users
	        (v6.20?, one driver still pending)
	  b. … convert direct of_drm_get_bridge() users, part 2
	  c. ➜ convert direct of_drm_get_bridge() users, part 3
	  d.   convert direct of_drm_get_bridge() users, part 4
	  e.   convert bridge-only drm_of_find_panel_or_bridge() users
       8. drm_of_find_panel_or_bridge, *_of_get_bridge
       9. ✔ enforce drm_bridge_add before drm_bridge_attach (v6.19)
    F. ✔ debugfs improvements
       1. ✔ add top-level 'bridges' file (v6.16)
       2. ✔ show refcount and list lingering bridges (v6.19)
 2. … handle gracefully atomic updates during bridge removal
    A. ✔ Add drm_dev_enter/exit() to protect device resources (v6.20?)
    B. … protect private_obj removal from list
 3. … DSI host-device driver interaction
 4. ✔ removing the need for the "always-disconnected" connector
 5. finish the hotplug bridge work, moving code to the core and potentially
    removing the hotplug-bridge itself (this needs to be clarified as
    points 1-3 are developed)

[0] https://lore.kernel.org/lkml/20250206-hotplug-drm-bridge-v6-0-9d6f2c9c3058@bootlin.com/#t

This work is a continuation of the work to correctly handle bridge
refcounting for existing of_drm_find_bridge(). The ground work is in:

 - commit 293a8fd7721a ("drm/bridge: add of_drm_find_and_get_bridge()")
 - commit 9da0e06abda8 ("drm/bridge: deprecate of_drm_find_bridge()")
 - commit 3fdeae134ba9 ("drm/bridge: add next_bridge pointer to struct drm_bridge")

The whole conversion is split in multiple series to make the review process
a bit smoother:

 - Part 2: mostly drivers in drivers/gpu/drm/bridge [2]
 - Part 3: other drivers, low-medium complexity [this series]
 - Part 4: other drivers, complex (not sent yet)

[2] https://lore.kernel.org/all/20260107-drm-bridge-alloc-getput-drm_of_find_bridge-2-v1-0-283d7bba061a@bootlin.com/

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Luca Ceresoli (6):
      drm/bridge: dw-hdmi: convert to of_drm_find_and_get_bridge()
      drm/meson/dw-hdmi: convert to of_drm_find_and_get_bridge()
      drm/imx/dw-hdmi: convert to of_drm_find_and_get_bridge()
      drm/mediatek: mtk_hdmi*: convert to of_drm_find_and_get_bridge()
      drm/exynos: hdmi: convert to of_drm_find_and_get_bridge()
      drm: rcar-du: lvds: convert to of_drm_find_and_get_bridge()

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c   |  7 +++----
 drivers/gpu/drm/exynos/exynos_hdmi.c        |  4 +++-
 drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c     |  3 ++-
 drivers/gpu/drm/mediatek/mtk_hdmi.c         |  4 ++--
 drivers/gpu/drm/mediatek/mtk_hdmi_common.c  |  4 ++--
 drivers/gpu/drm/mediatek/mtk_hdmi_common.h  |  1 -
 drivers/gpu/drm/mediatek/mtk_hdmi_v2.c      |  4 ++--
 drivers/gpu/drm/meson/meson_dw_hdmi.c       |  6 +++++-
 drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c | 10 +++++++++-
 9 files changed, 28 insertions(+), 15 deletions(-)
---
base-commit: faeb4ff6d6e41c42741fd1df8e1d0b80f9452403
change-id: 20260107-drm-bridge-alloc-getput-drm_of_find_bridge-3-4f997ea7c79f

Best regards,
-- 
Luca Ceresoli <luca.ceresoli@bootlin.com>



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

* [PATCH 1/6] drm/bridge: dw-hdmi: convert to of_drm_find_and_get_bridge()
  2026-01-07 16:21 [PATCH 0/6] drm/bridge: convert users of of_drm_find_bridge(), part 3 Luca Ceresoli
@ 2026-01-07 16:21 ` Luca Ceresoli
  2026-01-08  8:10   ` Maxime Ripard
  2026-01-07 16:22 ` [PATCH 2/6] drm/meson/dw-hdmi: " Luca Ceresoli
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Luca Ceresoli @ 2026-01-07 16:21 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Philipp Zabel, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Chun-Kuang Hu, Matthias Brugger, AngeloGioacchino Del Regno,
	Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
	Geert Uytterhoeven, Magnus Damm
  Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, imx, linux-mediatek, linux-samsung-soc,
	linux-renesas-soc, Luca Ceresoli

of_drm_find_bridge() is deprecated. Move to its replacement
of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
is put when done by using the drm_bridge::next_bridge pointer.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 3b77e73ac0ea..ee88c0e793b0 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -132,7 +132,6 @@ struct dw_hdmi_phy_data {
 struct dw_hdmi {
 	struct drm_connector connector;
 	struct drm_bridge bridge;
-	struct drm_bridge *next_bridge;
 
 	unsigned int version;
 
@@ -2912,7 +2911,7 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge,
 	struct dw_hdmi *hdmi = bridge->driver_private;
 
 	if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
-		return drm_bridge_attach(encoder, hdmi->next_bridge,
+		return drm_bridge_attach(encoder, hdmi->bridge.next_bridge,
 					 bridge, flags);
 
 	return dw_hdmi_connector_create(hdmi);
@@ -3318,9 +3317,9 @@ static int dw_hdmi_parse_dt(struct dw_hdmi *hdmi)
 	if (!remote)
 		return -ENODEV;
 
-	hdmi->next_bridge = of_drm_find_bridge(remote);
+	hdmi->bridge.next_bridge = of_drm_find_and_get_bridge(remote);
 	of_node_put(remote);
-	if (!hdmi->next_bridge)
+	if (!hdmi->bridge.next_bridge)
 		return -EPROBE_DEFER;
 
 	return 0;

-- 
2.52.0



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

* [PATCH 2/6] drm/meson/dw-hdmi: convert to of_drm_find_and_get_bridge()
  2026-01-07 16:21 [PATCH 0/6] drm/bridge: convert users of of_drm_find_bridge(), part 3 Luca Ceresoli
  2026-01-07 16:21 ` [PATCH 1/6] drm/bridge: dw-hdmi: convert to of_drm_find_and_get_bridge() Luca Ceresoli
@ 2026-01-07 16:22 ` Luca Ceresoli
  2026-01-08  8:13   ` Maxime Ripard
  2026-01-07 16:22 ` [PATCH 3/6] drm/imx/dw-hdmi: " Luca Ceresoli
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Luca Ceresoli @ 2026-01-07 16:22 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Philipp Zabel, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Chun-Kuang Hu, Matthias Brugger, AngeloGioacchino Del Regno,
	Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
	Geert Uytterhoeven, Magnus Damm
  Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, imx, linux-mediatek, linux-samsung-soc,
	linux-renesas-soc, Luca Ceresoli

of_drm_find_bridge() is deprecated. Move to its replacement
of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
is put when done.

dw_hdmi->bridge is used only in dw_hdmi_top_thread_irq(), so in order to
avoid potential use-after-free ensure the irq is freed before putting the
dw_hdmi->bridge reference.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index 0d7c68b29dff..fef1702acb14 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -778,7 +778,7 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
 	if (IS_ERR(meson_dw_hdmi->hdmi))
 		return PTR_ERR(meson_dw_hdmi->hdmi);
 
-	meson_dw_hdmi->bridge = of_drm_find_bridge(pdev->dev.of_node);
+	meson_dw_hdmi->bridge = of_drm_find_and_get_bridge(pdev->dev.of_node);
 
 	DRM_DEBUG_DRIVER("HDMI controller initialized\n");
 
@@ -789,8 +789,12 @@ static void meson_dw_hdmi_unbind(struct device *dev, struct device *master,
 				   void *data)
 {
 	struct meson_dw_hdmi *meson_dw_hdmi = dev_get_drvdata(dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	int irq = platform_get_irq(pdev, 0);
 
+	devm_free_irq(dev, irq, meson_dw_hdmi);
 	dw_hdmi_unbind(meson_dw_hdmi->hdmi);
+	drm_bridge_put(meson_dw_hdmi->bridge);
 }
 
 static const struct component_ops meson_dw_hdmi_ops = {

-- 
2.52.0



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

* [PATCH 3/6] drm/imx/dw-hdmi: convert to of_drm_find_and_get_bridge()
  2026-01-07 16:21 [PATCH 0/6] drm/bridge: convert users of of_drm_find_bridge(), part 3 Luca Ceresoli
  2026-01-07 16:21 ` [PATCH 1/6] drm/bridge: dw-hdmi: convert to of_drm_find_and_get_bridge() Luca Ceresoli
  2026-01-07 16:22 ` [PATCH 2/6] drm/meson/dw-hdmi: " Luca Ceresoli
@ 2026-01-07 16:22 ` Luca Ceresoli
  2026-01-07 16:34   ` Philipp Zabel
  2026-01-07 16:22 ` [PATCH 4/6] drm/mediatek: mtk_hdmi*: " Luca Ceresoli
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Luca Ceresoli @ 2026-01-07 16:22 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Philipp Zabel, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Chun-Kuang Hu, Matthias Brugger, AngeloGioacchino Del Regno,
	Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
	Geert Uytterhoeven, Magnus Damm
  Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, imx, linux-mediatek, linux-samsung-soc,
	linux-renesas-soc, Luca Ceresoli

of_drm_find_bridge() is deprecated. Move to its replacement
of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
is put when done.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c b/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c
index 07e5f96202d4..95f629d97bce 100644
--- a/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c
+++ b/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c
@@ -241,7 +241,7 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev)
 	if (IS_ERR(hdmi->hdmi))
 		return PTR_ERR(hdmi->hdmi);
 
-	hdmi->bridge = of_drm_find_bridge(np);
+	hdmi->bridge = of_drm_find_and_get_bridge(np);
 	if (!hdmi->bridge) {
 		dev_err(hdmi->dev, "Unable to find bridge\n");
 		dw_hdmi_remove(hdmi->hdmi);
@@ -261,6 +261,7 @@ static void dw_hdmi_imx_remove(struct platform_device *pdev)
 
 	component_del(&pdev->dev, &dw_hdmi_imx_ops);
 	dw_hdmi_remove(hdmi->hdmi);
+	drm_bridge_put(hdmi->bridge);
 }
 
 static struct platform_driver dw_hdmi_imx_platform_driver = {

-- 
2.52.0



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

* [PATCH 4/6] drm/mediatek: mtk_hdmi*: convert to of_drm_find_and_get_bridge()
  2026-01-07 16:21 [PATCH 0/6] drm/bridge: convert users of of_drm_find_bridge(), part 3 Luca Ceresoli
                   ` (2 preceding siblings ...)
  2026-01-07 16:22 ` [PATCH 3/6] drm/imx/dw-hdmi: " Luca Ceresoli
@ 2026-01-07 16:22 ` Luca Ceresoli
  2026-01-08  8:13   ` Maxime Ripard
  2026-01-07 16:22 ` [PATCH 5/6] drm/exynos: hdmi: " Luca Ceresoli
  2026-01-07 16:22 ` [PATCH 6/6] drm: rcar-du: lvds: " Luca Ceresoli
  5 siblings, 1 reply; 15+ messages in thread
From: Luca Ceresoli @ 2026-01-07 16:22 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Philipp Zabel, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Chun-Kuang Hu, Matthias Brugger, AngeloGioacchino Del Regno,
	Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
	Geert Uytterhoeven, Magnus Damm
  Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, imx, linux-mediatek, linux-samsung-soc,
	linux-renesas-soc, Luca Ceresoli

of_drm_find_bridge() is deprecated. Move to its replacement
of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
is put when done by using the drm_bridge::next_bridge pointer.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/gpu/drm/mediatek/mtk_hdmi.c        | 4 ++--
 drivers/gpu/drm/mediatek/mtk_hdmi_common.c | 4 ++--
 drivers/gpu/drm/mediatek/mtk_hdmi_common.h | 1 -
 drivers/gpu/drm/mediatek/mtk_hdmi_v2.c     | 4 ++--
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 0face4dcaa36..1ea259854780 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -986,8 +986,8 @@ static int mtk_hdmi_bridge_attach(struct drm_bridge *bridge,
 		return -EINVAL;
 	}
 
-	if (hdmi->next_bridge) {
-		ret = drm_bridge_attach(encoder, hdmi->next_bridge,
+	if (hdmi->bridge.next_bridge) {
+		ret = drm_bridge_attach(encoder, hdmi->bridge.next_bridge,
 					bridge, flags);
 		if (ret)
 			return ret;
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
index e78eb0876f16..40ded86dbea3 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
@@ -315,8 +315,8 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, struct platform_device
 		return -EINVAL;
 
 	if (!of_device_is_compatible(remote, "hdmi-connector")) {
-		hdmi->next_bridge = of_drm_find_bridge(remote);
-		if (!hdmi->next_bridge) {
+		hdmi->bridge.next_bridge = of_drm_find_and_get_bridge(remote);
+		if (!hdmi->bridge.next_bridge) {
 			dev_err(dev, "Waiting for external bridge\n");
 			of_node_put(remote);
 			return -EPROBE_DEFER;
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_common.h b/drivers/gpu/drm/mediatek/mtk_hdmi_common.h
index de5e064585f8..cace3c5dc067 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_common.h
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_common.h
@@ -150,7 +150,6 @@ struct mtk_hdmi_conf {
 
 struct mtk_hdmi {
 	struct drm_bridge bridge;
-	struct drm_bridge *next_bridge;
 	struct drm_connector *curr_conn;/* current connector (only valid when 'enabled') */
 	struct device *dev;
 	const struct mtk_hdmi_conf *conf;
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
index c272e1e74b7d..2adeece499b6 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
@@ -940,8 +940,8 @@ static int mtk_hdmi_v2_bridge_attach(struct drm_bridge *bridge,
 		DRM_ERROR("The flag DRM_BRIDGE_ATTACH_NO_CONNECTOR must be supplied\n");
 		return -EINVAL;
 	}
-	if (hdmi->next_bridge) {
-		ret = drm_bridge_attach(encoder, hdmi->next_bridge, bridge, flags);
+	if (hdmi->bridge.next_bridge) {
+		ret = drm_bridge_attach(encoder, hdmi->bridge.next_bridge, bridge, flags);
 		if (ret)
 			return ret;
 	}

-- 
2.52.0



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

* [PATCH 5/6] drm/exynos: hdmi: convert to of_drm_find_and_get_bridge()
  2026-01-07 16:21 [PATCH 0/6] drm/bridge: convert users of of_drm_find_bridge(), part 3 Luca Ceresoli
                   ` (3 preceding siblings ...)
  2026-01-07 16:22 ` [PATCH 4/6] drm/mediatek: mtk_hdmi*: " Luca Ceresoli
@ 2026-01-07 16:22 ` Luca Ceresoli
  2026-01-08  8:14   ` Maxime Ripard
  2026-01-08  9:51   ` Marek Szyprowski
  2026-01-07 16:22 ` [PATCH 6/6] drm: rcar-du: lvds: " Luca Ceresoli
  5 siblings, 2 replies; 15+ messages in thread
From: Luca Ceresoli @ 2026-01-07 16:22 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Philipp Zabel, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Chun-Kuang Hu, Matthias Brugger, AngeloGioacchino Del Regno,
	Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
	Geert Uytterhoeven, Magnus Damm
  Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, imx, linux-mediatek, linux-samsung-soc,
	linux-renesas-soc, Luca Ceresoli

of_drm_find_bridge() is deprecated. Move to its replacement
of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
is put when done.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/gpu/drm/exynos/exynos_hdmi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 01813e11e6c6..bfcf2fa62fe1 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1779,7 +1779,7 @@ static int hdmi_bridge_init(struct hdmi_context *hdata)
 		return -EINVAL;
 	}
 
-	hdata->bridge = of_drm_find_bridge(np);
+	hdata->bridge = of_drm_find_and_get_bridge(np);
 	of_node_put(np);
 
 	if (!hdata->bridge)
@@ -2096,6 +2096,8 @@ static void hdmi_remove(struct platform_device *pdev)
 
 	put_device(&hdata->ddc_adpt->dev);
 
+	drm_bridge_put(hdata->bridge);
+
 	mutex_destroy(&hdata->mutex);
 }
 

-- 
2.52.0



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

* [PATCH 6/6] drm: rcar-du: lvds: convert to of_drm_find_and_get_bridge()
  2026-01-07 16:21 [PATCH 0/6] drm/bridge: convert users of of_drm_find_bridge(), part 3 Luca Ceresoli
                   ` (4 preceding siblings ...)
  2026-01-07 16:22 ` [PATCH 5/6] drm/exynos: hdmi: " Luca Ceresoli
@ 2026-01-07 16:22 ` Luca Ceresoli
  5 siblings, 0 replies; 15+ messages in thread
From: Luca Ceresoli @ 2026-01-07 16:22 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Philipp Zabel, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Chun-Kuang Hu, Matthias Brugger, AngeloGioacchino Del Regno,
	Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
	Geert Uytterhoeven, Magnus Damm
  Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, imx, linux-mediatek, linux-samsung-soc,
	linux-renesas-soc, Luca Ceresoli

of_drm_find_bridge() is deprecated. Move to its replacement
of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
is put when done.

Since the companion bridge pointer is used by .atomic_enable, putting its
reference in the remove function would be dangerous. Use .destroy to put it
on final deallocation.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c b/drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c
index 001b3543924a..227818e37390 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c
@@ -633,6 +633,13 @@ static bool rcar_lvds_mode_fixup(struct drm_bridge *bridge,
 	return true;
 }
 
+static void rcar_lvds_destroy(struct drm_bridge *bridge)
+{
+	struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge);
+
+	drm_bridge_put(lvds->companion);
+}
+
 static int rcar_lvds_attach(struct drm_bridge *bridge,
 			    struct drm_encoder *encoder,
 			    enum drm_bridge_attach_flags flags)
@@ -648,6 +655,7 @@ static int rcar_lvds_attach(struct drm_bridge *bridge,
 
 static const struct drm_bridge_funcs rcar_lvds_bridge_ops = {
 	.attach = rcar_lvds_attach,
+	.destroy = rcar_lvds_destroy,
 	.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
 	.atomic_reset = drm_atomic_helper_bridge_reset,
@@ -740,7 +748,7 @@ static int rcar_lvds_parse_dt_companion(struct rcar_lvds *lvds)
 		goto done;
 	}
 
-	lvds->companion = of_drm_find_bridge(companion);
+	lvds->companion = of_drm_find_and_get_bridge(companion);
 	if (!lvds->companion) {
 		ret = -EPROBE_DEFER;
 		goto done;

-- 
2.52.0



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

* Re: [PATCH 3/6] drm/imx/dw-hdmi: convert to of_drm_find_and_get_bridge()
  2026-01-07 16:22 ` [PATCH 3/6] drm/imx/dw-hdmi: " Luca Ceresoli
@ 2026-01-07 16:34   ` Philipp Zabel
  2026-01-07 17:03     ` Luca Ceresoli
  0 siblings, 1 reply; 15+ messages in thread
From: Philipp Zabel @ 2026-01-07 16:34 UTC (permalink / raw)
  To: Luca Ceresoli, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Chun-Kuang Hu, Matthias Brugger, AngeloGioacchino Del Regno,
	Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
	Geert Uytterhoeven, Magnus Damm
  Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, imx, linux-mediatek, linux-samsung-soc,
	linux-renesas-soc

On Mi, 2026-01-07 at 17:22 +0100, Luca Ceresoli wrote:
> of_drm_find_bridge() is deprecated. Move to its replacement
> of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
> is put when done.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> ---
>  drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c b/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c
> index 07e5f96202d4..95f629d97bce 100644
> --- a/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c
> +++ b/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c
> @@ -241,7 +241,7 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev)
>  	if (IS_ERR(hdmi->hdmi))
>  		return PTR_ERR(hdmi->hdmi);
>  
> -	hdmi->bridge = of_drm_find_bridge(np);
> +	hdmi->bridge = of_drm_find_and_get_bridge(np);
>  	if (!hdmi->bridge) {
>  		dev_err(hdmi->dev, "Unable to find bridge\n");
>  		dw_hdmi_remove(hdmi->hdmi);

The component_add() error path below this is missing a
drm_bridge_put().

regards
Philipp


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

* Re: [PATCH 3/6] drm/imx/dw-hdmi: convert to of_drm_find_and_get_bridge()
  2026-01-07 16:34   ` Philipp Zabel
@ 2026-01-07 17:03     ` Luca Ceresoli
  0 siblings, 0 replies; 15+ messages in thread
From: Luca Ceresoli @ 2026-01-07 17:03 UTC (permalink / raw)
  To: Philipp Zabel, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Chun-Kuang Hu, Matthias Brugger, AngeloGioacchino Del Regno,
	Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
	Geert Uytterhoeven, Magnus Damm
  Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, imx, linux-mediatek, linux-samsung-soc,
	linux-renesas-soc

Hello Philipp,

On Wed Jan 7, 2026 at 5:34 PM CET, Philipp Zabel wrote:
> On Mi, 2026-01-07 at 17:22 +0100, Luca Ceresoli wrote:
>> of_drm_find_bridge() is deprecated. Move to its replacement
>> of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
>> is put when done.
>>
>> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>> ---
>>  drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c b/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c
>> index 07e5f96202d4..95f629d97bce 100644
>> --- a/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c
>> +++ b/drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c
>> @@ -241,7 +241,7 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev)
>>  	if (IS_ERR(hdmi->hdmi))
>>  		return PTR_ERR(hdmi->hdmi);
>>
>> -	hdmi->bridge = of_drm_find_bridge(np);
>> +	hdmi->bridge = of_drm_find_and_get_bridge(np);
>>  	if (!hdmi->bridge) {
>>  		dev_err(hdmi->dev, "Unable to find bridge\n");
>>  		dw_hdmi_remove(hdmi->hdmi);
>
> The component_add() error path below this is missing a
> drm_bridge_put().

Right! Thanks for reviewing, fix queued for v2.

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


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

* Re: [PATCH 1/6] drm/bridge: dw-hdmi: convert to of_drm_find_and_get_bridge()
  2026-01-07 16:21 ` [PATCH 1/6] drm/bridge: dw-hdmi: convert to of_drm_find_and_get_bridge() Luca Ceresoli
@ 2026-01-08  8:10   ` Maxime Ripard
  0 siblings, 0 replies; 15+ messages in thread
From: Maxime Ripard @ 2026-01-08  8:10 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: dri-devel, imx, linux-amlogic, linux-arm-kernel, linux-kernel,
	linux-mediatek, linux-renesas-soc, linux-samsung-soc, Alim Akhtar,
	Andrzej Hajda, AngeloGioacchino Del Regno, Chun-Kuang Hu,
	David Airlie, Fabio Estevam, Geert Uytterhoeven, Hui Pu, Inki Dae,
	Jernej Skrabec, Jerome Brunet, Jonas Karlman, Kevin Hilman,
	Kieran Bingham, Krzysztof Kozlowski, Kyungmin Park,
	Laurent Pinchart, Laurent Pinchart, Maarten Lankhorst,
	Magnus Damm, Martin Blumenstingl, Matthias Brugger, Maxime Ripard,
	Neil Armstrong, Pengutronix Kernel Team, Philipp Zabel,
	Robert Foss, Sascha Hauer, Seung-Woo Kim, Shawn Guo,
	Simona Vetter, Thomas Petazzoni, Thomas Zimmermann,
	Tomi Valkeinen

On Wed, 7 Jan 2026 17:21:59 +0100, Luca Ceresoli wrote:
> of_drm_find_bridge() is deprecated. Move to its replacement
> of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
> is put when done by using the drm_bridge::next_bridge pointer.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> 
> [ ... ]

Acked-by: Maxime Ripard <mripard@kernel.org>

Thanks!
Maxime


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

* Re: [PATCH 2/6] drm/meson/dw-hdmi: convert to of_drm_find_and_get_bridge()
  2026-01-07 16:22 ` [PATCH 2/6] drm/meson/dw-hdmi: " Luca Ceresoli
@ 2026-01-08  8:13   ` Maxime Ripard
  0 siblings, 0 replies; 15+ messages in thread
From: Maxime Ripard @ 2026-01-08  8:13 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: dri-devel, imx, linux-amlogic, linux-arm-kernel, linux-kernel,
	linux-mediatek, linux-renesas-soc, linux-samsung-soc, Alim Akhtar,
	Andrzej Hajda, AngeloGioacchino Del Regno, Chun-Kuang Hu,
	David Airlie, Fabio Estevam, Geert Uytterhoeven, Hui Pu, Inki Dae,
	Jernej Skrabec, Jerome Brunet, Jonas Karlman, Kevin Hilman,
	Kieran Bingham, Krzysztof Kozlowski, Kyungmin Park,
	Laurent Pinchart, Laurent Pinchart, Maarten Lankhorst,
	Magnus Damm, Martin Blumenstingl, Matthias Brugger, Maxime Ripard,
	Neil Armstrong, Pengutronix Kernel Team, Philipp Zabel,
	Robert Foss, Sascha Hauer, Seung-Woo Kim, Shawn Guo,
	Simona Vetter, Thomas Petazzoni, Thomas Zimmermann,
	Tomi Valkeinen

On Wed, 7 Jan 2026 17:22:00 +0100, Luca Ceresoli wrote:
> of_drm_find_bridge() is deprecated. Move to its replacement
> of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
> is put when done.
> 
> dw_hdmi->bridge is used only in dw_hdmi_top_thread_irq(), so in order to
> 
> [ ... ]

Acked-by: Maxime Ripard <mripard@kernel.org>

Thanks!
Maxime


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

* Re: [PATCH 4/6] drm/mediatek: mtk_hdmi*: convert to of_drm_find_and_get_bridge()
  2026-01-07 16:22 ` [PATCH 4/6] drm/mediatek: mtk_hdmi*: " Luca Ceresoli
@ 2026-01-08  8:13   ` Maxime Ripard
  0 siblings, 0 replies; 15+ messages in thread
From: Maxime Ripard @ 2026-01-08  8:13 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: dri-devel, imx, linux-amlogic, linux-arm-kernel, linux-kernel,
	linux-mediatek, linux-renesas-soc, linux-samsung-soc, Alim Akhtar,
	Andrzej Hajda, AngeloGioacchino Del Regno, Chun-Kuang Hu,
	David Airlie, Fabio Estevam, Geert Uytterhoeven, Hui Pu, Inki Dae,
	Jernej Skrabec, Jerome Brunet, Jonas Karlman, Kevin Hilman,
	Kieran Bingham, Krzysztof Kozlowski, Kyungmin Park,
	Laurent Pinchart, Laurent Pinchart, Maarten Lankhorst,
	Magnus Damm, Martin Blumenstingl, Matthias Brugger, Maxime Ripard,
	Neil Armstrong, Pengutronix Kernel Team, Philipp Zabel,
	Robert Foss, Sascha Hauer, Seung-Woo Kim, Shawn Guo,
	Simona Vetter, Thomas Petazzoni, Thomas Zimmermann,
	Tomi Valkeinen

On Wed, 7 Jan 2026 17:22:02 +0100, Luca Ceresoli wrote:
> of_drm_find_bridge() is deprecated. Move to its replacement
> of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
> is put when done by using the drm_bridge::next_bridge pointer.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> 
> [ ... ]

Acked-by: Maxime Ripard <mripard@kernel.org>

Thanks!
Maxime


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

* Re: [PATCH 5/6] drm/exynos: hdmi: convert to of_drm_find_and_get_bridge()
  2026-01-07 16:22 ` [PATCH 5/6] drm/exynos: hdmi: " Luca Ceresoli
@ 2026-01-08  8:14   ` Maxime Ripard
  2026-01-08 10:13     ` Luca Ceresoli
  2026-01-08  9:51   ` Marek Szyprowski
  1 sibling, 1 reply; 15+ messages in thread
From: Maxime Ripard @ 2026-01-08  8:14 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Maarten Lankhorst,
	Thomas Zimmermann, David Airlie, Simona Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Philipp Zabel, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Chun-Kuang Hu, Matthias Brugger, AngeloGioacchino Del Regno,
	Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
	Geert Uytterhoeven, Magnus Damm, Hui Pu, Thomas Petazzoni,
	dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel, imx,
	linux-mediatek, linux-samsung-soc, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 1237 bytes --]

On Wed, Jan 07, 2026 at 05:22:03PM +0100, Luca Ceresoli wrote:
> of_drm_find_bridge() is deprecated. Move to its replacement
> of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
> is put when done.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

Why can't we use next_bridge for this one?

> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 01813e11e6c6..bfcf2fa62fe1 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -1779,7 +1779,7 @@ static int hdmi_bridge_init(struct hdmi_context *hdata)
>  		return -EINVAL;
>  	}
>  
> -	hdata->bridge = of_drm_find_bridge(np);
> +	hdata->bridge = of_drm_find_and_get_bridge(np);
>  	of_node_put(np);
>  
>  	if (!hdata->bridge)
> @@ -2096,6 +2096,8 @@ static void hdmi_remove(struct platform_device *pdev)
>  
>  	put_device(&hdata->ddc_adpt->dev);
>  
> +	drm_bridge_put(hdata->bridge);
> +
>  	mutex_destroy(&hdata->mutex);
>  }

Same story than in your part 2 series, it should be dropped in destroy.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

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

* Re: [PATCH 5/6] drm/exynos: hdmi: convert to of_drm_find_and_get_bridge()
  2026-01-07 16:22 ` [PATCH 5/6] drm/exynos: hdmi: " Luca Ceresoli
  2026-01-08  8:14   ` Maxime Ripard
@ 2026-01-08  9:51   ` Marek Szyprowski
  1 sibling, 0 replies; 15+ messages in thread
From: Marek Szyprowski @ 2026-01-08  9:51 UTC (permalink / raw)
  To: Luca Ceresoli, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	Philipp Zabel, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Chun-Kuang Hu, Matthias Brugger,
	AngeloGioacchino Del Regno, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Laurent Pinchart,
	Tomi Valkeinen, Kieran Bingham, Geert Uytterhoeven, Magnus Damm
  Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-amlogic,
	linux-arm-kernel, imx, linux-mediatek, linux-samsung-soc,
	linux-renesas-soc

On 07.01.2026 17:22, Luca Ceresoli wrote:
> of_drm_find_bridge() is deprecated. Move to its replacement
> of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
> is put when done.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> ---
>   drivers/gpu/drm/exynos/exynos_hdmi.c | 4 +++-

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>

>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 01813e11e6c6..bfcf2fa62fe1 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -1779,7 +1779,7 @@ static int hdmi_bridge_init(struct hdmi_context *hdata)
>   		return -EINVAL;
>   	}
>   
> -	hdata->bridge = of_drm_find_bridge(np);
> +	hdata->bridge = of_drm_find_and_get_bridge(np);
>   	of_node_put(np);
>   
>   	if (!hdata->bridge)
> @@ -2096,6 +2096,8 @@ static void hdmi_remove(struct platform_device *pdev)
>   
>   	put_device(&hdata->ddc_adpt->dev);
>   
> +	drm_bridge_put(hdata->bridge);
> +
>   	mutex_destroy(&hdata->mutex);
>   }
>   
>
Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland



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

* Re: [PATCH 5/6] drm/exynos: hdmi: convert to of_drm_find_and_get_bridge()
  2026-01-08  8:14   ` Maxime Ripard
@ 2026-01-08 10:13     ` Luca Ceresoli
  0 siblings, 0 replies; 15+ messages in thread
From: Luca Ceresoli @ 2026-01-08 10:13 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Maarten Lankhorst,
	Thomas Zimmermann, David Airlie, Simona Vetter, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Philipp Zabel, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Chun-Kuang Hu, Matthias Brugger, AngeloGioacchino Del Regno,
	Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar, Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
	Geert Uytterhoeven, Magnus Damm, Hui Pu, Thomas Petazzoni,
	dri-devel, linux-kernel, linux-amlogic, linux-arm-kernel, imx,
	linux-mediatek, linux-samsung-soc, linux-renesas-soc

Hi Maxime,

On Thu Jan 8, 2026 at 9:14 AM CET, Maxime Ripard wrote:
> On Wed, Jan 07, 2026 at 05:22:03PM +0100, Luca Ceresoli wrote:
>> of_drm_find_bridge() is deprecated. Move to its replacement
>> of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
>> is put when done.
>>
>> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>
> Why can't we use next_bridge for this one?

Because this device is not a bridge, so we have no struct drm_bridge.

>> ---
>>  drivers/gpu/drm/exynos/exynos_hdmi.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> index 01813e11e6c6..bfcf2fa62fe1 100644
>> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
>> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> @@ -1779,7 +1779,7 @@ static int hdmi_bridge_init(struct hdmi_context *hdata)
>>  		return -EINVAL;
>>  	}
>>
>> -	hdata->bridge = of_drm_find_bridge(np);
>> +	hdata->bridge = of_drm_find_and_get_bridge(np);
>>  	of_node_put(np);
>>
>>  	if (!hdata->bridge)
>> @@ -2096,6 +2096,8 @@ static void hdmi_remove(struct platform_device *pdev)
>>
>>  	put_device(&hdata->ddc_adpt->dev);
>>
>> +	drm_bridge_put(hdata->bridge);
>> +
>>  	mutex_destroy(&hdata->mutex);
>>  }
>
> Same story than in your part 2 series, it should be dropped in destroy.

hdata->bridge is only used for drm_bridge_attach(), it won't be referenced
after that. So this is safe, unless I'm missing something.

Also as we don't have a struct drm_bridge (as mentioned above) we have no
bridge destroy. We have the encoder destroy, but that will never be called
on bridge hotplug.

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


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

end of thread, other threads:[~2026-01-08 10:14 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-07 16:21 [PATCH 0/6] drm/bridge: convert users of of_drm_find_bridge(), part 3 Luca Ceresoli
2026-01-07 16:21 ` [PATCH 1/6] drm/bridge: dw-hdmi: convert to of_drm_find_and_get_bridge() Luca Ceresoli
2026-01-08  8:10   ` Maxime Ripard
2026-01-07 16:22 ` [PATCH 2/6] drm/meson/dw-hdmi: " Luca Ceresoli
2026-01-08  8:13   ` Maxime Ripard
2026-01-07 16:22 ` [PATCH 3/6] drm/imx/dw-hdmi: " Luca Ceresoli
2026-01-07 16:34   ` Philipp Zabel
2026-01-07 17:03     ` Luca Ceresoli
2026-01-07 16:22 ` [PATCH 4/6] drm/mediatek: mtk_hdmi*: " Luca Ceresoli
2026-01-08  8:13   ` Maxime Ripard
2026-01-07 16:22 ` [PATCH 5/6] drm/exynos: hdmi: " Luca Ceresoli
2026-01-08  8:14   ` Maxime Ripard
2026-01-08 10:13     ` Luca Ceresoli
2026-01-08  9:51   ` Marek Szyprowski
2026-01-07 16:22 ` [PATCH 6/6] drm: rcar-du: lvds: " Luca Ceresoli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).