[Freedreno] [PATCH 0/9] treewide: simplify getting .driver_data
Wolfram Sang
wsa+renesas at sang-engineering.com
Mon Sep 20 09:05:12 UTC 2021
I got tired of fixing this in Renesas drivers manually, so I took the big
hammer. Remove this cumbersome code pattern which got copy-pasted too much
already:
- struct platform_device *pdev = to_platform_device(dev);
- struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
+ struct ep93xx_keypad *keypad = dev_get_drvdata(dev);
A branch, tested by buildbot, can be found here:
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git coccinelle/get_drvdata
I am open for other comments, suggestions, too, of course.
Here is the cocci-script I created:
@@
struct device* d;
identifier pdev;
expression *ptr;
@@
(
- struct platform_device *pdev = to_platform_device(d);
|
- struct platform_device *pdev;
...
- pdev = to_platform_device(d);
)
<... when != pdev
- &pdev->dev
+ d
...>
ptr =
- platform_get_drvdata(pdev)
+ dev_get_drvdata(d)
<... when != pdev
- &pdev->dev
+ d
...>
Kind regards,
Wolfram
Wolfram Sang (9):
dmaengine: stm32-dmamux: simplify getting .driver_data
firmware: meson: simplify getting .driver_data
gpio: xilinx: simplify getting .driver_data
drm/msm: simplify getting .driver_data
drm/panfrost: simplify getting .driver_data
iio: common: cros_ec_sensors: simplify getting .driver_data
net: mdio: mdio-bcm-iproc: simplify getting .driver_data
platform: chrome: cros_ec_sensorhub: simplify getting .driver_data
remoteproc: omap_remoteproc: simplify getting .driver_data
drivers/dma/stm32-dmamux.c | 14 +++++---------
drivers/firmware/meson/meson_sm.c | 3 +--
drivers/gpio/gpio-xilinx.c | 6 ++----
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 13 +++++--------
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 6 ++----
drivers/gpu/drm/msm/dp/dp_display.c | 6 ++----
drivers/gpu/drm/msm/dsi/dsi_host.c | 6 ++----
drivers/gpu/drm/msm/msm_drv.c | 3 +--
drivers/gpu/drm/panfrost/panfrost_device.c | 6 ++----
.../common/cros_ec_sensors/cros_ec_sensors_core.c | 3 +--
drivers/net/mdio/mdio-bcm-iproc.c | 3 +--
drivers/platform/chrome/cros_ec_sensorhub.c | 6 ++----
drivers/remoteproc/omap_remoteproc.c | 6 ++----
13 files changed, 28 insertions(+), 53 deletions(-)
--
2.30.2
More information about the Freedreno
mailing list