[<prev] [next>] [day] [month] [year] [list]
Message-ID: <8eab7706-e86a-7e2b-3107-76fe10639e70@igalia.com>
Date: Mon, 28 Nov 2022 17:26:34 -0300
From: Maíra Canal <mcanal@...lia.com>
To: Maxime Ripard <maxime@...no.tech>, Daniel Vetter <daniel@...ll.ch>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
David Airlie <airlied@...il.com>,
Thomas Zimmermann <tzimmermann@...e.de>
Cc: dri-devel@...ts.freedesktop.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
kunit-dev@...glegroups.com, linux-media@...r.kernel.org,
linux-kselftest@...r.kernel.org, linaro-mm-sig@...ts.linaro.org,
Brendan Higgins <brendan.higgins@...ux.dev>,
Dave Stevenson <dave.stevenson@...pberrypi.com>,
Javier Martinez Canillas <javierm@...hat.com>,
linux-kernel@...r.kernel.org, David Gow <davidgow@...gle.com>
Subject: Re: [PATCH v2 13/17] drm/vc4: crtc: Make encoder lookup helper public
On 11/28/22 11:53, Maxime Ripard wrote:
> We'll need a function that looks up an encoder by its vc4_encoder_type.
> Such a function is already present in the CRTC code, so let's make it
> public so that we can reuse it in the unit tests.
>
> Reviewed-by: Javier Martinez Canillas <javierm@...hat.com>
> Signed-off-by: Maxime Ripard <maxime@...no.tech>
Reviewed-by: Maíra Canal <mcanal@...lia.com>
Best Regards,
- Maíra Canal
> ---
> drivers/gpu/drm/vc4/vc4_crtc.c | 17 +----------------
> drivers/gpu/drm/vc4/vc4_drv.h | 16 ++++++++++++++++
> 2 files changed, 17 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
> index 7a2c54efecb0..59e473059fa2 100644
> --- a/drivers/gpu/drm/vc4/vc4_crtc.c
> +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
> @@ -486,21 +486,6 @@ static int vc4_crtc_disable(struct drm_crtc *crtc,
> return 0;
> }
>
> -static struct drm_encoder *vc4_crtc_get_encoder_by_type(struct drm_crtc *crtc,
> - enum vc4_encoder_type type)
> -{
> - struct drm_encoder *encoder;
> -
> - drm_for_each_encoder(encoder, crtc->dev) {
> - struct vc4_encoder *vc4_encoder = to_vc4_encoder(encoder);
> -
> - if (vc4_encoder->type == type)
> - return encoder;
> - }
> -
> - return NULL;
> -}
> -
> int vc4_crtc_disable_at_boot(struct drm_crtc *crtc)
> {
> struct drm_device *drm = crtc->dev;
> @@ -536,7 +521,7 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc)
>
> pv_data = vc4_crtc_to_vc4_pv_data(vc4_crtc);
> encoder_type = pv_data->encoder_types[encoder_sel];
> - encoder = vc4_crtc_get_encoder_by_type(crtc, encoder_type);
> + encoder = vc4_find_encoder_by_type(drm, encoder_type);
> if (WARN_ON(!encoder))
> return 0;
>
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
> index cd2002fff115..54352db48476 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.h
> +++ b/drivers/gpu/drm/vc4/vc4_drv.h
> @@ -495,6 +495,22 @@ to_vc4_encoder(const struct drm_encoder *encoder)
> return container_of(encoder, struct vc4_encoder, base);
> }
>
> +static inline
> +struct drm_encoder *vc4_find_encoder_by_type(struct drm_device *drm,
> + enum vc4_encoder_type type)
> +{
> + struct drm_encoder *encoder;
> +
> + drm_for_each_encoder(encoder, drm) {
> + struct vc4_encoder *vc4_encoder = to_vc4_encoder(encoder);
> +
> + if (vc4_encoder->type == type)
> + return encoder;
> + }
> +
> + return NULL;
> +}
> +
> struct vc4_crtc_data {
> const char *name;
>
>
Powered by blists - more mailing lists