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
973973 return 0;
974974 }
975975
976−static int ade_drm_init(struct drm_device *dev)
976+static int ade_drm_init(struct platform_device *pdev)
977977 {
978− struct platform_device *pdev = dev->platformdev;
978+ struct drm_device *dev = platform_get_drvdata(pdev);
979979 struct ade_data *ade;
980980 struct ade_hw_ctx *ctx;
981981 struct ade_crtc *acrtc;
@@ -1034,13 +1034,8 @@ static int ade_drm_init(struct drm_device *dev) · 52 unmodified lines
10341034 return 0;
10351035 }
10361036
1037−static void ade_drm_cleanup(struct drm_device *dev)
1037+static void ade_drm_cleanup(struct platform_device *pdev)
10381038 {
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);
10441039 }
10451040
10461041 const 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
4242 #endif
4343 drm_kms_helper_poll_fini(dev);
4444 drm_vblank_cleanup(dev);
45− dc_ops->cleanup(dev);
45+ dc_ops->cleanup(to_platform_device(dev->dev));
4646 drm_mode_config_cleanup(dev);
4747 devm_kfree(dev->dev, priv);
4848 dev->dev_private = NULL;
@@ -104,7 +104,7 @@ static int kirin_drm_kms_init(struct drm_device *dev) · 55 unmodified lines
104104 kirin_drm_mode_config_init(dev);
105105
106106 /* display controller init */
107− ret = dc_ops->init(dev);
107+ ret = dc_ops->init(to_platform_device(dev->dev));
108108 if (ret)
109109 goto err_mode_config_cleanup;
110110
@@ -138,7 +138,7 @@ static int kirin_drm_kms_init(struct drm_device *dev) · 27 unmodified lines
138138 err_unbind_all:
139139 component_unbind_all(dev->dev, dev);
140140 err_dc_cleanup:
141− dc_ops->cleanup(dev);
141+ dc_ops->cleanup(to_platform_device(dev->dev));
142142 err_mode_config_cleanup:
143143 drm_mode_config_cleanup(dev);
144144 devm_kfree(dev->dev, priv);
@@ -209,8 +209,6 @@ static int kirin_drm_bind(struct device *dev) · 64 unmodified lines
209209 if (IS_ERR(drm_dev))
210210 return PTR_ERR(drm_dev);
211211
212− drm_dev->platformdev = to_platform_device(dev);
213−
214212 ret = kirin_drm_kms_init(drm_dev);
215213 if (ret)
216214 goto err_drm_dev_unref;
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h+2−2
@@ -15,8 +15,8 @@ · 14 unmodified lines
1515
1616 /* display controller init/cleanup ops */
1717 struct kirin_dc_ops {
18− int (*init)(struct drm_device *dev);
19− void (*cleanup)(struct drm_device *dev);
18+ int (*init)(struct platform_device *pdev);
19+ void (*cleanup)(struct platform_device *pdev);
2020 };
2121
2222 struct 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