[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251121-lcd_cleanup_mainline-v1-3-2587e6fe4d67@microchip.com>
Date: Fri, 21 Nov 2025 16:04:35 +0100
From: Ludovic Desroches <ludovic.desroches@...rochip.com>
To: Manikandan Muralidharan <manikandan.m@...rochip.com>, "Dharma
Balasubiramani" <dharma.b@...rochip.com>, Maarten Lankhorst
<maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Nicolas Ferre <nicolas.ferre@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>, Claudiu Beznea
<claudiu.beznea@...on.dev>
CC: <dri-devel@...ts.freedesktop.org>, <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, Ludovic Desroches
<ludovic.desroches@...rochip.com>
Subject: [PATCH 3/8] 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@...rochip.com>
Reviewed-by: Manikandan Muralidharan <manikandan.m@...rochip.com>
---
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c | 27 ++++++++----------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
index 0b8a86afb0965ca3085dd5524983a0072199ec0b..1f43e0feeedae54321a17efc266654e72e8b9d8e 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
@@ -73,22 +73,19 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint)
struct drm_bridge *bridge;
int ret;
- 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);
+ if (ret)
return ret;
- }
- output = devm_kzalloc(dev->dev, sizeof(*output), GFP_KERNEL);
- if (!output) {
- of_node_put(ep);
- return -ENOMEM;
- }
+ 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;
output->bus_fmt = atmel_hlcdc_of_bus_fmt(ep);
of_node_put(ep);
@@ -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;
}
--
2.51.0
Powered by blists - more mailing lists