Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

Thierry Reding and committed by
Dave Airlie
a16d4f86 08bce0ac

+5 -8
-1
drivers/gpu/drm/drm_platform.c
··· 64 64 } 65 65 66 66 if (drm_core_check_feature(dev, DRIVER_MODESET)) { 67 - dev_set_drvdata(&platdev->dev, dev); 68 67 ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL); 69 68 if (ret) 70 69 goto err_g1;
+5 -7
drivers/gpu/drm/shmobile/shmob_drm_drv.c
··· 201 201 goto done; 202 202 } 203 203 204 + platform_set_drvdata(pdev, sdev); 205 + 204 206 done: 205 207 if (ret) 206 208 shmob_drm_unload(dev); ··· 301 299 #if CONFIG_PM_SLEEP 302 300 static int shmob_drm_pm_suspend(struct device *dev) 303 301 { 304 - struct platform_device *pdev = to_platform_device(dev); 305 - struct drm_device *ddev = platform_get_drvdata(pdev); 306 - struct shmob_drm_device *sdev = ddev->dev_private; 302 + struct shmob_drm_device *sdev = dev_get_drvdata(dev); 307 303 308 - drm_kms_helper_poll_disable(ddev); 304 + drm_kms_helper_poll_disable(sdev->ddev); 309 305 shmob_drm_crtc_suspend(&sdev->crtc); 310 306 311 307 return 0; ··· 311 311 312 312 static int shmob_drm_pm_resume(struct device *dev) 313 313 { 314 - struct platform_device *pdev = to_platform_device(dev); 315 - struct drm_device *ddev = platform_get_drvdata(pdev); 316 - struct shmob_drm_device *sdev = ddev->dev_private; 314 + struct shmob_drm_device *sdev = dev_get_drvdata(dev); 317 315 318 316 mutex_lock(&sdev->ddev->mode_config.mutex); 319 317 shmob_drm_crtc_resume(&sdev->crtc);