mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 06:31:58 +02:00
drm: zynqmp_dp: convert to devm_drm_bridge_alloc() API
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. Acked-by: Maxime Ripard <mripard@kernel.org> Link: https://lore.kernel.org/r/20250509-drm-bridge-convert-to-alloc-api-v3-17-b8bc1f16d7aa@bootlin.com Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
This commit is contained in:
parent
3d3f22799c
commit
afb903c01b
|
|
@ -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;
|
||||
|
|
@ -2454,31 +2454,25 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub)
|
|||
|
||||
/* Acquire all resources (IOMEM, IRQ and PHYs). */
|
||||
dp->iomem = devm_platform_ioremap_resource_byname(pdev, "dp");
|
||||
if (IS_ERR(dp->iomem)) {
|
||||
ret = PTR_ERR(dp->iomem);
|
||||
goto err_free;
|
||||
}
|
||||
if (IS_ERR(dp->iomem))
|
||||
return PTR_ERR(dp->iomem);
|
||||
|
||||
dp->irq = platform_get_irq(pdev, 0);
|
||||
if (dp->irq < 0) {
|
||||
ret = dp->irq;
|
||||
goto err_free;
|
||||
}
|
||||
if (dp->irq < 0)
|
||||
return dp->irq;
|
||||
|
||||
dp->reset = devm_reset_control_get(dp->dev, NULL);
|
||||
if (IS_ERR(dp->reset)) {
|
||||
ret = dev_err_probe(dp->dev, PTR_ERR(dp->reset),
|
||||
if (IS_ERR(dp->reset))
|
||||
return dev_err_probe(dp->dev, PTR_ERR(dp->reset),
|
||||
"failed to get reset\n");
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
ret = zynqmp_dp_reset(dp, true);
|
||||
if (ret < 0)
|
||||
goto err_free;
|
||||
return ret;
|
||||
|
||||
ret = zynqmp_dp_reset(dp, false);
|
||||
if (ret < 0)
|
||||
goto err_free;
|
||||
return ret;
|
||||
|
||||
ret = zynqmp_dp_phy_probe(dp);
|
||||
if (ret)
|
||||
|
|
@ -2486,7 +2480,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;
|
||||
|
|
@ -2539,8 +2532,6 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub)
|
|||
zynqmp_dp_phy_exit(dp);
|
||||
err_reset:
|
||||
zynqmp_dp_reset(dp, true);
|
||||
err_free:
|
||||
kfree(dp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -180,7 +180,6 @@ static int zynqmp_dpsub_parse_dt(struct zynqmp_dpsub *dpsub)
|
|||
void zynqmp_dpsub_release(struct zynqmp_dpsub *dpsub)
|
||||
{
|
||||
kfree(dpsub->disp);
|
||||
kfree(dpsub->dp);
|
||||
kfree(dpsub);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user