]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/bridge: imx8qxp-pxl2dpi: get/put the next bridge
authorLuca Ceresoli <luca.ceresoli@bootlin.com>
Tue, 16 Dec 2025 17:58:49 +0000 (18:58 +0100)
committerLuca Ceresoli <luca.ceresoli@bootlin.com>
Tue, 30 Dec 2025 09:11:33 +0000 (10:11 +0100)
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 of_drm_find_and_get_bridge() for the bridge to be
refcounted and use bridge->next_bridge to put the reference on
deallocation.

Reviewed-by: Maxime Ripard <mripard@kernel.org>
Link: https://patch.msgid.link/20251216-drm-bridge-alloc-getput-drm_of_find_bridge-v3-16-b5165fab8058@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c

index 2e66b003386e9d8fb96417e77e6eb4e6acb8d084..556aec3b3734e364d298aa7448ad03a2bea8d48f 100644 (file)
@@ -35,7 +35,6 @@
 struct imx8qxp_pxl2dpi {
        struct regmap *regmap;
        struct drm_bridge bridge;
-       struct drm_bridge *next_bridge;
        struct drm_bridge *companion;
        struct device *dev;
        struct imx_sc_ipc *ipc_handle;
@@ -60,7 +59,7 @@ static int imx8qxp_pxl2dpi_bridge_attach(struct drm_bridge *bridge,
        }
 
        return drm_bridge_attach(encoder,
-                                p2d->next_bridge, bridge,
+                                p2d->bridge.next_bridge, bridge,
                                 DRM_BRIDGE_ATTACH_NO_CONNECTOR);
 }
 
@@ -271,8 +270,8 @@ static int imx8qxp_pxl2dpi_find_next_bridge(struct imx8qxp_pxl2dpi *p2d)
                return -ENODEV;
        }
 
-       p2d->next_bridge = of_drm_find_bridge(remote);
-       if (!p2d->next_bridge)
+       p2d->bridge.next_bridge = of_drm_find_and_get_bridge(remote);
+       if (!p2d->bridge.next_bridge)
                return -EPROBE_DEFER;
 
        return 0;
@@ -351,8 +350,8 @@ static int imx8qxp_pxl2dpi_parse_dt_companion(struct imx8qxp_pxl2dpi *p2d)
         * the next bridges are connected to.  If they are marked as expecting
         * even pixels and odd pixels than we need to use the companion PXL2DPI.
         */
-       port1 = of_graph_get_port_by_id(p2d->next_bridge->of_node, 1);
-       port2 = of_graph_get_port_by_id(companion_p2d->next_bridge->of_node, 1);
+       port1 = of_graph_get_port_by_id(p2d->bridge.next_bridge->of_node, 1);
+       port2 = of_graph_get_port_by_id(companion_p2d->bridge.next_bridge->of_node, 1);
        dual_link = drm_of_lvds_get_dual_link_pixel_order(port1, port2);
        of_node_put(port1);
        of_node_put(port2);