drm/hisilicon: Don't set drm_device->platformdev
Subsystems (3)
PATCH 1/1 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 <[email protected]> Date: Wed Aug 17 13:59:40 2016 +0200
Revert "drm/hisilicon: Don't set drm_device->platformdev"
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 11 +++-------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 8 +++----- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 4 ++-- 3 files changed, 8 insertions(+), 15 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +3 -8
@@ -974,9 +974,9 @@ static int ade_dts_parse(struct platform_device *pdev, struct ade_hw_ctx *ctx)return 0 ; } -static int ade_drm_init (struct drm_device *dev) +static int ade_drm_init (struct platform_device *pdev) { -struct platform_device *pdev = dev->platformdev; +struct drm_device *dev =platform_get_drvdata (pdev);struct ade_data *ade;struct ade_hw_ctx *ctx;struct ade_crtc *acrtc;
@@ -1035,13 +1035,8 @@ static int ade_drm_init(struct drm_device *dev)return 0 ; } -static void ade_drm_cleanup (struct drm_device *dev) +static void ade_drm_cleanup (struct platform_device *pdev) { -struct platform_device *pdev = dev->platformdev; -struct ade_data *ade =platform_get_drvdata (pdev); -struct drm_crtc *crtc = &ade->acrtc.base; - -drm_crtc_cleanup (crtc); }const struct kirin_dc_ops ade_dc_ops = {
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +3 -5
@@ -41,7 +41,7 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev)#endif drm_kms_helper_poll_fini (dev);drm_vblank_cleanup (dev); - dc_ops->cleanup (dev); + dc_ops->cleanup (to_platform_device (dev->dev));drm_mode_config_cleanup (dev);devm_kfree (dev->dev, priv); dev->dev_private =NULL ;
@@ -103,7 +103,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)kirin_drm_mode_config_init (dev);/* display controller init */ - ret = dc_ops->init (dev); + ret = dc_ops->init (to_platform_device (dev->dev));if (ret) goto err_mode_config_cleanup;
@@ -137,7 +137,7 @@ static int kirin_drm_kms_init(struct drm_device *dev) err_unbind_all:component_unbind_all (dev->dev, dev); err_dc_cleanup: - dc_ops->cleanup (dev); + dc_ops->cleanup (to_platform_device (dev->dev)); err_mode_config_cleanup:drm_mode_config_cleanup (dev);devm_kfree (dev->dev, priv);
@@ -210,8 +210,6 @@ static int kirin_drm_bind(struct device *dev)if (!drm_dev)return -ENOMEM ; - drm_dev->platformdev =to_platform_device (dev); - ret =kirin_drm_kms_init (drm_dev);if (ret) goto err_drm_dev_unref;
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +2 -2
@@ -15,8 +15,8 @@/* display controller init/cleanup ops */ struct kirin_dc_ops { -int (*init)(struct drm_device *dev); -void (*cleanup)(struct drm_device *dev); +int (*init)(struct platform_device *pdev); +void (*cleanup)(struct platform_device *pdev); };struct kirin_drm_private {
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Xinliang Liu
maintainerHi,
Quoted 42 lines · Daniel Vetter
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_opsreally wants to operate on theplatform_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_datawas never set as drvdata, and callingdrm_crtc_cleanupdirectly is a bug - this is called indirectly throughdrm_mode_config_cleanup, which calls intocrtc->destroy, which already has the call todrm_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
9cd2e854d61ccfa51686f3ed7b0c917708fc641fAuthor: Daniel Vetter <[email protected]> Date: Wed Aug 17 13:59:40 2016 +0200Revert "drm/hisilicon: Don't set drm_device->platformdev"Cc Xinliang Liu <[email protected]>Cc Xinwei Kong <[email protected]>Cc Archit Taneja <[email protected]>Cc Sean Paul <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 11 +++-------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 8 +++----- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 4 ++-- 3 files changed, 8 insertions(+), 15 deletions(-)drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +0
-0
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c static int ade_dts_parse(struct platform_device *pdev, struct ade_hw_ctx *ctx) · line 979
Quoted 8 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +2
-2@@ -974,9 +974,9 @@ static int ade_dts_parse(struct platform_device *pdev, struct ade_hw_ctx *ctx)return 0 ; } -static int ade_drm_init (struct drm_device *dev) +static int ade_drm_init (struct platform_device *pdev) { -struct platform_device *pdev = dev->platformdev; +struct drm_device *dev =platform_get_drvdata (pdev);
if we can get the platformdev here, how about just get pdev here and don't change the parameter of ade_drm_init :
- struct platform_device *pdev = dev->platformdev;
+ struct platform_device *pdev = o_platform_device(dev->dev);
Best,
-xinliang
Quoted 74 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +1
-6struct ade_data *ade;struct ade_hw_ctx *ctx;struct ade_crtc *acrtc;@@ -1035,13 +1035,8 @@ static int ade_drm_init(struct drm_device *dev)return 0 ; } -static void ade_drm_cleanup (struct drm_device *dev) +static void ade_drm_cleanup (struct platform_device *pdev) { -struct platform_device *pdev = dev->platformdev; -struct ade_data *ade =platform_get_drvdata (pdev); -struct drm_crtc *crtc = &ade->acrtc.base; - -drm_crtc_cleanup (crtc); }const struct kirin_dc_ops ade_dc_ops = {drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +3
-5@@ -41,7 +41,7 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev)#endif drm_kms_helper_poll_fini (dev);drm_vblank_cleanup (dev); - dc_ops->cleanup (dev); + dc_ops->cleanup (to_platform_device (dev->dev));drm_mode_config_cleanup (dev);devm_kfree (dev->dev, priv); dev->dev_private =NULL ;@@ -103,7 +103,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)kirin_drm_mode_config_init (dev);/* display controller init */ - ret = dc_ops->init (dev); + ret = dc_ops->init (to_platform_device (dev->dev));if (ret) goto err_mode_config_cleanup;@@ -137,7 +137,7 @@ static int kirin_drm_kms_init(struct drm_device *dev) err_unbind_all:component_unbind_all (dev->dev, dev); err_dc_cleanup: - dc_ops->cleanup (dev); + dc_ops->cleanup (to_platform_device (dev->dev)); err_mode_config_cleanup:drm_mode_config_cleanup (dev);devm_kfree (dev->dev, priv);@@ -210,8 +210,6 @@ static int kirin_drm_bind(struct device *dev)if (!drm_dev)return -ENOMEM ; - drm_dev->platformdev =to_platform_device (dev); - ret =kirin_drm_kms_init (drm_dev);if (ret) goto err_drm_dev_unref;drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +2
-3@@ -15,8 +15,8 @@/* display controller init/cleanup ops */ struct kirin_dc_ops { -int (*init)(struct drm_device *dev); -void (*cleanup)(struct drm_device *dev); +int (*init)(struct platform_device *pdev); +void (*cleanup)(struct platform_device *pdev); };struct kirin_drm_private { --
Quoted 2 lines
2.9.3
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel