This is the new API for allocating DRM bridges.

This driver has a peculiar structure. zynqmp_dpsub.c is the actual driver,
which delegates to a submodule (zynqmp_dp.c) the allocation of a
sub-structure embedding the drm_bridge and its initialization, however it
does not delegate the drm_bridge_add(). Hence, following carefully the code
flow, it is correct to change the allocation function and .funcs assignment
in the submodule, while the drm_bridge_add() is not in that submodule.

Signed-off-by: Luca Ceresoli <luca.ceres...@bootlin.com>

---

Cc: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
Cc: Michal Simek <michal.si...@amd.com>
Cc: Tomi Valkeinen <tomi.valkei...@ideasonboard.com>
---
 drivers/gpu/drm/xlnx/zynqmp_dp.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c
index 
11d2415fb5a1f7fad03421898331289f2295d68b..de22b6457a78a7a2110f9f308d0b5a8700544010
 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_dp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c
@@ -2439,9 +2439,9 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub)
        struct zynqmp_dp *dp;
        int ret;
 
-       dp = kzalloc(sizeof(*dp), GFP_KERNEL);
-       if (!dp)
-               return -ENOMEM;
+       dp = devm_drm_bridge_alloc(&pdev->dev, struct zynqmp_dp, bridge, 
&zynqmp_dp_bridge_funcs);
+       if (IS_ERR(dp))
+               return PTR_ERR(dp);
 
        dp->dev = &pdev->dev;
        dp->dpsub = dpsub;
@@ -2488,7 +2488,6 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub)
 
        /* Initialize the bridge. */
        bridge = &dp->bridge;
-       bridge->funcs = &zynqmp_dp_bridge_funcs;
        bridge->ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID
                    | DRM_BRIDGE_OP_HPD;
        bridge->type = DRM_MODE_CONNECTOR_DisplayPort;

-- 
2.49.0

Reply via email to