[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210920090522.23784-1-wsa+renesas@sang-engineering.com>
Date: Mon, 20 Sep 2021 11:05:12 +0200
From: Wolfram Sang <wsa+renesas@...g-engineering.com>
To: linux-kernel@...r.kernel.org
Cc: linux-renesas-soc@...r.kernel.org,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
dmaengine@...r.kernel.org, dri-devel@...ts.freedesktop.org,
freedreno@...ts.freedesktop.org, linux-amlogic@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
linux-arm-msm@...r.kernel.org, linux-gpio@...r.kernel.org,
linux-iio@...r.kernel.org, linux-remoteproc@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com, netdev@...r.kernel.org
Subject: [PATCH 0/9] treewide: simplify getting .driver_data
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
Powered by blists - more mailing lists