Re: [PATCH v6] drm/bridge: imx8qxp-pixel-link: get/put the next bridge
From: Liu Ying <victor.liu@nxp.com>
Date: 2026-02-13 03:05:22
Also in:
dri-devel, imx, lkml
On Wed, Feb 11, 2026 at 10:39:49PM +0100, Luca Ceresoli 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, so move to of_drm_find_and_get_bridge() for the bridge to be refcounted and use bridge->next_bridge to put the reference on deallocation. To keep the code as simple and reliable as possible remove the intermediate next_bridge and selected_bridge variables. Get/put operations on the remaining pointer is pl->bridge.next_bridge, which is tied to the struct imx8qxp_pixel_link lifetime, are: - get reference when assigned (by of_drm_find_and_get_bridge()) - put reference before reassignment if reassignment happens - put reference when the struct imx8qxp_pixel_link embedding the struct drm_bridge is destroyed (struct drm_bridge::next_bridge) Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> --- Changes in v6: - rewrite as suggested by Liu, removing the next_bridge pointer too and splitting the comment for maximum clarity - adapt commit message accordingly Changes in v5: - rewrite commit message after Liu's review to clarify the per-pointer get/put idea - split the if()s involved in selcting the bridge - remove intermediate selected_bridge pointer - removed Maxime's R-by, patch changed --- drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c | 27 ++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-)
Acked-by: Liu Ying <victor.liu@nxp.com> Thanks! -- Regards, Liu Ying