dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Thierry Reding <thierry.reding@avionic-design.de>
Cc: David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm: platform: Don't initialize driver-private data
Date: Fri, 26 Oct 2012 16:06:27 +0200	[thread overview]
Message-ID: <15899660.S8avMzQBpd@avalon> (raw)
In-Reply-To: <1350324222-26885-1-git-send-email-thierry.reding@avionic-design.de>

Hi Thierry,

Thank you for the patch, and sorry for the late reply.

On Monday 15 October 2012 20:03:42 Thierry Reding wrote:
> Platform device drivers usually use the driver-private data for their
> own purposes. Having it overwritten by drm_platform_init() is confusing
> and error-prone.

If you want to push drivers that way, you should get rid of the 
pci_set_drvdata() call in core DRM as well. This would push device driver data 
handling down to all drivers, so I'm not convinced it would actually make 
things simpler.

> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>

Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

But I'm not convinced by the patch, as explained above.

> ---
> Note that I don't have any hardware to test the shmobile changes on so
> it would be good to get a Tested-by for that.
> 
>  drivers/gpu/drm/drm_platform.c           |  1 -
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c | 12 +++++-------
>  2 files changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
> index aaeb6f8..b8a282e 100644
> --- a/drivers/gpu/drm/drm_platform.c
> +++ b/drivers/gpu/drm/drm_platform.c
> @@ -64,7 +64,6 @@ int drm_get_platform_dev(struct platform_device *platdev,
>  	}
> 
>  	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> -		dev_set_drvdata(&platdev->dev, dev);
>  		ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL);
>  		if (ret)
>  			goto err_g1;
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> b/drivers/gpu/drm/shmobile/shmob_drm_drv.c index c71d493..1c350fc 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> @@ -201,6 +201,8 @@ static int shmob_drm_load(struct drm_device *dev,
> unsigned long flags) goto done;
>  	}
> 
> +	platform_set_drvdata(pdev, sdev);
> +
>  done:
>  	if (ret)
>  		shmob_drm_unload(dev);
> @@ -299,11 +301,9 @@ static struct drm_driver shmob_drm_driver = {
>  #if CONFIG_PM_SLEEP
>  static int shmob_drm_pm_suspend(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct drm_device *ddev = platform_get_drvdata(pdev);
> -	struct shmob_drm_device *sdev = ddev->dev_private;
> +	struct shmob_drm_device *sdev = dev_get_drvdata(dev);
> 
> -	drm_kms_helper_poll_disable(ddev);
> +	drm_kms_helper_poll_disable(sdev->ddev);
>  	shmob_drm_crtc_suspend(&sdev->crtc);
> 
>  	return 0;
> @@ -311,9 +311,7 @@ static int shmob_drm_pm_suspend(struct device *dev)
> 
>  static int shmob_drm_pm_resume(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct drm_device *ddev = platform_get_drvdata(pdev);
> -	struct shmob_drm_device *sdev = ddev->dev_private;
> +	struct shmob_drm_device *sdev = dev_get_drvdata(dev);
> 
>  	mutex_lock(&sdev->ddev->mode_config.mutex);
>  	shmob_drm_crtc_resume(&sdev->crtc);

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2012-10-26 14:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-15 18:03 [PATCH] drm: platform: Don't initialize driver-private data Thierry Reding
2012-10-26 14:06 ` Laurent Pinchart [this message]
2012-10-31  8:26   ` Thierry Reding
2012-10-31  8:31     ` Laurent Pinchart
2012-10-31  8:50       ` Thierry Reding

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=15899660.S8avMzQBpd@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thierry.reding@avionic-design.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).