[PATCH 01/22] drm/arc: Use simple encoder
Sam Ravnborg
sam at ravnborg.org
Fri Mar 6 21:18:03 UTC 2020
On Thu, Mar 05, 2020 at 04:59:29PM +0100, Thomas Zimmermann wrote:
> The arc driver uses empty implementations for its encoders. Replace
> the code with the generic simple encoder.
We should , as a follow-up patch, embed the encoder in
arcgpu_drm_private.
Then we drop the kzalloc() and avoid that life-time challenge.
This patch looks good for what it does.
Acked-by: Sam Ravnborg <sam at ravnborg.org>
>
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
> drivers/gpu/drm/arc/arcpgu_hdmi.c | 10 +++-------
> drivers/gpu/drm/arc/arcpgu_sim.c | 8 ++------
> 2 files changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/arc/arcpgu_hdmi.c b/drivers/gpu/drm/arc/arcpgu_hdmi.c
> index 52839934f2fb..780911765e2e 100644
> --- a/drivers/gpu/drm/arc/arcpgu_hdmi.c
> +++ b/drivers/gpu/drm/arc/arcpgu_hdmi.c
> @@ -7,15 +7,12 @@
>
> #include <drm/drm_bridge.h>
> #include <drm/drm_crtc.h>
> -#include <drm/drm_encoder.h>
> #include <drm/drm_device.h>
> +#include <drm/drm_encoder.h>
> +#include <drm/drm_simple_kms_helper.h>
>
> #include "arcpgu.h"
>
> -static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = {
> - .destroy = drm_encoder_cleanup,
> -};
> -
> int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np)
> {
> struct drm_encoder *encoder;
> @@ -34,8 +31,7 @@ int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np)
>
> encoder->possible_crtcs = 1;
> encoder->possible_clones = 0;
> - ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs,
> - DRM_MODE_ENCODER_TMDS, NULL);
> + ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
> if (ret)
> return ret;
>
> diff --git a/drivers/gpu/drm/arc/arcpgu_sim.c b/drivers/gpu/drm/arc/arcpgu_sim.c
> index 37d961668dfe..66ca2c26e339 100644
> --- a/drivers/gpu/drm/arc/arcpgu_sim.c
> +++ b/drivers/gpu/drm/arc/arcpgu_sim.c
> @@ -8,6 +8,7 @@
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_device.h>
> #include <drm/drm_probe_helper.h>
> +#include <drm/drm_simple_kms_helper.h>
>
> #include "arcpgu.h"
>
> @@ -50,10 +51,6 @@ static const struct drm_connector_funcs arcpgu_drm_connector_funcs = {
> .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> };
>
> -static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = {
> - .destroy = drm_encoder_cleanup,
> -};
> -
> int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
> {
> struct arcpgu_drm_connector *arcpgu_connector;
> @@ -68,8 +65,7 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np)
> encoder->possible_crtcs = 1;
> encoder->possible_clones = 0;
>
> - ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs,
> - DRM_MODE_ENCODER_VIRTUAL, NULL);
> + ret = drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_VIRTUAL);
> if (ret)
> return ret;
>
> --
> 2.25.1
More information about the dri-devel
mailing list