Re: [PATCH 24/25] drm: kirin: Pass driver data to crtc init and plane init

From: Sam Ravnborg
Date: Wed Apr 24 2019 - 13:09:18 EST


Hi John.

On Tue, Apr 23, 2019 at 04:20:55PM -0700, John Stultz wrote:
> From: Xu YiPing <xuyiping@xxxxxxxxxxxxx>
>
> As part of refactoring the kirin driver to better support
> different hardware revisions, this patch changes funcitons
> to pass the kirin_driver_data as a prameter.
>
> This will allow those funcitons to be later moved to the
> generic kirin_drm_drv.c
>
> Cc: Xinliang Liu <z.liuxinliang@xxxxxxxxxxxxx>
> Cc: Rongrong Zou <zourongrong@xxxxxxxxx>
> Cc: Xinwei Kong <kong.kongxinwei@xxxxxxxxxxxxx>
> Cc: Chen Feng <puck.chen@xxxxxxxxxxxxx>
> Cc: David Airlie <airlied@xxxxxxxx>
> Cc: Daniel Vetter <daniel@xxxxxxxx>
> Cc: dri-devel <dri-devel@xxxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Xu YiPing <xuyiping@xxxxxxxxxxxxx>
> [jstultz: Reworded commit message]
> Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
> ---
> drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 25 ++++++++++++++-----------
> 1 file changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index 71671f8..876e25b 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -572,7 +572,8 @@ static const struct drm_crtc_funcs ade_crtc_funcs = {
> };
>
> static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
> - struct drm_plane *plane)
> + struct drm_plane *plane,
> + const struct kirin_drm_data *driver_data)

Indent looks wrong here.

> {
> struct device_node *port;
> int ret;
> @@ -589,13 +590,13 @@ static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
> crtc->port = port;
>
> ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL,
> - ade_driver_data.crtc_funcs, NULL);
> + driver_data->crtc_funcs, NULL);
> if (ret) {
> DRM_ERROR("failed to init crtc.\n");
> return ret;
> }
>
> - drm_crtc_helper_add(crtc, ade_driver_data.crtc_helper_funcs);
> + drm_crtc_helper_add(crtc, driver_data->crtc_helper_funcs);
>
> return 0;
> }


> @@ -894,21 +895,22 @@ static struct drm_plane_funcs ade_plane_funcs = {
>
> static int kirin_drm_plane_init(struct drm_device *dev,
> struct kirin_plane *kplane,
> - enum drm_plane_type type)
> + enum drm_plane_type type,
> + const struct kirin_drm_data *driver_data)
> {
> int ret = 0;
>
> ret = drm_universal_plane_init(dev, &kplane->base, 1,
> + driver_data->plane_funcs,
> + driver_data->channel_formats,
> + driver_data->channel_formats_cnt,
> + NULL, type, NULL);
Indent looks wrong here.

I missed where ade_driver_data came from.
This looks an extra patch to intoduce driver_data,
that maybe should be merged with an earlier version?

Sam