* [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge()
@ 2025-11-28 16:50 Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 01/26] drm/bridge: add of_drm_get_bridge() Luca Ceresoli
` (25 more replies)
0 siblings, 26 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This series deprecated of_drm_find_bridge(), adds a replacement which
handles bridge refcounting, and converts most of the direct users.
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 most direct users
b. convert other direct users
c. 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
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
Almost all the functions returning a struct drm_bridge pointer have been
modified to drm_bridge_get() the returned bridge, and their users updated
to drm_bridge_put() it. See items 1.E.{1-6} above.
of_drm_find_bridge() could be modified easily in the same way, but it has a
lot of (direct + indirect) callers, and most notably
drm_of_find_panel_or_bridge() which is very hard to adapt without reowrking
the panel_bridge lifetime.
This has been discussed in [1] and Maxime proposed an incremental approach:
> So maybe we can just create drm_of_find_bridge() that takes a reference,
> make of_drm_find_bridge() deprecated in favour of drm_of_find_bridge(),
> add a TODO, and call it a day. People will gradually switch to the new
> API over time.
That proposal is implemented by this series. Most of the direct callers are
also converted: they are all trivial conversions except for one, which is
handled by the last 3 patches.
Follow-up series will:
- convert remaining direct callers of of_drm_find_bridge()
- convert simple cases of drm_of_find_panel_or_bridge()
[1] https://lore.kernel.org/dri-devel/20250319-stylish-lime-mongoose-0a18ad@houat/
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changes in v2:
- All patches: renamed drm_of_find_bridge() -> of_drm_get_bridge()
- Various fixes and improvements to patches 1-6, see individual patches
changelog
- Removed bouncing recipient: Edmund Dea <edmund.j.dea@intel.com>
- Link to v1: https://lore.kernel.org/r/20251119-drm-bridge-alloc-getput-drm_of_find_bridge-v1-0-0db98a7fe474@bootlin.com
---
Luca Ceresoli (26):
drm/bridge: add of_drm_get_bridge()
drm/bridge: deprecate of_drm_find_bridge()
drm/todo: add entry about converting to of_drm_get_bridge()
drm/bridge: make of_drm_find_bridge() a wrapper of of_drm_get_bridge()
drm/arcpgu: convert to of_drm_get_bridge()
drm/bridge: add devm_of_drm_get_bridge
drm/bridge: ite-it66121: use devm_of_drm_get_bridge() to put the next bridge
drm/bridge: imx8qxp-pixel-combiner: use devm_of_drm_get_bridge() to put the next bridge
drm/bridge: simple-bridge: use devm_of_drm_get_bridge() to put the next bridge
drm/bridge: tpd12s015: use devm_of_drm_get_bridge() to put the next bridge
drm/bridge: thc63lvd1024: use devm_of_drm_get_bridge() to put the next bridge
drm/bridge: imx8qxp-pxl2dpi: use devm_of_drm_get_bridge() to put the next and companion bridges
drm/bridge: lt8912b: use devm_of_drm_get_bridge() to put the hdmi bridge
drm/bridge: tfp410: use devm_of_drm_get_bridge() to put the next bridge
drm/bridge: imx8qxp-ldb: use devm_of_drm_get_bridge() to put the companion bridge
drm/rcar-du: lvds: use devm_of_drm_get_bridge() to put the next bridge
drm/meson: encoder_*: use devm_of_drm_get_bridge() to put the next bridge
drm/bridge: sii902x: use devm_of_drm_get_bridge() to put the next bridge
drm/mediatek: use devm_of_drm_get_bridge() to put the next bridge
drm/kmb: dsi: use devm_of_drm_get_bridge() to put the next bridge
drm/imx/ipuv3: use devm_of_drm_get_bridge() to put the next bridge
drm/exynos: hdmi: use devm_of_drm_get_bridge() to put the next bridge
drm/bridge: dw-hdmi: use devm_of_drm_get_bridge() to put the next bridge
drm/bridge: imx8qxp-pixel-link: simplify logic to find next bridge
drm/bridge: imx8qxp-pixel-link: simplify freeing of the remote device_node
drm/bridge: imx8qxp-pixel-link: convert to of_drm_get_bridge()
Documentation/gpu/todo.rst | 16 ++++
drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c | 2 +-
.../gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 2 +-
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c | 37 +++++----
drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c | 4 +-
drivers/gpu/drm/bridge/ite-it66121.c | 2 +-
drivers/gpu/drm/bridge/lontium-lt8912b.c | 2 +-
drivers/gpu/drm/bridge/sii902x.c | 2 +-
drivers/gpu/drm/bridge/simple-bridge.c | 2 +-
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +-
drivers/gpu/drm/bridge/thc63lvd1024.c | 2 +-
drivers/gpu/drm/bridge/ti-tfp410.c | 2 +-
drivers/gpu/drm/bridge/ti-tpd12s015.c | 2 +-
drivers/gpu/drm/drm_bridge.c | 91 ++++++++++++++++++----
drivers/gpu/drm/exynos/exynos_hdmi.c | 2 +-
drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c | 2 +-
drivers/gpu/drm/kmb/kmb_dsi.c | 2 +-
drivers/gpu/drm/mediatek/mtk_hdmi.c | 2 +-
drivers/gpu/drm/meson/meson_encoder_cvbs.c | 2 +-
drivers/gpu/drm/meson/meson_encoder_dsi.c | 2 +-
drivers/gpu/drm/meson/meson_encoder_hdmi.c | 2 +-
drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c | 2 +-
drivers/gpu/drm/tiny/arcpgu.c | 4 +-
include/drm/drm_bridge.h | 10 +++
24 files changed, 143 insertions(+), 55 deletions(-)
---
base-commit: e85e9ccf3f8404007f62dff9a02273fcdeb44206
change-id: 20251117-drm-bridge-alloc-getput-drm_of_find_bridge-74903367448d
Best regards,
--
Luca Ceresoli <luca.ceresoli@bootlin.com>
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH v2 01/26] drm/bridge: add of_drm_get_bridge()
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 02/26] drm/bridge: deprecate of_drm_find_bridge() Luca Ceresoli
` (24 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
of_drm_find_bridge() does not increment the refcount for the returned
bridge, but that is required now. However converting it and all its users
is not realistically doable at once given the large amount of (direct and
indirect) callers and the complexity of some.
Solve this issue by creating a new of_drm_get_bridge() function that is
identical to of_drm_find_bridge() except it takes a reference. Then
of_drm_find_bridge() will be deprecated to be eventually removed.
Suggested-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/dri-devel/20250319-stylish-lime-mongoose-0a18ad@houat/
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changes in v2:
- fix "mutex_unlock() before drm_bridge_get()", and use scoped_guard() to
do it cleaning instead of complicating code
- rename to of_drm_get_bridge()
Note: a simple implementation would just be
{ return drm_bridge_get(of_drm_find_bridge(np)); }
but it would release the mutex before getting the reference, so it is
not safe. Make things simple by duplicating the code. A later patch will
make instead the (to be deprecated) of_drm_find_bridge() become a wrapper
of the new of_drm_get_bridge()
---
drivers/gpu/drm/drm_bridge.c | 25 +++++++++++++++++++++++++
include/drm/drm_bridge.h | 5 +++++
2 files changed, 30 insertions(+)
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 8f355df883d8..367b7a3d8aa3 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -1417,6 +1417,31 @@ void drm_bridge_hpd_notify(struct drm_bridge *bridge,
EXPORT_SYMBOL_GPL(drm_bridge_hpd_notify);
#ifdef CONFIG_OF
+/**
+ * of_drm_get_bridge - find the bridge corresponding to the device node in
+ * the global bridge list
+ * @np: device node
+ *
+ * The refcount of the returned bridge is incremented. Use drm_bridge_put()
+ * when done with it.
+ *
+ * RETURNS:
+ * drm_bridge control struct on success, NULL on failure
+ */
+struct drm_bridge *of_drm_get_bridge(struct device_node *np)
+{
+ struct drm_bridge *bridge;
+
+ scoped_guard(mutex, &bridge_lock) {
+ list_for_each_entry(bridge, &bridge_list, list)
+ if (bridge->of_node == np)
+ return drm_bridge_get(bridge);
+ }
+
+ return NULL;
+}
+EXPORT_SYMBOL(of_drm_get_bridge);
+
/**
* of_drm_find_bridge - find the bridge corresponding to the device node in
* the global bridge list
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 0ff7ab4aa868..0977eab78aac 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -1313,8 +1313,13 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags);
#ifdef CONFIG_OF
+struct drm_bridge *of_drm_get_bridge(struct device_node *np);
struct drm_bridge *of_drm_find_bridge(struct device_node *np);
#else
+static inline struct drm_bridge *of_drm_get_bridge(struct device_node *np)
+{
+ return NULL;
+}
static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np)
{
return NULL;
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 02/26] drm/bridge: deprecate of_drm_find_bridge()
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 01/26] drm/bridge: add of_drm_get_bridge() Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 03/26] drm/todo: add entry about converting to of_drm_get_bridge() Luca Ceresoli
` (23 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
of_drm_find_bridge() does not increment the returned bridge
refcount. of_drm_get_bridge() is to be used as a replacement.
Suggested-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/dri-devel/20250319-stylish-lime-mongoose-0a18ad@houat/
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changes in v2:
- expand comment to mention why this function is dangerous and what users
should do about refcounting
---
drivers/gpu/drm/drm_bridge.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 367b7a3d8aa3..21a84715d221 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -299,7 +299,7 @@ EXPORT_SYMBOL(__devm_drm_bridge_alloc);
* @bridge: bridge control structure
*
* Add the given bridge to the global list of bridges, where they can be
- * found by users via of_drm_find_bridge().
+ * found by users via of_drm_get_bridge().
*
* The bridge to be added must have been allocated by
* devm_drm_bridge_alloc().
@@ -360,7 +360,7 @@ EXPORT_SYMBOL(devm_drm_bridge_add);
* @bridge: bridge control structure
*
* Remove the given bridge from the global list of registered bridges, so
- * it won't be found by users via of_drm_find_bridge(), and add it to the
+ * it won't be found by users via of_drm_get_bridge(), and add it to the
* lingering bridge list, to keep track of it until its allocated memory is
* eventually freed.
*/
@@ -1448,6 +1448,20 @@ EXPORT_SYMBOL(of_drm_get_bridge);
*
* @np: device node
*
+ * This function is deprecated. Convert to of_drm_get_bridge() instead for
+ * proper refcounting.
+ *
+ * The bridge returned by this function is not refcounted. This is
+ * dangerous because the bridge might be deallocated even before the caller
+ * has a chance to use it. To use this function you have to do one of:
+ * - get a reference with drm_bridge_get() as soon as possible to
+ * minimize the race window, and then drm_bridge_put() when no longer
+ * using the pointer
+ * - not call drm_bridge_get() or drm_bridge_put() at all, which used to
+ * be the correct practice before dynamic bridge lifetime was introduced
+ * - again, convert to of_drm_get_bridge(), which is the only safe thing
+ * to do
+ *
* RETURNS:
* drm_bridge control struct on success, NULL on failure
*/
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 03/26] drm/todo: add entry about converting to of_drm_get_bridge()
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 01/26] drm/bridge: add of_drm_get_bridge() Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 02/26] drm/bridge: deprecate of_drm_find_bridge() Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 04/26] drm/bridge: make of_drm_find_bridge() a wrapper of of_drm_get_bridge() Luca Ceresoli
` (22 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
of_drm_find_bridge() is deprecated, but converting some users is very
complex and should be reasonably doable only after the DRM panel bridge
lifetime rework. Add a TODO to track this.
Suggested-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/dri-devel/20250319-stylish-lime-mongoose-0a18ad@houat/
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Documentation/gpu/todo.rst | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index 9013ced318cb..6390994e559f 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -506,6 +506,22 @@ Contact: Maxime Ripard <mripard@kernel.org>,
Level: Intermediate
+Convert users of of_drm_find_bridge() to of_drm_get_bridge()
+------------------------------------------------------------
+
+Taking a struct drm_bridge pointer requires getting a reference and putting
+it after disposing of the pointer. Most functions returning a struct
+drm_bridge pointer already call drm_bridge_get() to increment the refcount
+and their users have been updated to call drm_bridge_put() when
+appropriate. of_drm_find_bridge() does not get a reference and it has been
+deprecated in favor of of_drm_get_bridge() which does, but some users
+still need to be converted.
+
+Contact: Maxime Ripard <mripard@kernel.org>,
+ Luca Ceresoli <luca.ceresoli@bootlin.com>
+
+Level: Intermediate
+
Core refactorings
=================
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 04/26] drm/bridge: make of_drm_find_bridge() a wrapper of of_drm_get_bridge()
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (2 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 03/26] drm/todo: add entry about converting to of_drm_get_bridge() Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 21:50 ` Randy Dunlap
2025-11-28 16:50 ` [PATCH v2 05/26] drm/arcpgu: convert to of_drm_get_bridge() Luca Ceresoli
` (21 subsequent siblings)
25 siblings, 1 reply; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
of_drm_find_bridge() is identical to of_drm_get_bridge() except it does
not increment the refcount. Rewrite it as a wrapper and put the bridge
being returned so the behaviour is still the same.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changed in v2:
- Added comment to document why we put the reference
---
drivers/gpu/drm/drm_bridge.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 21a84715d221..9b7e3f859973 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -1467,19 +1467,17 @@ EXPORT_SYMBOL(of_drm_get_bridge);
*/
struct drm_bridge *of_drm_find_bridge(struct device_node *np)
{
- struct drm_bridge *bridge;
-
- mutex_lock(&bridge_lock);
+ struct drm_bridge *bridge = of_drm_get_bridge(np);
- list_for_each_entry(bridge, &bridge_list, list) {
- if (bridge->of_node == np) {
- mutex_unlock(&bridge_lock);
- return bridge;
- }
- }
+ /**
+ * We need to emulate the original semantics of
+ * of_drm_find_bridge(), which was not getting any bridge
+ * reference. Being now based on of_drm_get_bridge() which gets a
+ * reference, put it before returning.
+ */
+ drm_bridge_put(bridge);
- mutex_unlock(&bridge_lock);
- return NULL;
+ return bridge;
}
EXPORT_SYMBOL(of_drm_find_bridge);
#endif
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 05/26] drm/arcpgu: convert to of_drm_get_bridge()
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (3 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 04/26] drm/bridge: make of_drm_find_bridge() a wrapper of of_drm_get_bridge() Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 06/26] drm/bridge: add devm_of_drm_get_bridge Luca Ceresoli
` (20 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
of_drm_find_bridge() is deprecated. Move to its replacement
of_drm_get_bridge() which gets a bridge reference, and put it when done.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/tiny/arcpgu.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/tiny/arcpgu.c b/drivers/gpu/drm/tiny/arcpgu.c
index 7cf0f0ea1bfe..9d177ed4dff3 100644
--- a/drivers/gpu/drm/tiny/arcpgu.c
+++ b/drivers/gpu/drm/tiny/arcpgu.c
@@ -308,10 +308,8 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu)
return ret;
if (encoder_node) {
- struct drm_bridge *bridge;
-
/* Locate drm bridge from the hdmi encoder DT node */
- bridge = of_drm_find_bridge(encoder_node);
+ struct drm_bridge *bridge __free(drm_bridge_put) = of_drm_get_bridge(encoder_node);
if (!bridge)
return -EPROBE_DEFER;
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 06/26] drm/bridge: add devm_of_drm_get_bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (4 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 05/26] drm/arcpgu: convert to of_drm_get_bridge() Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 07/26] drm/bridge: ite-it66121: use devm_of_drm_get_bridge() to put the next bridge Luca Ceresoli
` (19 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
Several drivers (about 20) follow the same pattern:
1. get a pointer to a bridge (typically the next bridge in the chain) by
calling of_drm_find_bridge()
2. store the returned pointer in the private driver data, keep it until
driver .remove
3. dereference the pointer at attach time and possibly at other times
of_drm_find_bridge() is now deprecated because it does not increment the
refcount and should be replaced with of_drm_get_bridge() +
drm_bridge_put().
However some of those drivers have a complex code flow and adding a
drm_bridge_put() call in all the appropriate locations is error-prone,
leads to ugly and more complex code, and can lead to errors over time with
code flow changes.
To handle all those drivers in a straightforward way, add a devm variant of
of_drm_get_bridge() that adds a devm action to invoke drm_bridge_put()
when the said driver is removed. This allows all those drivers to put the
reference automatically and safely with a one line change:
- priv->next_bridge = of_drm_find_bridge(remote_np);
+ priv->next_bridge = devm_of_drm_get_bridge(dev, remote_np);
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changes in v2:
- fix return value: NULL on error, as documented, not an ERR_PTR
---
drivers/gpu/drm/drm_bridge.c | 28 ++++++++++++++++++++++++++++
include/drm/drm_bridge.h | 5 +++++
2 files changed, 33 insertions(+)
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 9b7e3f859973..59575a84eff6 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -1442,6 +1442,34 @@ struct drm_bridge *of_drm_get_bridge(struct device_node *np)
}
EXPORT_SYMBOL(of_drm_get_bridge);
+/**
+ * devm_of_drm_get_bridge - find the bridge corresponding to the device
+ * node in the global bridge list and add a devm
+ * action to put it
+ *
+ * @dev: device requesting the bridge
+ * @np: device node
+ *
+ * On success the returned bridge refcount is incremented, and a devm
+ * action is added to call drm_bridge_put() when @dev is removed. So the
+ * caller does not have to put the returned bridge explicitly.
+ *
+ * RETURNS:
+ * drm_bridge control struct on success, NULL on failure
+ */
+struct drm_bridge *devm_of_drm_get_bridge(struct device *dev, struct device_node *np)
+{
+ struct drm_bridge *bridge = of_drm_get_bridge(np);
+
+ if (bridge) {
+ if (devm_add_action_or_reset(dev, drm_bridge_put_void, bridge))
+ return NULL;
+ }
+
+ return bridge;
+}
+EXPORT_SYMBOL(devm_of_drm_get_bridge);
+
/**
* of_drm_find_bridge - find the bridge corresponding to the device node in
* the global bridge list
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 0977eab78aac..da69cb252cad 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -1314,12 +1314,17 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
#ifdef CONFIG_OF
struct drm_bridge *of_drm_get_bridge(struct device_node *np);
+struct drm_bridge *devm_of_drm_get_bridge(struct device *dev, struct device_node *np);
struct drm_bridge *of_drm_find_bridge(struct device_node *np);
#else
static inline struct drm_bridge *of_drm_get_bridge(struct device_node *np)
{
return NULL;
}
+static inline struct drm_bridge *devm_of_drm_get_bridge(struct device *dev, struct device_node *np)
+{
+ return NULL;
+}
static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np)
{
return NULL;
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 07/26] drm/bridge: ite-it66121: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (5 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 06/26] drm/bridge: add devm_of_drm_get_bridge Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 08/26] drm/bridge: imx8qxp-pixel-combiner: " Luca Ceresoli
` (18 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/ite-it66121.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
index 0185f61e6e59..b7bcdd24af9e 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -1543,7 +1543,7 @@ static int it66121_probe(struct i2c_client *client)
return -EINVAL;
}
- ctx->next_bridge = of_drm_find_bridge(ep);
+ ctx->next_bridge = devm_of_drm_get_bridge(dev, ep);
of_node_put(ep);
if (!ctx->next_bridge) {
dev_dbg(ctx->dev, "Next bridge not found, deferring probe\n");
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 08/26] drm/bridge: imx8qxp-pixel-combiner: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (6 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 07/26] drm/bridge: ite-it66121: use devm_of_drm_get_bridge() to put the next bridge Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 09/26] drm/bridge: simple-bridge: " Luca Ceresoli
` (17 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
index 8517b1c953d4..ec2122c459e0 100644
--- a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
+++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
@@ -326,7 +326,7 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
goto free_child;
}
- ch->next_bridge = of_drm_find_bridge(remote);
+ ch->next_bridge = devm_of_drm_get_bridge(dev, remote);
if (!ch->next_bridge) {
of_node_put(remote);
ret = -EPROBE_DEFER;
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 09/26] drm/bridge: simple-bridge: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (7 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 08/26] drm/bridge: imx8qxp-pixel-combiner: " Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 10/26] drm/bridge: tpd12s015: " Luca Ceresoli
` (16 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/simple-bridge.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/simple-bridge.c b/drivers/gpu/drm/bridge/simple-bridge.c
index 2cd1847ba776..b00ccf14c6fb 100644
--- a/drivers/gpu/drm/bridge/simple-bridge.c
+++ b/drivers/gpu/drm/bridge/simple-bridge.c
@@ -180,7 +180,7 @@ static int simple_bridge_probe(struct platform_device *pdev)
if (!remote)
return -EINVAL;
- sbridge->next_bridge = of_drm_find_bridge(remote);
+ sbridge->next_bridge = devm_of_drm_get_bridge(&pdev->dev, remote);
of_node_put(remote);
if (!sbridge->next_bridge) {
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 10/26] drm/bridge: tpd12s015: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (8 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 09/26] drm/bridge: simple-bridge: " Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 11/26] drm/bridge: thc63lvd1024: " Luca Ceresoli
` (15 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/ti-tpd12s015.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/ti-tpd12s015.c b/drivers/gpu/drm/bridge/ti-tpd12s015.c
index dcf686c4e73d..539ffacd0715 100644
--- a/drivers/gpu/drm/bridge/ti-tpd12s015.c
+++ b/drivers/gpu/drm/bridge/ti-tpd12s015.c
@@ -138,7 +138,7 @@ static int tpd12s015_probe(struct platform_device *pdev)
if (!node)
return -ENODEV;
- tpd->next_bridge = of_drm_find_bridge(node);
+ tpd->next_bridge = devm_of_drm_get_bridge(&pdev->dev, node);
of_node_put(node);
if (!tpd->next_bridge)
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 11/26] drm/bridge: thc63lvd1024: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (9 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 10/26] drm/bridge: tpd12s015: " Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 12/26] drm/bridge: imx8qxp-pxl2dpi: use devm_of_drm_get_bridge() to put the next and companion bridges Luca Ceresoli
` (14 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/thc63lvd1024.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/thc63lvd1024.c b/drivers/gpu/drm/bridge/thc63lvd1024.c
index 2cb7cd0c0608..a240a68f6405 100644
--- a/drivers/gpu/drm/bridge/thc63lvd1024.c
+++ b/drivers/gpu/drm/bridge/thc63lvd1024.c
@@ -132,7 +132,7 @@ static int thc63_parse_dt(struct thc63_dev *thc63)
return -ENODEV;
}
- thc63->next = of_drm_find_bridge(remote);
+ thc63->next = devm_of_drm_get_bridge(thc63->dev, remote);
of_node_put(remote);
if (!thc63->next)
return -EPROBE_DEFER;
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 12/26] drm/bridge: imx8qxp-pxl2dpi: use devm_of_drm_get_bridge() to put the next and companion bridges
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (10 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 11/26] drm/bridge: thc63lvd1024: " Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 13/26] drm/bridge: lt8912b: use devm_of_drm_get_bridge() to put the hdmi bridge Luca Ceresoli
` (13 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c
index 111310acab2c..fc8c83add378 100644
--- a/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c
+++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c
@@ -279,7 +279,7 @@ imx8qxp_pxl2dpi_find_next_bridge(struct imx8qxp_pxl2dpi *p2d)
goto out;
}
- next_bridge = of_drm_find_bridge(remote);
+ next_bridge = devm_of_drm_get_bridge(p2d->dev, remote);
if (!next_bridge) {
next_bridge = ERR_PTR(-EPROBE_DEFER);
goto out;
@@ -347,7 +347,7 @@ static int imx8qxp_pxl2dpi_parse_dt_companion(struct imx8qxp_pxl2dpi *p2d)
goto out;
}
- p2d->companion = of_drm_find_bridge(companion);
+ p2d->companion = devm_of_drm_get_bridge(dev, companion);
if (!p2d->companion) {
ret = -EPROBE_DEFER;
DRM_DEV_DEBUG_DRIVER(p2d->dev,
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 13/26] drm/bridge: lt8912b: use devm_of_drm_get_bridge() to put the hdmi bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (11 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 12/26] drm/bridge: imx8qxp-pxl2dpi: use devm_of_drm_get_bridge() to put the next and companion bridges Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 14/26] drm/bridge: tfp410: use devm_of_drm_get_bridge() to put the next bridge Luca Ceresoli
` (12 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/lontium-lt8912b.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c
index 342374cb8fc6..e83ea0e727d8 100644
--- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -723,7 +723,7 @@ static int lt8912_parse_dt(struct lt8912 *lt)
goto err_free_host_node;
}
- lt->hdmi_port = of_drm_find_bridge(port_node);
+ lt->hdmi_port = devm_of_drm_get_bridge(lt->dev, port_node);
if (!lt->hdmi_port) {
ret = -EPROBE_DEFER;
dev_err_probe(lt->dev, ret, "%s: Failed to get hdmi port\n", __func__);
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 14/26] drm/bridge: tfp410: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (12 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 13/26] drm/bridge: lt8912b: use devm_of_drm_get_bridge() to put the hdmi bridge Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 15/26] drm/bridge: imx8qxp-ldb: use devm_of_drm_get_bridge() to put the companion bridge Luca Ceresoli
` (11 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/ti-tfp410.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
index b80ee089f880..5012063e1208 100644
--- a/drivers/gpu/drm/bridge/ti-tfp410.c
+++ b/drivers/gpu/drm/bridge/ti-tfp410.c
@@ -362,7 +362,7 @@ static int tfp410_init(struct device *dev, bool i2c)
if (!node)
return -ENODEV;
- dvi->next_bridge = of_drm_find_bridge(node);
+ dvi->next_bridge = devm_of_drm_get_bridge(dev, node);
of_node_put(node);
if (!dvi->next_bridge)
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 15/26] drm/bridge: imx8qxp-ldb: use devm_of_drm_get_bridge() to put the companion bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (13 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 14/26] drm/bridge: tfp410: use devm_of_drm_get_bridge() to put the next bridge Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 16/26] drm/rcar-du: lvds: use devm_of_drm_get_bridge() to put the next bridge Luca Ceresoli
` (10 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
index 122502968927..4a3741c9f319 100644
--- a/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
+++ b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
@@ -552,7 +552,7 @@ static int imx8qxp_ldb_parse_dt_companion(struct imx8qxp_ldb *imx8qxp_ldb)
goto out;
}
- imx8qxp_ldb->companion = of_drm_find_bridge(companion_port);
+ imx8qxp_ldb->companion = devm_of_drm_get_bridge(dev, companion_port);
if (!imx8qxp_ldb->companion) {
ret = -EPROBE_DEFER;
DRM_DEV_DEBUG_DRIVER(dev,
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 16/26] drm/rcar-du: lvds: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (14 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 15/26] drm/bridge: imx8qxp-ldb: use devm_of_drm_get_bridge() to put the companion bridge Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 17/26] drm/meson: encoder_*: " Luca Ceresoli
` (9 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c | 2 +-
1 file changed, 1 insertion(+), 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..2dd95fd52e71 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c
@@ -740,7 +740,7 @@ static int rcar_lvds_parse_dt_companion(struct rcar_lvds *lvds)
goto done;
}
- lvds->companion = of_drm_find_bridge(companion);
+ lvds->companion = devm_of_drm_get_bridge(dev, companion);
if (!lvds->companion) {
ret = -EPROBE_DEFER;
goto done;
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 17/26] drm/meson: encoder_*: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (15 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 16/26] drm/rcar-du: lvds: use devm_of_drm_get_bridge() to put the next bridge Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-30 13:09 ` Martin Blumenstingl
2025-11-28 16:50 ` [PATCH v2 18/26] drm/bridge: sii902x: " Luca Ceresoli
` (8 subsequent siblings)
25 siblings, 1 reply; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/meson/meson_encoder_cvbs.c | 2 +-
drivers/gpu/drm/meson/meson_encoder_dsi.c | 2 +-
drivers/gpu/drm/meson/meson_encoder_hdmi.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/meson/meson_encoder_cvbs.c b/drivers/gpu/drm/meson/meson_encoder_cvbs.c
index dc374bfc5951..bf8588a5f6dd 100644
--- a/drivers/gpu/drm/meson/meson_encoder_cvbs.c
+++ b/drivers/gpu/drm/meson/meson_encoder_cvbs.c
@@ -241,7 +241,7 @@ int meson_encoder_cvbs_probe(struct meson_drm *priv)
return 0;
}
- meson_encoder_cvbs->next_bridge = of_drm_find_bridge(remote);
+ meson_encoder_cvbs->next_bridge = devm_of_drm_get_bridge(priv->dev, remote);
of_node_put(remote);
if (!meson_encoder_cvbs->next_bridge)
return dev_err_probe(priv->dev, -EPROBE_DEFER,
diff --git a/drivers/gpu/drm/meson/meson_encoder_dsi.c b/drivers/gpu/drm/meson/meson_encoder_dsi.c
index 6c6624f9ba24..6304f51a7e7e 100644
--- a/drivers/gpu/drm/meson/meson_encoder_dsi.c
+++ b/drivers/gpu/drm/meson/meson_encoder_dsi.c
@@ -120,7 +120,7 @@ int meson_encoder_dsi_probe(struct meson_drm *priv)
return 0;
}
- meson_encoder_dsi->next_bridge = of_drm_find_bridge(remote);
+ meson_encoder_dsi->next_bridge = devm_of_drm_get_bridge(priv->dev, remote);
if (!meson_encoder_dsi->next_bridge)
return dev_err_probe(priv->dev, -EPROBE_DEFER,
"Failed to find DSI transceiver bridge\n");
diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
index 8205ee56a691..e2a871347136 100644
--- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
@@ -390,7 +390,7 @@ int meson_encoder_hdmi_probe(struct meson_drm *priv)
return 0;
}
- meson_encoder_hdmi->next_bridge = of_drm_find_bridge(remote);
+ meson_encoder_hdmi->next_bridge = devm_of_drm_get_bridge(priv->dev, remote);
if (!meson_encoder_hdmi->next_bridge) {
ret = dev_err_probe(priv->dev, -EPROBE_DEFER,
"Failed to find HDMI transceiver bridge\n");
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 18/26] drm/bridge: sii902x: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (16 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 17/26] drm/meson: encoder_*: " Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 19/26] drm/mediatek: " Luca Ceresoli
` (7 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/sii902x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
index d537b1d036fb..1bf58e9eb452 100644
--- a/drivers/gpu/drm/bridge/sii902x.c
+++ b/drivers/gpu/drm/bridge/sii902x.c
@@ -1208,7 +1208,7 @@ static int sii902x_probe(struct i2c_client *client)
return -ENODEV;
}
- sii902x->next_bridge = of_drm_find_bridge(remote);
+ sii902x->next_bridge = devm_of_drm_get_bridge(dev, remote);
of_node_put(remote);
if (!sii902x->next_bridge)
return dev_err_probe(dev, -EPROBE_DEFER,
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 19/26] drm/mediatek: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (17 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 18/26] drm/bridge: sii902x: " Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 20/26] drm/kmb: dsi: " Luca Ceresoli
` (6 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/mediatek/mtk_hdmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index b766dd5e6c8d..6246d356bc3b 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -1405,7 +1405,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
return -EINVAL;
if (!of_device_is_compatible(remote, "hdmi-connector")) {
- hdmi->next_bridge = of_drm_find_bridge(remote);
+ hdmi->next_bridge = devm_of_drm_get_bridge(dev, remote);
if (!hdmi->next_bridge) {
dev_err(dev, "Waiting for external bridge\n");
of_node_put(remote);
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 20/26] drm/kmb: dsi: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (18 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 19/26] drm/mediatek: " Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 21/26] drm/imx/ipuv3: " Luca Ceresoli
` (5 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Note: this driver stores the bridge pointer in the adv_bridge global
variable, which could hold a value from a previous probe. However the code
flow always sets the adv_bridge value in the probe function before it is
read, so the change is safe.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/kmb/kmb_dsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/kmb/kmb_dsi.c b/drivers/gpu/drm/kmb/kmb_dsi.c
index faf38ca9e44c..0a69e91aa136 100644
--- a/drivers/gpu/drm/kmb/kmb_dsi.c
+++ b/drivers/gpu/drm/kmb/kmb_dsi.c
@@ -251,7 +251,7 @@ int kmb_dsi_host_bridge_init(struct device *dev)
return -EINVAL;
}
/* Locate drm bridge from the hdmi encoder DT node */
- adv_bridge = of_drm_find_bridge(encoder_node);
+ adv_bridge = devm_of_drm_get_bridge(dev, encoder_node);
of_node_put(dsi_out);
of_node_put(encoder_node);
if (!adv_bridge) {
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 21/26] drm/imx/ipuv3: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (19 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 20/26] drm/kmb: dsi: " Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 22/26] drm/exynos: hdmi: " Luca Ceresoli
` (4 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/imx/ipuv3/dw_hdmi-imx.c | 2 +-
1 file changed, 1 insertion(+), 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..4479f74f0491 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 = devm_of_drm_get_bridge(&pdev->dev, np);
if (!hdmi->bridge) {
dev_err(hdmi->dev, "Unable to find bridge\n");
dw_hdmi_remove(hdmi->hdmi);
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 22/26] drm/exynos: hdmi: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (20 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 21/26] drm/imx/ipuv3: " Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 23/26] drm/bridge: dw-hdmi: " Luca Ceresoli
` (3 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/exynos/exynos_hdmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 01813e11e6c6..46c2263b3207 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 = devm_of_drm_get_bridge(dev, np);
of_node_put(np);
if (!hdata->bridge)
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 23/26] drm/bridge: dw-hdmi: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (21 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 22/26] drm/exynos: hdmi: " Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 24/26] drm/bridge: imx8qxp-pixel-link: simplify logic to find " Luca Ceresoli
` (2 subsequent siblings)
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
function and stores it until driver removal. of_drm_find_bridge() is
deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
reference on remove or on probe failure.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 3b77e73ac0ea..f5abb2b7c926 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -3318,7 +3318,7 @@ static int dw_hdmi_parse_dt(struct dw_hdmi *hdmi)
if (!remote)
return -ENODEV;
- hdmi->next_bridge = of_drm_find_bridge(remote);
+ hdmi->next_bridge = devm_of_drm_get_bridge(hdmi->dev, remote);
of_node_put(remote);
if (!hdmi->next_bridge)
return -EPROBE_DEFER;
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 24/26] drm/bridge: imx8qxp-pixel-link: simplify logic to find next bridge
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (22 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 23/26] drm/bridge: dw-hdmi: " Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 25/26] drm/bridge: imx8qxp-pixel-link: simplify freeing of the remote device_node Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 26/26] drm/bridge: imx8qxp-pixel-link: convert to of_drm_get_bridge() Luca Ceresoli
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
imx8qxp_pixel_link_find_next_bridge() uses a sophisticated logic to find
the preferred next bridge, using an array with two supporting index
variables. This is more sophisticated than required because we only ever
need a pointer to the "current" bridge and to the "best so far" bridge.
Additionally this logic is going to make the addition of proper refcounting
quite complex.
Rewrite the logic using two drm_bridge pointers, which is by itself
slightly simpler and is a preparation step for introducing bridge
refcounting in a later commit.
Also reword a comment to make it clearer.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Liu Ying <victor.liu@nxp.com>
---
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c
index e5943506981d..53016f0d53a0 100644
--- a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c
+++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c
@@ -261,12 +261,10 @@ imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
{
struct device_node *np = pl->dev->of_node;
struct device_node *port, *remote;
- struct drm_bridge *next_bridge[PL_MAX_NEXT_BRIDGES];
+ struct drm_bridge *selected_bridge = NULL;
u32 port_id;
bool found_port = false;
- int reg, ep_cnt = 0;
- /* select the first next bridge by default */
- int bridge_sel = 0;
+ int reg;
for (port_id = 1; port_id <= PL_MAX_MST_ADDR + 1; port_id++) {
port = of_graph_get_port_by_id(np, port_id);
@@ -300,24 +298,25 @@ imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
continue;
}
- next_bridge[ep_cnt] = of_drm_find_bridge(remote);
- if (!next_bridge[ep_cnt]) {
+ struct drm_bridge *next_bridge = of_drm_find_bridge(remote);
+ if (!next_bridge) {
of_node_put(remote);
return ERR_PTR(-EPROBE_DEFER);
}
- /* specially select the next bridge with companion PXL2DPI */
- if (of_property_present(remote, "fsl,companion-pxl2dpi"))
- bridge_sel = ep_cnt;
-
- ep_cnt++;
+ /*
+ * Select the next bridge with companion PXL2DPI if
+ * present, otherwise default to the first bridge
+ */
+ if (!selected_bridge || of_property_present(remote, "fsl,companion-pxl2dpi"))
+ selected_bridge = next_bridge;
of_node_put(remote);
}
pl->mst_addr = port_id - 1;
- return next_bridge[bridge_sel];
+ return selected_bridge;
}
static int imx8qxp_pixel_link_bridge_probe(struct platform_device *pdev)
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 25/26] drm/bridge: imx8qxp-pixel-link: simplify freeing of the remote device_node
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (23 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 24/26] drm/bridge: imx8qxp-pixel-link: simplify logic to find " Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 26/26] drm/bridge: imx8qxp-pixel-link: convert to of_drm_get_bridge() Luca Ceresoli
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
The main loop in imx8qxp_pixel_link_find_next_bridge() requires calling
of_node_put() in multiple places, complicating code flow. Simplify it by
using a cleanup action and making the 'remote' variable scope local to the
loop.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Liu Ying <victor.liu@nxp.com>
---
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c
index 53016f0d53a0..2ecc3c1051e5 100644
--- a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c
+++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c
@@ -260,7 +260,7 @@ static struct drm_bridge *
imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
{
struct device_node *np = pl->dev->of_node;
- struct device_node *port, *remote;
+ struct device_node *port;
struct drm_bridge *selected_bridge = NULL;
u32 port_id;
bool found_port = false;
@@ -286,7 +286,8 @@ imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
}
for (reg = 0; reg < PL_MAX_NEXT_BRIDGES; reg++) {
- remote = of_graph_get_remote_node(np, port_id, reg);
+ struct device_node *remote __free(device_node) =
+ of_graph_get_remote_node(np, port_id, reg);
if (!remote)
continue;
@@ -294,15 +295,12 @@ imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
DRM_DEV_DEBUG(pl->dev,
"port%u endpoint%u remote parent is not available\n",
port_id, reg);
- of_node_put(remote);
continue;
}
struct drm_bridge *next_bridge = of_drm_find_bridge(remote);
- if (!next_bridge) {
- of_node_put(remote);
+ if (!next_bridge)
return ERR_PTR(-EPROBE_DEFER);
- }
/*
* Select the next bridge with companion PXL2DPI if
@@ -310,8 +308,6 @@ imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
*/
if (!selected_bridge || of_property_present(remote, "fsl,companion-pxl2dpi"))
selected_bridge = next_bridge;
-
- of_node_put(remote);
}
pl->mst_addr = port_id - 1;
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH v2 26/26] drm/bridge: imx8qxp-pixel-link: convert to of_drm_get_bridge()
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
` (24 preceding siblings ...)
2025-11-28 16:50 ` [PATCH v2 25/26] drm/bridge: imx8qxp-pixel-link: simplify freeing of the remote device_node Luca Ceresoli
@ 2025-11-28 16:50 ` Luca Ceresoli
25 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2025-11-28 16:50 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, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc, Luca Ceresoli
of_drm_find_bridge() is deprecated. Move to its replacement
of_drm_get_bridge() which gets a bridge reference, and put it when done.
This needs to be handled in various steps:
* the bridge returned of_drm_get_bridge() is stored in next_bridge whose
scope is the for loop, so a cleanup action is enough
* the value of next_bridge is copied into selected_bridge, potentially
more than once, so a cleanup action at function scope is useful here too
* however on successful return selected_bridge must be returned and
ultimately stored, so it should not be put in that case: use
return_ptr() to defuse the cleanup action on successful return
* finally, put the bridge reference on device remove
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Cc: Liu Ying <victor.liu@nxp.com>
---
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c
index 2ecc3c1051e5..4f2f730142ea 100644
--- a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c
+++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c
@@ -256,12 +256,13 @@ static int imx8qxp_pixel_link_disable_all_controls(struct imx8qxp_pixel_link *pl
return imx8qxp_pixel_link_disable_sync(pl);
}
+/* The returned bridge has its refcount incremented */
static struct drm_bridge *
imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
{
struct device_node *np = pl->dev->of_node;
struct device_node *port;
- struct drm_bridge *selected_bridge = NULL;
+ struct drm_bridge *selected_bridge __free(drm_bridge_put) = NULL;
u32 port_id;
bool found_port = false;
int reg;
@@ -298,7 +299,7 @@ imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
continue;
}
- struct drm_bridge *next_bridge = of_drm_find_bridge(remote);
+ struct drm_bridge *next_bridge __free(drm_bridge_put) = of_drm_get_bridge(remote);
if (!next_bridge)
return ERR_PTR(-EPROBE_DEFER);
@@ -306,13 +307,15 @@ imx8qxp_pixel_link_find_next_bridge(struct imx8qxp_pixel_link *pl)
* Select the next bridge with companion PXL2DPI if
* present, otherwise default to the first bridge
*/
- if (!selected_bridge || of_property_present(remote, "fsl,companion-pxl2dpi"))
- selected_bridge = next_bridge;
+ if (!selected_bridge || of_property_present(remote, "fsl,companion-pxl2dpi")) {
+ drm_bridge_put(selected_bridge);
+ selected_bridge = drm_bridge_get(next_bridge);
+ }
}
pl->mst_addr = port_id - 1;
- return selected_bridge;
+ return_ptr(selected_bridge);
}
static int imx8qxp_pixel_link_bridge_probe(struct platform_device *pdev)
@@ -392,6 +395,7 @@ static void imx8qxp_pixel_link_bridge_remove(struct platform_device *pdev)
struct imx8qxp_pixel_link *pl = platform_get_drvdata(pdev);
drm_bridge_remove(&pl->bridge);
+ drm_bridge_put(pl->next_bridge);
}
static const struct of_device_id imx8qxp_pixel_link_dt_ids[] = {
--
2.51.1
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH v2 04/26] drm/bridge: make of_drm_find_bridge() a wrapper of of_drm_get_bridge()
2025-11-28 16:50 ` [PATCH v2 04/26] drm/bridge: make of_drm_find_bridge() a wrapper of of_drm_get_bridge() Luca Ceresoli
@ 2025-11-28 21:50 ` Randy Dunlap
0 siblings, 0 replies; 29+ messages in thread
From: Randy Dunlap @ 2025-11-28 21:50 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, Jonathan Corbet, Alexey Brodkin, Phong LE,
Liu Ying, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Adrien Grassein, Laurent Pinchart, Tomi Valkeinen,
Kieran Bingham, Geert Uytterhoeven, Magnus Damm, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Chun-Kuang Hu, Philipp Zabel,
Matthias Brugger, AngeloGioacchino Del Regno, Anitha Chrisanthus,
Inki Dae, Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski,
Alim Akhtar
Cc: Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc
On 11/28/25 8:50 AM, Luca Ceresoli wrote:
> of_drm_find_bridge() is identical to of_drm_get_bridge() except it does
> not increment the refcount. Rewrite it as a wrapper and put the bridge
> being returned so the behaviour is still the same.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>
> ---
>
> Changed in v2:
> - Added comment to document why we put the reference
> ---
> drivers/gpu/drm/drm_bridge.c | 20 +++++++++-----------
> 1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index 21a84715d221..9b7e3f859973 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -1467,19 +1467,17 @@ EXPORT_SYMBOL(of_drm_get_bridge);
> */
> struct drm_bridge *of_drm_find_bridge(struct device_node *np)
> {
> - struct drm_bridge *bridge;
> -
> - mutex_lock(&bridge_lock);
> + struct drm_bridge *bridge = of_drm_get_bridge(np);
>
> - list_for_each_entry(bridge, &bridge_list, list) {
> - if (bridge->of_node == np) {
> - mutex_unlock(&bridge_lock);
> - return bridge;
> - }
> - }
> + /**
This isn't a kernel-doc comment, so please don't use "/**" here.
Just use "/*".
> + * We need to emulate the original semantics of
> + * of_drm_find_bridge(), which was not getting any bridge
> + * reference. Being now based on of_drm_get_bridge() which gets a
> + * reference, put it before returning.
> + */
> + drm_bridge_put(bridge);
>
> - mutex_unlock(&bridge_lock);
> - return NULL;
> + return bridge;
> }
> EXPORT_SYMBOL(of_drm_find_bridge);
> #endif
>
--
~Randy
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH v2 17/26] drm/meson: encoder_*: use devm_of_drm_get_bridge() to put the next bridge
2025-11-28 16:50 ` [PATCH v2 17/26] drm/meson: encoder_*: " Luca Ceresoli
@ 2025-11-30 13:09 ` Martin Blumenstingl
0 siblings, 0 replies; 29+ messages in thread
From: Martin Blumenstingl @ 2025-11-30 13:09 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Jonathan Corbet,
Alexey Brodkin, Phong LE, Liu Ying, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Adrien Grassein,
Laurent Pinchart, Tomi Valkeinen, Kieran Bingham,
Geert Uytterhoeven, Magnus Damm, Kevin Hilman, Jerome Brunet,
Chun-Kuang Hu, Philipp Zabel, Matthias Brugger,
AngeloGioacchino Del Regno, Anitha Chrisanthus, Inki Dae,
Seung-Woo Kim, Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar,
Hui Pu, Thomas Petazzoni, Louis Chauvet, dri-devel, linux-kernel,
linux-doc, imx, linux-arm-kernel, linux-renesas-soc,
linux-amlogic, linux-mediatek, linux-samsung-soc
Hi Luca,
On Fri, Nov 28, 2025 at 5:54 PM Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:
>
> This driver obtains a bridge pointer from of_drm_find_bridge() in the probe
> function and stores it until driver removal. of_drm_find_bridge() is
> deprecated. Move to devm_of_drm_get_bridge() which puts the bridge
> reference on remove or on probe failure.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> ---
> drivers/gpu/drm/meson/meson_encoder_cvbs.c | 2 +-
> drivers/gpu/drm/meson/meson_encoder_dsi.c | 2 +-
> drivers/gpu/drm/meson/meson_encoder_hdmi.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/meson/meson_encoder_cvbs.c b/drivers/gpu/drm/meson/meson_encoder_cvbs.c
> index dc374bfc5951..bf8588a5f6dd 100644
> --- a/drivers/gpu/drm/meson/meson_encoder_cvbs.c
> +++ b/drivers/gpu/drm/meson/meson_encoder_cvbs.c
> @@ -241,7 +241,7 @@ int meson_encoder_cvbs_probe(struct meson_drm *priv)
> return 0;
> }
>
> - meson_encoder_cvbs->next_bridge = of_drm_find_bridge(remote);
> + meson_encoder_cvbs->next_bridge = devm_of_drm_get_bridge(priv->dev, remote);
> of_node_put(remote);
> if (!meson_encoder_cvbs->next_bridge)
> return dev_err_probe(priv->dev, -EPROBE_DEFER,
Would you be happy with me sending a patch that replaces the whole
logic in two meson_encoder_{cvbs,dsi,hdmi}.c with
devm_drm_of_get_bridge()?
I see two benefits:
- simpler code
- a patch less in your series (less maintenance burden for you)
What I'm not sure about is how this series interacts with
devm_drm_of_get_bridge() which is why I'm asking before cooking a
patch.
Best regards,
Martin
^ permalink raw reply [flat|nested] 29+ messages in thread
end of thread, other threads:[~2025-11-30 13:09 UTC | newest]
Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-28 16:50 [PATCH v2 00/26] drm/bridge: add drm_of_find_bridge(), deprecate of_drm_find_bridge() Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 01/26] drm/bridge: add of_drm_get_bridge() Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 02/26] drm/bridge: deprecate of_drm_find_bridge() Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 03/26] drm/todo: add entry about converting to of_drm_get_bridge() Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 04/26] drm/bridge: make of_drm_find_bridge() a wrapper of of_drm_get_bridge() Luca Ceresoli
2025-11-28 21:50 ` Randy Dunlap
2025-11-28 16:50 ` [PATCH v2 05/26] drm/arcpgu: convert to of_drm_get_bridge() Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 06/26] drm/bridge: add devm_of_drm_get_bridge Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 07/26] drm/bridge: ite-it66121: use devm_of_drm_get_bridge() to put the next bridge Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 08/26] drm/bridge: imx8qxp-pixel-combiner: " Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 09/26] drm/bridge: simple-bridge: " Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 10/26] drm/bridge: tpd12s015: " Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 11/26] drm/bridge: thc63lvd1024: " Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 12/26] drm/bridge: imx8qxp-pxl2dpi: use devm_of_drm_get_bridge() to put the next and companion bridges Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 13/26] drm/bridge: lt8912b: use devm_of_drm_get_bridge() to put the hdmi bridge Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 14/26] drm/bridge: tfp410: use devm_of_drm_get_bridge() to put the next bridge Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 15/26] drm/bridge: imx8qxp-ldb: use devm_of_drm_get_bridge() to put the companion bridge Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 16/26] drm/rcar-du: lvds: use devm_of_drm_get_bridge() to put the next bridge Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 17/26] drm/meson: encoder_*: " Luca Ceresoli
2025-11-30 13:09 ` Martin Blumenstingl
2025-11-28 16:50 ` [PATCH v2 18/26] drm/bridge: sii902x: " Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 19/26] drm/mediatek: " Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 20/26] drm/kmb: dsi: " Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 21/26] drm/imx/ipuv3: " Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 22/26] drm/exynos: hdmi: " Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 23/26] drm/bridge: dw-hdmi: " Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 24/26] drm/bridge: imx8qxp-pixel-link: simplify logic to find " Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 25/26] drm/bridge: imx8qxp-pixel-link: simplify freeing of the remote device_node Luca Ceresoli
2025-11-28 16:50 ` [PATCH v2 26/26] drm/bridge: imx8qxp-pixel-link: convert to of_drm_get_bridge() 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).