Commit a16d4f86 authored by Thierry Reding's avatar Thierry Reding Committed by Dave Airlie

drm: platform: Don't initialize driver-private data

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.
Signed-off-by: default avatarThierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 08bce0ac
...@@ -64,7 +64,6 @@ int drm_get_platform_dev(struct platform_device *platdev, ...@@ -64,7 +64,6 @@ int drm_get_platform_dev(struct platform_device *platdev,
} }
if (drm_core_check_feature(dev, DRIVER_MODESET)) { if (drm_core_check_feature(dev, DRIVER_MODESET)) {
dev_set_drvdata(&platdev->dev, dev);
ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL); ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL);
if (ret) if (ret)
goto err_g1; goto err_g1;
......
...@@ -201,6 +201,8 @@ static int shmob_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -201,6 +201,8 @@ static int shmob_drm_load(struct drm_device *dev, unsigned long flags)
goto done; goto done;
} }
platform_set_drvdata(pdev, sdev);
done: done:
if (ret) if (ret)
shmob_drm_unload(dev); shmob_drm_unload(dev);
...@@ -299,11 +301,9 @@ static struct drm_driver shmob_drm_driver = { ...@@ -299,11 +301,9 @@ static struct drm_driver shmob_drm_driver = {
#if CONFIG_PM_SLEEP #if CONFIG_PM_SLEEP
static int shmob_drm_pm_suspend(struct device *dev) static int shmob_drm_pm_suspend(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct shmob_drm_device *sdev = dev_get_drvdata(dev);
struct drm_device *ddev = platform_get_drvdata(pdev);
struct shmob_drm_device *sdev = ddev->dev_private;
drm_kms_helper_poll_disable(ddev); drm_kms_helper_poll_disable(sdev->ddev);
shmob_drm_crtc_suspend(&sdev->crtc); shmob_drm_crtc_suspend(&sdev->crtc);
return 0; return 0;
...@@ -311,9 +311,7 @@ static int shmob_drm_pm_suspend(struct device *dev) ...@@ -311,9 +311,7 @@ static int shmob_drm_pm_suspend(struct device *dev)
static int shmob_drm_pm_resume(struct device *dev) static int shmob_drm_pm_resume(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct shmob_drm_device *sdev = dev_get_drvdata(dev);
struct drm_device *ddev = platform_get_drvdata(pdev);
struct shmob_drm_device *sdev = ddev->dev_private;
mutex_lock(&sdev->ddev->mode_config.mutex); mutex_lock(&sdev->ddev->mode_config.mutex);
shmob_drm_crtc_resume(&sdev->crtc); shmob_drm_crtc_resume(&sdev->crtc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment