History

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

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"

Daniel Vetter committed 9 years ago

Commit 38bf57f1 parent fdd5b873 files · +8 −15Browse files

Unified · Split

3 files
  1. drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +3 −8
  2. drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +3 −5
  3. drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +2 −2
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c+3−8
@@ -973,9 +973,9 @@ static int ade_dts_parse(struct platform_device *pdev, struct ade_hw_ctx *ctx) · 972 unmodified lines
973 return 0;973 return 0;
974}974}
975 975
976static int ade_drm_init(struct drm_device *dev)976static int ade_drm_init(struct platform_device *pdev)
977{977{
978 struct platform_device *pdev = dev->platformdev;978 struct drm_device *dev = platform_get_drvdata(pdev);
979 struct ade_data *ade;979 struct ade_data *ade;
980 struct ade_hw_ctx *ctx;980 struct ade_hw_ctx *ctx;
981 struct ade_crtc *acrtc;981 struct ade_crtc *acrtc;
@@ -1034,13 +1034,8 @@ static int ade_drm_init(struct drm_device *dev) · 52 unmodified lines
1034 return 0;1034 return 0;
1035}1035}
1036 1036
1037static void ade_drm_cleanup(struct drm_device *dev)1037static void ade_drm_cleanup(struct platform_device *pdev)
1038{1038{
1039 struct platform_device *pdev = dev->platformdev;
1040 struct ade_data *ade = platform_get_drvdata(pdev);
1041 struct drm_crtc *crtc = &ade->acrtc.base;
1042
1043 drm_crtc_cleanup(crtc);
1044}1039}
1045 1040
1046const struct kirin_dc_ops ade_dc_ops = {1041const struct kirin_dc_ops ade_dc_ops = {
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c+3−5
@@ -42,7 +42,7 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev) · 41 unmodified lines
42#endif42#endif
43 drm_kms_helper_poll_fini(dev);43 drm_kms_helper_poll_fini(dev);
44 drm_vblank_cleanup(dev);44 drm_vblank_cleanup(dev);
45 dc_ops->cleanup(dev);45 dc_ops->cleanup(to_platform_device(dev->dev));
46 drm_mode_config_cleanup(dev);46 drm_mode_config_cleanup(dev);
47 devm_kfree(dev->dev, priv);47 devm_kfree(dev->dev, priv);
48 dev->dev_private = NULL;48 dev->dev_private = NULL;
@@ -104,7 +104,7 @@ static int kirin_drm_kms_init(struct drm_device *dev) · 55 unmodified lines
104 kirin_drm_mode_config_init(dev);104 kirin_drm_mode_config_init(dev);
105 105
106 /* display controller init */106 /* display controller init */
107 ret = dc_ops->init(dev);107 ret = dc_ops->init(to_platform_device(dev->dev));
108 if (ret)108 if (ret)
109 goto err_mode_config_cleanup;109 goto err_mode_config_cleanup;
110 110
@@ -138,7 +138,7 @@ static int kirin_drm_kms_init(struct drm_device *dev) · 27 unmodified lines
138err_unbind_all:138err_unbind_all:
139 component_unbind_all(dev->dev, dev);139 component_unbind_all(dev->dev, dev);
140err_dc_cleanup:140err_dc_cleanup:
141 dc_ops->cleanup(dev);141 dc_ops->cleanup(to_platform_device(dev->dev));
142err_mode_config_cleanup:142err_mode_config_cleanup:
143 drm_mode_config_cleanup(dev);143 drm_mode_config_cleanup(dev);
144 devm_kfree(dev->dev, priv);144 devm_kfree(dev->dev, priv);
@@ -209,8 +209,6 @@ static int kirin_drm_bind(struct device *dev) · 64 unmodified lines
209 if (IS_ERR(drm_dev))209 if (IS_ERR(drm_dev))
210 return PTR_ERR(drm_dev);210 return PTR_ERR(drm_dev);
211 211
212 drm_dev->platformdev = to_platform_device(dev);
213
214 ret = kirin_drm_kms_init(drm_dev);212 ret = kirin_drm_kms_init(drm_dev);
215 if (ret)213 if (ret)
216 goto err_drm_dev_unref;214 goto err_drm_dev_unref;
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h+2−2
@@ -15,8 +15,8 @@ · 14 unmodified lines
15 15
16/* display controller init/cleanup ops */16/* display controller init/cleanup ops */
17struct kirin_dc_ops {17struct kirin_dc_ops {
18 int (*init)(struct drm_device *dev);18 int (*init)(struct platform_device *pdev);
19 void (*cleanup)(struct drm_device *dev);19 void (*cleanup)(struct platform_device *pdev);
20};20};
21 21
22struct kirin_drm_private {22struct kirin_drm_private {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t