mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 02:24:24 +02:00
drm/imx: parallel-display: convert to devm_drm_bridge_alloc() API
This is the new API for allocating DRM bridges. This conversion was missed during the initial conversion of all bridges to the new API. Thus all kernels with commit94d50c1a2c("drm/bridge: get/put the bridge reference in drm_bridge_attach/detach()") and using this driver now warn due to drm_bridge_attach() incrementing the refcount, which is not initialized without using devm_drm_bridge_alloc() for allocation. To make the conversion simple and straightforward without messing up with the drmm_simple_encoder_alloc(), move the struct drm_bridge from struct imx_parallel_display_encoder to struct imx_parallel_display. Also remove the 'struct imx_parallel_display *pd' from struct imx_parallel_display_encoder, not needed anymore. Fixes:94d50c1a2c("drm/bridge: get/put the bridge reference in drm_bridge_attach/detach()") Reported-by: Ernest Van Hoecke <ernestvanhoecke@gmail.com> Closes: https://lore.kernel.org/all/hlf4wdopapxnh4rekl5s3kvoi6egaga3lrjfbx6r223ar3txri@3ik53xw5idyh/ Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com> Tested-by: Ernest Van Hoecke <ernest.vanhoecke@toradex.com> Link: https://patch.msgid.link/20251014-drm-bridge-alloc-imx-ipuv3-v1-1-a1bb1dcbff50@bootlin.com Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
parent
d8eb00bbc6
commit
3257bd193f
|
|
@ -25,19 +25,18 @@
|
|||
|
||||
struct imx_parallel_display_encoder {
|
||||
struct drm_encoder encoder;
|
||||
struct drm_bridge bridge;
|
||||
struct imx_parallel_display *pd;
|
||||
};
|
||||
|
||||
struct imx_parallel_display {
|
||||
struct device *dev;
|
||||
u32 bus_format;
|
||||
struct drm_bridge *next_bridge;
|
||||
struct drm_bridge bridge;
|
||||
};
|
||||
|
||||
static inline struct imx_parallel_display *bridge_to_imxpd(struct drm_bridge *b)
|
||||
{
|
||||
return container_of(b, struct imx_parallel_display_encoder, bridge)->pd;
|
||||
return container_of(b, struct imx_parallel_display, bridge);
|
||||
}
|
||||
|
||||
static const u32 imx_pd_bus_fmts[] = {
|
||||
|
|
@ -195,15 +194,13 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
|
|||
if (IS_ERR(imxpd_encoder))
|
||||
return PTR_ERR(imxpd_encoder);
|
||||
|
||||
imxpd_encoder->pd = imxpd;
|
||||
encoder = &imxpd_encoder->encoder;
|
||||
bridge = &imxpd_encoder->bridge;
|
||||
bridge = &imxpd->bridge;
|
||||
|
||||
ret = imx_drm_encoder_parse_of(drm, encoder, imxpd->dev->of_node);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
bridge->funcs = &imx_pd_bridge_funcs;
|
||||
drm_bridge_attach(encoder, bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR);
|
||||
|
||||
connector = drm_bridge_connector_init(drm, encoder);
|
||||
|
|
@ -228,9 +225,10 @@ static int imx_pd_probe(struct platform_device *pdev)
|
|||
u32 bus_format = 0;
|
||||
const char *fmt;
|
||||
|
||||
imxpd = devm_kzalloc(dev, sizeof(*imxpd), GFP_KERNEL);
|
||||
if (!imxpd)
|
||||
return -ENOMEM;
|
||||
imxpd = devm_drm_bridge_alloc(dev, struct imx_parallel_display, bridge,
|
||||
&imx_pd_bridge_funcs);
|
||||
if (IS_ERR(imxpd))
|
||||
return PTR_ERR(imxpd);
|
||||
|
||||
/* port@1 is the output port */
|
||||
imxpd->next_bridge = devm_drm_of_get_bridge(dev, np, 1, 0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user