mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
drm/atmel-hlcdc: use drmm_simple_encoder_alloc()
Simplify the code using drmm_simple_encoder_alloc to handle allocation and initialization at once. Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com> Reviewed-by: Manikandan Muralidharan <manikandan.m@microchip.com> Link: https://patch.msgid.link/20251218-lcd_cleanup_mainline-v2-3-df837aba878f@microchip.com Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>
This commit is contained in:
parent
87cac7a5f9
commit
227ef8cf93
|
|
@ -73,23 +73,20 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint)
|
|||
struct drm_bridge *bridge;
|
||||
int ret;
|
||||
|
||||
ret = drm_of_find_panel_or_bridge(dev->dev->of_node, 0, endpoint,
|
||||
&panel, &bridge);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
output = drmm_simple_encoder_alloc(dev, struct atmel_hlcdc_rgb_output,
|
||||
encoder, DRM_MODE_ENCODER_NONE);
|
||||
if (IS_ERR(output))
|
||||
return PTR_ERR(output);
|
||||
|
||||
ep = of_graph_get_endpoint_by_regs(dev->dev->of_node, 0, endpoint);
|
||||
if (!ep)
|
||||
return -ENODEV;
|
||||
|
||||
ret = drm_of_find_panel_or_bridge(dev->dev->of_node, 0, endpoint,
|
||||
&panel, &bridge);
|
||||
if (ret) {
|
||||
of_node_put(ep);
|
||||
return ret;
|
||||
}
|
||||
|
||||
output = devm_kzalloc(dev->dev, sizeof(*output), GFP_KERNEL);
|
||||
if (!output) {
|
||||
of_node_put(ep);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
output->bus_fmt = atmel_hlcdc_of_bus_fmt(ep);
|
||||
of_node_put(ep);
|
||||
if (output->bus_fmt < 0) {
|
||||
|
|
@ -97,10 +94,6 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = drm_simple_encoder_init(dev, &output->encoder,
|
||||
DRM_MODE_ENCODER_NONE);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
output->encoder.possible_crtcs = 0x1;
|
||||
|
||||
|
|
@ -120,8 +113,6 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint)
|
|||
drm_panel_bridge_remove(bridge);
|
||||
}
|
||||
|
||||
drm_encoder_cleanup(&output->encoder);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user