public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] drm/bridge: convert users of of_drm_find_bridge(), part 2
@ 2026-01-07 13:12 ` Luca Ceresoli
  2026-01-07 13:12   ` [PATCH 01/12] drm: of: drm_of_panel_bridge_remove(): fix device_node leak Luca Ceresoli
  2026-01-07 23:48   ` [PATCH 00/12] drm/bridge: convert users of of_drm_find_bridge(), part 2 Marek Szyprowski
  0 siblings, 2 replies; 4+ messages in thread
From: Luca Ceresoli @ 2026-01-07 13:12 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Philippe Cornu, benjamin.gaignard, Andrzej Hajda,
	Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec, Adrien Grassein, Liu Ying, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Inki Dae,
	Jagan Teki, Marek Szyprowski
  Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, imx,
	linux-arm-kernel, Luca Ceresoli, stable

This series converts all DRM bridge drivers (*) from the now deprecated
of_drm_find_bridge() to its replacement of_drm_find_and_get_bridge() which
allows correct bridge refcounting. 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. Parts 3 and 4 are converting non-bridge drivers (mostly
encoders).

(*) One bridge driver (synopsys/dw-hdmi) is converted in another series,
    together with its (non-bridge) users. Additionally this series converts
    drm_of_panel_bridge_remove() which is a special case, and has a bugfix
    for it too.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Luca Ceresoli (12):
      drm: of: drm_of_panel_bridge_remove(): fix device_node leak
      drm: of: drm_of_panel_bridge_remove(): convert to of_drm_find_and_get_bridge()
      drm/bridge: sii902x: convert to of_drm_find_and_get_bridge()
      drm/bridge: thc63lvd1024: convert to of_drm_find_and_get_bridge()
      drm/bridge: tfp410: convert to of_drm_find_and_get_bridge()
      drm/bridge: tpd12s015: convert to of_drm_find_and_get_bridge()
      drm/bridge: lt8912b: convert to of_drm_find_and_get_bridge()
      drm/bridge: imx8mp-hdmi-pvi: convert to of_drm_find_and_get_bridge()
      drm/bridge: imx8qxp-ldb: convert to of_drm_find_and_get_bridge()
      drm/bridge: samsung-dsim: samsung_dsim_host_attach: use a temporary variable for the next bridge
      drm/bridge: samsung-dsim: samsung_dsim_host_attach: don't use the bridge pointer as an error indicator
      drm/bridge: samsung-dsim: samsung_dsim_host_attach: convert to of_drm_find_and_get_bridge()

 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c | 15 +++++++-------
 drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c     |  3 ++-
 drivers/gpu/drm/bridge/lontium-lt8912b.c     | 31 ++++++++++++++--------------
 drivers/gpu/drm/bridge/samsung-dsim.c        | 28 ++++++++++++++++---------
 drivers/gpu/drm/bridge/sii902x.c             |  7 +++----
 drivers/gpu/drm/bridge/thc63lvd1024.c        |  7 +++----
 drivers/gpu/drm/bridge/ti-tfp410.c           | 27 ++++++++++++------------
 drivers/gpu/drm/bridge/ti-tpd12s015.c        |  8 +++----
 include/drm/bridge/samsung-dsim.h            |  1 -
 include/drm/drm_of.h                         |  6 +++++-
 10 files changed, 69 insertions(+), 64 deletions(-)
---
base-commit: 2bcba510a612cea32b8a536eedeabd7fcb413cd0
change-id: 20251223-drm-bridge-alloc-getput-drm_of_find_bridge-2-12c6bbcb6896

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


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

* [PATCH 01/12] drm: of: drm_of_panel_bridge_remove(): fix device_node leak
  2026-01-07 13:12 ` [PATCH 00/12] drm/bridge: convert users of of_drm_find_bridge(), part 2 Luca Ceresoli
@ 2026-01-07 13:12   ` Luca Ceresoli
  2026-01-07 13:33     ` Maxime Ripard
  2026-01-07 23:48   ` [PATCH 00/12] drm/bridge: convert users of of_drm_find_bridge(), part 2 Marek Szyprowski
  1 sibling, 1 reply; 4+ messages in thread
From: Luca Ceresoli @ 2026-01-07 13:12 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Philippe Cornu, benjamin.gaignard, Andrzej Hajda,
	Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec, Adrien Grassein, Liu Ying, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Inki Dae,
	Jagan Teki, Marek Szyprowski
  Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, imx,
	linux-arm-kernel, Luca Ceresoli, stable

drm_of_panel_bridge_remove() uses of_graph_get_remote_node() to get a
device_node but does not put the node reference.

Fixes: c70087e8f16f ("drm/drm_of: add drm_of_panel_bridge_remove function")
Cc: stable@vger.kernel.org # v4.15
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 include/drm/drm_of.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
index 7f0256dae3f1..f3e55ea2174c 100644
--- a/include/drm/drm_of.h
+++ b/include/drm/drm_of.h
@@ -5,6 +5,7 @@
 #include <linux/err.h>
 #include <linux/of_graph.h>
 #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE)
+#include <linux/of.h>
 #include <drm/drm_bridge.h>
 #endif
 
@@ -173,6 +174,8 @@ static inline int drm_of_panel_bridge_remove(const struct device_node *np,
 	bridge = of_drm_find_bridge(remote);
 	drm_panel_bridge_remove(bridge);
 
+	of_node_put(remote);
+
 	return 0;
 #else
 	return -EINVAL;

-- 
2.52.0


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

* Re: [PATCH 01/12] drm: of: drm_of_panel_bridge_remove(): fix device_node leak
  2026-01-07 13:12   ` [PATCH 01/12] drm: of: drm_of_panel_bridge_remove(): fix device_node leak Luca Ceresoli
@ 2026-01-07 13:33     ` Maxime Ripard
  0 siblings, 0 replies; 4+ messages in thread
From: Maxime Ripard @ 2026-01-07 13:33 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: benjamin.gaignard, dri-devel, imx, linux-arm-kernel, linux-kernel,
	stable, Adrien Grassein, Andrzej Hajda, David Airlie,
	Fabio Estevam, Hui Pu, Inki Dae, Jagan Teki, Jernej Skrabec,
	Jonas Karlman, Laurent Pinchart, Liu Ying, Maarten Lankhorst,
	Marek Szyprowski, Maxime Ripard, Neil Armstrong,
	Pengutronix Kernel Team, Philippe Cornu, Robert Foss,
	Sascha Hauer, Shawn Guo, Simona Vetter, Thomas Petazzoni,
	Thomas Zimmermann

On Wed, 7 Jan 2026 14:12:52 +0100, Luca Ceresoli wrote:
> drm_of_panel_bridge_remove() uses of_graph_get_remote_node() to get a
> device_node but does not put the node reference.
> 
> Fixes: c70087e8f16f ("drm/drm_of: add drm_of_panel_bridge_remove function")
> Cc: stable@vger.kernel.org # v4.15
> 
> [ ... ]

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

Thanks!
Maxime

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

* Re: [PATCH 00/12] drm/bridge: convert users of of_drm_find_bridge(), part 2
  2026-01-07 13:12 ` [PATCH 00/12] drm/bridge: convert users of of_drm_find_bridge(), part 2 Luca Ceresoli
  2026-01-07 13:12   ` [PATCH 01/12] drm: of: drm_of_panel_bridge_remove(): fix device_node leak Luca Ceresoli
@ 2026-01-07 23:48   ` Marek Szyprowski
  1 sibling, 0 replies; 4+ messages in thread
From: Marek Szyprowski @ 2026-01-07 23:48 UTC (permalink / raw)
  To: Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Philippe Cornu,
	benjamin.gaignard, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Adrien Grassein,
	Liu Ying, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Inki Dae, Jagan Teki
  Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, imx,
	linux-arm-kernel, stable

On 07.01.2026 14:12, Luca Ceresoli wrote:
> This series converts all DRM bridge drivers (*) from the now deprecated
> of_drm_find_bridge() to its replacement of_drm_find_and_get_bridge() which
> allows correct bridge refcounting. 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].

This patchset breaks Exynos DSI (Samsung-DSIM) driver operation on all 
my test boards. I will try to debug it and provide more information 
tomorrow though.


> 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. Parts 3 and 4 are converting non-bridge drivers (mostly
> encoders).
>
> (*) One bridge driver (synopsys/dw-hdmi) is converted in another series,
>      together with its (non-bridge) users. Additionally this series converts
>      drm_of_panel_bridge_remove() which is a special case, and has a bugfix
>      for it too.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> ---
> Luca Ceresoli (12):
>        drm: of: drm_of_panel_bridge_remove(): fix device_node leak
>        drm: of: drm_of_panel_bridge_remove(): convert to of_drm_find_and_get_bridge()
>        drm/bridge: sii902x: convert to of_drm_find_and_get_bridge()
>        drm/bridge: thc63lvd1024: convert to of_drm_find_and_get_bridge()
>        drm/bridge: tfp410: convert to of_drm_find_and_get_bridge()
>        drm/bridge: tpd12s015: convert to of_drm_find_and_get_bridge()
>        drm/bridge: lt8912b: convert to of_drm_find_and_get_bridge()
>        drm/bridge: imx8mp-hdmi-pvi: convert to of_drm_find_and_get_bridge()
>        drm/bridge: imx8qxp-ldb: convert to of_drm_find_and_get_bridge()
>        drm/bridge: samsung-dsim: samsung_dsim_host_attach: use a temporary variable for the next bridge
>        drm/bridge: samsung-dsim: samsung_dsim_host_attach: don't use the bridge pointer as an error indicator
>        drm/bridge: samsung-dsim: samsung_dsim_host_attach: convert to of_drm_find_and_get_bridge()
>
>   drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c | 15 +++++++-------
>   drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c     |  3 ++-
>   drivers/gpu/drm/bridge/lontium-lt8912b.c     | 31 ++++++++++++++--------------
>   drivers/gpu/drm/bridge/samsung-dsim.c        | 28 ++++++++++++++++---------
>   drivers/gpu/drm/bridge/sii902x.c             |  7 +++----
>   drivers/gpu/drm/bridge/thc63lvd1024.c        |  7 +++----
>   drivers/gpu/drm/bridge/ti-tfp410.c           | 27 ++++++++++++------------
>   drivers/gpu/drm/bridge/ti-tpd12s015.c        |  8 +++----
>   include/drm/bridge/samsung-dsim.h            |  1 -
>   include/drm/drm_of.h                         |  6 +++++-
>   10 files changed, 69 insertions(+), 64 deletions(-)
> ---
> base-commit: 2bcba510a612cea32b8a536eedeabd7fcb413cd0
> change-id: 20251223-drm-bridge-alloc-getput-drm_of_find_bridge-2-12c6bbcb6896
>
> Best regards,

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


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

end of thread, other threads:[~2026-01-07 23:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20260107131333eucas1p2ee0b7afe47dc2fafa29e893e4283962b@eucas1p2.samsung.com>
2026-01-07 13:12 ` [PATCH 00/12] drm/bridge: convert users of of_drm_find_bridge(), part 2 Luca Ceresoli
2026-01-07 13:12   ` [PATCH 01/12] drm: of: drm_of_panel_bridge_remove(): fix device_node leak Luca Ceresoli
2026-01-07 13:33     ` Maxime Ripard
2026-01-07 23:48   ` [PATCH 00/12] drm/bridge: convert users of of_drm_find_bridge(), part 2 Marek Szyprowski

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