diff mbox

[1/7] drm/hisilicon: Don't set drm_device->platformdev

Message ID 20161209141944.22121-1-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter Dec. 9, 2016, 2:19 p.m. UTC
It's deprecated and only should be used by drivers which still use
drm_platform_init, not by anyone else.

And indeed it's entirely unused and can be nuked.

This required a bit more fudging, but I guess kirin_dc_ops really
wants to operate on the platform_device, not something else. Also
bonus points for implementing abstraction, and then storing the vfunc
in a global variable.

v2: Don't break the build soooo badly :(
Note that the cleanup function is a bit confused: ade_data was never
set as drvdata, and calling drm_crtc_cleanup directly is a bug - this
is called indirectly through drm_mode_config_cleanup, which calls into
crtc->destroy, which already has the call to drm_crtc_cleanup. Which
means we can just nuke it.

Note this is the 2nd attempt after the first one failed and had to be
reverted again in

commit 9cd2e854d61ccfa51686f3ed7b0c917708fc641f
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Wed Aug 17 13:59:40 2016 +0200

    Revert "drm/hisilicon: Don't set drm_device->platformdev"

Cc: Xinliang Liu <xinliang.liu@linaro.org>
Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
Cc: Archit Taneja <architt@codeaurora.org>
Cc: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 11 +++--------
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  8 +++-----
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h |  4 ++--
 3 files changed, 8 insertions(+), 15 deletions(-)

Comments

Sean Paul Dec. 9, 2016, 6:04 p.m. UTC | #1
On Fri, Dec 9, 2016 at 9:19 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> It's deprecated and only should be used by drivers which still use
> drm_platform_init, not by anyone else.
>
> And indeed it's entirely unused and can be nuked.
>
> This required a bit more fudging, but I guess kirin_dc_ops really
> wants to operate on the platform_device, not something else. Also
> bonus points for implementing abstraction, and then storing the vfunc
> in a global variable.
>
> v2: Don't break the build soooo badly :(
> Note that the cleanup function is a bit confused: ade_data was never
> set as drvdata, and calling drm_crtc_cleanup directly is a bug - this
> is called indirectly through drm_mode_config_cleanup, which calls into
> crtc->destroy, which already has the call to drm_crtc_cleanup. Which
> means we can just nuke it.
>
> Note this is the 2nd attempt after the first one failed and had to be
> reverted again in
>
> commit 9cd2e854d61ccfa51686f3ed7b0c917708fc641f
> Author: Daniel Vetter <daniel.vetter@ffwll.ch>
> Date:   Wed Aug 17 13:59:40 2016 +0200
>
>     Revert "drm/hisilicon: Don't set drm_device->platformdev"
>
> Cc: Xinliang Liu <xinliang.liu@linaro.org>
> Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
> Cc: Archit Taneja <architt@codeaurora.org>
> Cc: Sean Paul <seanpaul@chromium.org>

This time with feeling!

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 11 +++--------
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  8 +++-----
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h |  4 ++--
>  3 files changed, 8 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index afc2b5d2d5f0..3ea70459b901 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -973,9 +973,9 @@ static int ade_dts_parse(struct platform_device *pdev, struct ade_hw_ctx *ctx)
>         return 0;
>  }
>
> -static int ade_drm_init(struct drm_device *dev)
> +static int ade_drm_init(struct platform_device *pdev)
>  {
> -       struct platform_device *pdev = dev->platformdev;
> +       struct drm_device *dev = platform_get_drvdata(pdev);
>         struct ade_data *ade;
>         struct ade_hw_ctx *ctx;
>         struct ade_crtc *acrtc;
> @@ -1034,13 +1034,8 @@ static int ade_drm_init(struct drm_device *dev)
>         return 0;
>  }
>
> -static void ade_drm_cleanup(struct drm_device *dev)
> +static void ade_drm_cleanup(struct platform_device *pdev)
>  {
> -       struct platform_device *pdev = dev->platformdev;
> -       struct ade_data *ade = platform_get_drvdata(pdev);
> -       struct drm_crtc *crtc = &ade->acrtc.base;
> -
> -       drm_crtc_cleanup(crtc);
>  }
>
>  const struct kirin_dc_ops ade_dc_ops = {
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index ebd5f4fe4c23..fa228b7b022c 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -42,7 +42,7 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev)
>  #endif
>         drm_kms_helper_poll_fini(dev);
>         drm_vblank_cleanup(dev);
> -       dc_ops->cleanup(dev);
> +       dc_ops->cleanup(to_platform_device(dev->dev));
>         drm_mode_config_cleanup(dev);
>         devm_kfree(dev->dev, priv);
>         dev->dev_private = NULL;
> @@ -104,7 +104,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
>         kirin_drm_mode_config_init(dev);
>
>         /* display controller init */
> -       ret = dc_ops->init(dev);
> +       ret = dc_ops->init(to_platform_device(dev->dev));
>         if (ret)
>                 goto err_mode_config_cleanup;
>
> @@ -138,7 +138,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
>  err_unbind_all:
>         component_unbind_all(dev->dev, dev);
>  err_dc_cleanup:
> -       dc_ops->cleanup(dev);
> +       dc_ops->cleanup(to_platform_device(dev->dev));
>  err_mode_config_cleanup:
>         drm_mode_config_cleanup(dev);
>         devm_kfree(dev->dev, priv);
> @@ -209,8 +209,6 @@ static int kirin_drm_bind(struct device *dev)
>         if (IS_ERR(drm_dev))
>                 return PTR_ERR(drm_dev);
>
> -       drm_dev->platformdev = to_platform_device(dev);
> -
>         ret = kirin_drm_kms_init(drm_dev);
>         if (ret)
>                 goto err_drm_dev_unref;
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> index 1a07caf8e7f4..a0bb217c4c64 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> @@ -15,8 +15,8 @@
>
>  /* display controller init/cleanup ops */
>  struct kirin_dc_ops {
> -       int (*init)(struct drm_device *dev);
> -       void (*cleanup)(struct drm_device *dev);
> +       int (*init)(struct platform_device *pdev);
> +       void (*cleanup)(struct platform_device *pdev);
>  };
>
>  struct kirin_drm_private {
> --
> 2.10.2
>
Daniel Vetter Dec. 9, 2016, 8:59 p.m. UTC | #2
On Fri, Dec 09, 2016 at 03:27:30PM -0000, Patchwork wrote:
> == Series Details ==
> 
> Series: series starting with [1/7] drm/hisilicon: Don't set drm_device->platformdev
> URL   : https://patchwork.freedesktop.org/series/16619/
> State : failure
> 
> == Summary ==
> 
> Series 16619v1 Series without cover letter
> https://patchwork.freedesktop.org/api/1.0/series/16619/revisions/1/mbox/

Aka atomic rmfb broke the world, I guess it's time to give up on that idea
... I've confirmed that by throwing the series minus the last patch at
trybot, and it's happy if I leave out the atomic rmfb.
-Daniel

> 
> Test drv_module_reload:
>         Subgroup basic-reload:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>                 pass       -> DMESG-WARN (fi-ivb-3770)
>                 pass       -> DMESG-WARN (fi-hsw-4770r)
>                 pass       -> DMESG-WARN (fi-skl-6770hq)
>                 pass       -> DMESG-WARN (fi-ilk-650)
>                 pass       -> DMESG-WARN (fi-kbl-7500u)
>                 pass       -> DMESG-WARN (fi-bsw-n3050)
>                 pass       -> DMESG-WARN (fi-snb-2600)
>                 pass       -> DMESG-WARN (fi-byt-j1900)
>                 pass       -> DMESG-WARN (fi-skl-6700hq)
>                 pass       -> DMESG-WARN (fi-ivb-3520m)
>                 pass       -> DMESG-WARN (fi-bxt-t5700)
>                 pass       -> DMESG-WARN (fi-byt-n2820)
>                 pass       -> DMESG-WARN (fi-bdw-5557u)
>                 pass       -> DMESG-WARN (fi-hsw-4770)
>                 pass       -> DMESG-WARN (fi-snb-2520m)
>         Subgroup basic-reload-final:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>                 pass       -> DMESG-WARN (fi-skl-6700hq)
>         Subgroup basic-reload-inject:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>                 pass       -> DMESG-WARN (fi-ivb-3770)
>                 pass       -> DMESG-WARN (fi-hsw-4770r)
>                 pass       -> INCOMPLETE (fi-skl-6770hq)
>                 pass       -> DMESG-WARN (fi-ilk-650)
>                 pass       -> INCOMPLETE (fi-kbl-7500u)
>                 pass       -> DMESG-WARN (fi-bsw-n3050)
>                 pass       -> DMESG-WARN (fi-snb-2600)
>                 pass       -> DMESG-WARN (fi-byt-j1900)
>                 pass       -> DMESG-WARN (fi-skl-6700hq)
>                 pass       -> DMESG-WARN (fi-ivb-3520m)
>                 pass       -> DMESG-WARN (fi-bxt-t5700)
>                 pass       -> DMESG-WARN (fi-byt-n2820)
>                 pass       -> DMESG-WARN (fi-bdw-5557u)
>                 pass       -> DMESG-WARN (fi-hsw-4770)
>                 pass       -> INCOMPLETE (fi-snb-2520m)
> Test gem_exec_suspend:
>         Subgroup basic-s3:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup basic-s4-devices:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
> Test kms_busy:
>         Subgroup basic-flip-default-a:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup basic-flip-default-b:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup basic-flip-default-c:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
> Test kms_cursor_legacy:
>         Subgroup basic-busy-flip-before-cursor-legacy:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup basic-busy-flip-before-cursor-varying-size:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup basic-flip-after-cursor-legacy:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup basic-flip-after-cursor-varying-size:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup basic-flip-before-cursor-legacy:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup basic-flip-before-cursor-varying-size:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
> Test kms_flip:
>         Subgroup basic-flip-vs-dpms:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup basic-flip-vs-modeset:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup basic-flip-vs-wf_vblank:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup basic-plain-flip:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
> Test kms_frontbuffer_tracking:
>         Subgroup basic:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
> Test kms_pipe_crc_basic:
>         Subgroup hang-read-crc-pipe-a:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup hang-read-crc-pipe-b:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup hang-read-crc-pipe-c:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup nonblocking-crc-pipe-a:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup nonblocking-crc-pipe-a-frame-sequence:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup nonblocking-crc-pipe-b:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup nonblocking-crc-pipe-b-frame-sequence:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup nonblocking-crc-pipe-c:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup nonblocking-crc-pipe-c-frame-sequence:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup read-crc-pipe-a:
>                 pass       -> DMESG-WARN (fi-skl-6260u)
>         Subgroup read-crc-pipe-a-frame-sequence:
> WARNING: Long output truncated
> 
> de43f4e755c6bf50ad53b4ccacedf9850f42eda4 drm-tip: 2016y-12m-09d-09h-01m-58s UTC integration manifest
> 75df55d drm: Resurrect atomic rmfb code
> 668b003 drm: Don't walk fb list twice in getresources
> c33deea drm: Don't compute obj counts expensively in get_resources
> 13d0415 drm: Enforce BKL-less ioctls for modern drivers
> 561de8e drm: setclientcap doesn't need the drm BKL
> c0b4d4a drm: Protect master->unique with dev->master_mutex
> d94d6b7 drm/hisilicon: Don't set drm_device->platformdev
> 
> == Logs ==
> 
> For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3253/
Daniel Vetter Dec. 13, 2016, 9:20 a.m. UTC | #3
On Fri, Dec 09, 2016 at 01:04:12PM -0500, Sean Paul wrote:
> On Fri, Dec 9, 2016 at 9:19 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > It's deprecated and only should be used by drivers which still use
> > drm_platform_init, not by anyone else.
> >
> > And indeed it's entirely unused and can be nuked.
> >
> > This required a bit more fudging, but I guess kirin_dc_ops really
> > wants to operate on the platform_device, not something else. Also
> > bonus points for implementing abstraction, and then storing the vfunc
> > in a global variable.
> >
> > v2: Don't break the build soooo badly :(
> > Note that the cleanup function is a bit confused: ade_data was never
> > set as drvdata, and calling drm_crtc_cleanup directly is a bug - this
> > is called indirectly through drm_mode_config_cleanup, which calls into
> > crtc->destroy, which already has the call to drm_crtc_cleanup. Which
> > means we can just nuke it.
> >
> > Note this is the 2nd attempt after the first one failed and had to be
> > reverted again in
> >
> > commit 9cd2e854d61ccfa51686f3ed7b0c917708fc641f
> > Author: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Date:   Wed Aug 17 13:59:40 2016 +0200
> >
> >     Revert "drm/hisilicon: Don't set drm_device->platformdev"
> >
> > Cc: Xinliang Liu <xinliang.liu@linaro.org>
> > Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
> > Cc: Archit Taneja <architt@codeaurora.org>
> > Cc: Sean Paul <seanpaul@chromium.org>
> 
> This time with feeling!
> 
> Reviewed-by: Sean Paul <seanpaul@chromium.org>

Thanks for the review, applied to drm-misc (but for 4.11).
-Daniel

> 
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > ---
> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 11 +++--------
> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  8 +++-----
> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h |  4 ++--
> >  3 files changed, 8 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > index afc2b5d2d5f0..3ea70459b901 100644
> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > @@ -973,9 +973,9 @@ static int ade_dts_parse(struct platform_device *pdev, struct ade_hw_ctx *ctx)
> >         return 0;
> >  }
> >
> > -static int ade_drm_init(struct drm_device *dev)
> > +static int ade_drm_init(struct platform_device *pdev)
> >  {
> > -       struct platform_device *pdev = dev->platformdev;
> > +       struct drm_device *dev = platform_get_drvdata(pdev);
> >         struct ade_data *ade;
> >         struct ade_hw_ctx *ctx;
> >         struct ade_crtc *acrtc;
> > @@ -1034,13 +1034,8 @@ static int ade_drm_init(struct drm_device *dev)
> >         return 0;
> >  }
> >
> > -static void ade_drm_cleanup(struct drm_device *dev)
> > +static void ade_drm_cleanup(struct platform_device *pdev)
> >  {
> > -       struct platform_device *pdev = dev->platformdev;
> > -       struct ade_data *ade = platform_get_drvdata(pdev);
> > -       struct drm_crtc *crtc = &ade->acrtc.base;
> > -
> > -       drm_crtc_cleanup(crtc);
> >  }
> >
> >  const struct kirin_dc_ops ade_dc_ops = {
> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> > index ebd5f4fe4c23..fa228b7b022c 100644
> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> > @@ -42,7 +42,7 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev)
> >  #endif
> >         drm_kms_helper_poll_fini(dev);
> >         drm_vblank_cleanup(dev);
> > -       dc_ops->cleanup(dev);
> > +       dc_ops->cleanup(to_platform_device(dev->dev));
> >         drm_mode_config_cleanup(dev);
> >         devm_kfree(dev->dev, priv);
> >         dev->dev_private = NULL;
> > @@ -104,7 +104,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
> >         kirin_drm_mode_config_init(dev);
> >
> >         /* display controller init */
> > -       ret = dc_ops->init(dev);
> > +       ret = dc_ops->init(to_platform_device(dev->dev));
> >         if (ret)
> >                 goto err_mode_config_cleanup;
> >
> > @@ -138,7 +138,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
> >  err_unbind_all:
> >         component_unbind_all(dev->dev, dev);
> >  err_dc_cleanup:
> > -       dc_ops->cleanup(dev);
> > +       dc_ops->cleanup(to_platform_device(dev->dev));
> >  err_mode_config_cleanup:
> >         drm_mode_config_cleanup(dev);
> >         devm_kfree(dev->dev, priv);
> > @@ -209,8 +209,6 @@ static int kirin_drm_bind(struct device *dev)
> >         if (IS_ERR(drm_dev))
> >                 return PTR_ERR(drm_dev);
> >
> > -       drm_dev->platformdev = to_platform_device(dev);
> > -
> >         ret = kirin_drm_kms_init(drm_dev);
> >         if (ret)
> >                 goto err_drm_dev_unref;
> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> > index 1a07caf8e7f4..a0bb217c4c64 100644
> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> > @@ -15,8 +15,8 @@
> >
> >  /* display controller init/cleanup ops */
> >  struct kirin_dc_ops {
> > -       int (*init)(struct drm_device *dev);
> > -       void (*cleanup)(struct drm_device *dev);
> > +       int (*init)(struct platform_device *pdev);
> > +       void (*cleanup)(struct platform_device *pdev);
> >  };
> >
> >  struct kirin_drm_private {
> > --
> > 2.10.2
> >
diff mbox

Patch

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index afc2b5d2d5f0..3ea70459b901 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -973,9 +973,9 @@  static int ade_dts_parse(struct platform_device *pdev, struct ade_hw_ctx *ctx)
 	return 0;
 }
 
-static int ade_drm_init(struct drm_device *dev)
+static int ade_drm_init(struct platform_device *pdev)
 {
-	struct platform_device *pdev = dev->platformdev;
+	struct drm_device *dev = platform_get_drvdata(pdev);
 	struct ade_data *ade;
 	struct ade_hw_ctx *ctx;
 	struct ade_crtc *acrtc;
@@ -1034,13 +1034,8 @@  static int ade_drm_init(struct drm_device *dev)
 	return 0;
 }
 
-static void ade_drm_cleanup(struct drm_device *dev)
+static void ade_drm_cleanup(struct platform_device *pdev)
 {
-	struct platform_device *pdev = dev->platformdev;
-	struct ade_data *ade = platform_get_drvdata(pdev);
-	struct drm_crtc *crtc = &ade->acrtc.base;
-
-	drm_crtc_cleanup(crtc);
 }
 
 const struct kirin_dc_ops ade_dc_ops = {
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index ebd5f4fe4c23..fa228b7b022c 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -42,7 +42,7 @@  static int kirin_drm_kms_cleanup(struct drm_device *dev)
 #endif
 	drm_kms_helper_poll_fini(dev);
 	drm_vblank_cleanup(dev);
-	dc_ops->cleanup(dev);
+	dc_ops->cleanup(to_platform_device(dev->dev));
 	drm_mode_config_cleanup(dev);
 	devm_kfree(dev->dev, priv);
 	dev->dev_private = NULL;
@@ -104,7 +104,7 @@  static int kirin_drm_kms_init(struct drm_device *dev)
 	kirin_drm_mode_config_init(dev);
 
 	/* display controller init */
-	ret = dc_ops->init(dev);
+	ret = dc_ops->init(to_platform_device(dev->dev));
 	if (ret)
 		goto err_mode_config_cleanup;
 
@@ -138,7 +138,7 @@  static int kirin_drm_kms_init(struct drm_device *dev)
 err_unbind_all:
 	component_unbind_all(dev->dev, dev);
 err_dc_cleanup:
-	dc_ops->cleanup(dev);
+	dc_ops->cleanup(to_platform_device(dev->dev));
 err_mode_config_cleanup:
 	drm_mode_config_cleanup(dev);
 	devm_kfree(dev->dev, priv);
@@ -209,8 +209,6 @@  static int kirin_drm_bind(struct device *dev)
 	if (IS_ERR(drm_dev))
 		return PTR_ERR(drm_dev);
 
-	drm_dev->platformdev = to_platform_device(dev);
-
 	ret = kirin_drm_kms_init(drm_dev);
 	if (ret)
 		goto err_drm_dev_unref;
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
index 1a07caf8e7f4..a0bb217c4c64 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
@@ -15,8 +15,8 @@ 
 
 /* display controller init/cleanup ops */
 struct kirin_dc_ops {
-	int (*init)(struct drm_device *dev);
-	void (*cleanup)(struct drm_device *dev);
+	int (*init)(struct platform_device *pdev);
+	void (*cleanup)(struct platform_device *pdev);
 };
 
 struct kirin_drm_private {