All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <seanpaul@chromium.org>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	Xinwei Kong <kong.kongxinwei@hisilicon.com>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH 1/7] drm/hisilicon: Don't set drm_device->platformdev
Date: Fri, 9 Dec 2016 13:04:12 -0500	[thread overview]
Message-ID: <CAOw6vbLsSJ1dm9dOJC-Rg+cghrgH-ryUGE6Zawvg2f12WTBPcQ@mail.gmail.com> (raw)
In-Reply-To: <20161209141944.22121-1-daniel.vetter@ffwll.ch>

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
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-12-09 18:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09 14:19 [PATCH 1/7] drm/hisilicon: Don't set drm_device->platformdev Daniel Vetter
2016-12-09 14:19 ` [PATCH 2/7] drm: Protect master->unique with dev->master_mutex Daniel Vetter
2016-12-09 14:54   ` Emil Velikov
2016-12-09 15:31     ` Daniel Vetter
2016-12-09 14:19 ` [PATCH 3/7] drm: setclientcap doesn't need the drm BKL Daniel Vetter
2016-12-09 14:19 ` [PATCH 4/7] drm: Enforce BKL-less ioctls for modern drivers Daniel Vetter
2016-12-09 14:19 ` [PATCH 5/7] drm: Don't compute obj counts expensively in get_resources Daniel Vetter
2016-12-09 21:47   ` Chris Wilson
2016-12-09 22:25     ` Daniel Vetter
2016-12-09 14:19 ` [PATCH 6/7] drm: Don't walk fb list twice in getresources Daniel Vetter
2016-12-09 21:57   ` Chris Wilson
2016-12-10 21:30     ` [Intel-gfx] " Daniel Vetter
2016-12-09 14:19 ` [PATCH 7/7] drm: Resurrect atomic rmfb code Daniel Vetter
2016-12-09 20:59   ` Daniel Vetter
2016-12-12  8:46     ` Maarten Lankhorst
2016-12-12  9:23       ` Daniel Vetter
2016-12-09 15:27 ` ✗ Fi.CI.BAT: failure for series starting with [1/7] drm/hisilicon: Don't set drm_device->platformdev Patchwork
2016-12-09 20:59   ` Daniel Vetter
2016-12-09 18:04 ` Sean Paul [this message]
2016-12-13  9:20   ` [PATCH 1/7] " Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOw6vbLsSJ1dm9dOJC-Rg+cghrgH-ryUGE6Zawvg2f12WTBPcQ@mail.gmail.com \
    --to=seanpaul@chromium.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=kong.kongxinwei@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.