* [PATCH 0/9] treewide: simplify getting .driver_data
@ 2021-09-20 9:05 Wolfram Sang
2021-09-20 9:05 ` [PATCH 9/9] remoteproc: omap_remoteproc: " Wolfram Sang
2021-10-15 17:22 ` [PATCH 0/9] treewide: " Bjorn Andersson
0 siblings, 2 replies; 3+ messages in thread
From: Wolfram Sang @ 2021-09-20 9:05 UTC (permalink / raw)
To: linux-kernel
Cc: linux-renesas-soc, Wolfram Sang, dmaengine, dri-devel, freedreno,
linux-amlogic, linux-arm-kernel, linux-arm-msm, linux-gpio,
linux-iio, linux-remoteproc, linux-stm32, netdev
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 9/9] remoteproc: omap_remoteproc: simplify getting .driver_data
2021-09-20 9:05 [PATCH 0/9] treewide: simplify getting .driver_data Wolfram Sang
@ 2021-09-20 9:05 ` Wolfram Sang
2021-10-15 17:22 ` [PATCH 0/9] treewide: " Bjorn Andersson
1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2021-09-20 9:05 UTC (permalink / raw)
To: linux-kernel
Cc: linux-renesas-soc, Wolfram Sang, Ohad Ben-Cohen, Bjorn Andersson,
Mathieu Poirier, linux-remoteproc
We should get 'driver_data' from 'struct device' directly. Going via
platform_device is an unneeded step back and forth.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Build tested only. buildbot is happy.
drivers/remoteproc/omap_remoteproc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c
index 43531caa1959..32a588fefbdc 100644
--- a/drivers/remoteproc/omap_remoteproc.c
+++ b/drivers/remoteproc/omap_remoteproc.c
@@ -901,8 +901,7 @@ static int _omap_rproc_resume(struct rproc *rproc, bool auto_suspend)
static int __maybe_unused omap_rproc_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rproc *rproc = platform_get_drvdata(pdev);
+ struct rproc *rproc = dev_get_drvdata(dev);
struct omap_rproc *oproc = rproc->priv;
int ret = 0;
@@ -938,8 +937,7 @@ static int __maybe_unused omap_rproc_suspend(struct device *dev)
static int __maybe_unused omap_rproc_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct rproc *rproc = platform_get_drvdata(pdev);
+ struct rproc *rproc = dev_get_drvdata(dev);
struct omap_rproc *oproc = rproc->priv;
int ret = 0;
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 0/9] treewide: simplify getting .driver_data
2021-09-20 9:05 [PATCH 0/9] treewide: simplify getting .driver_data Wolfram Sang
2021-09-20 9:05 ` [PATCH 9/9] remoteproc: omap_remoteproc: " Wolfram Sang
@ 2021-10-15 17:22 ` Bjorn Andersson
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2021-10-15 17:22 UTC (permalink / raw)
To: Wolfram Sang, linux-kernel
Cc: dmaengine, dri-devel, linux-stm32, linux-gpio, freedreno,
linux-renesas-soc, linux-amlogic, linux-remoteproc,
linux-arm-kernel, netdev, linux-iio, linux-arm-msm
On Mon, 20 Sep 2021 11:05:12 +0200, Wolfram Sang wrote:
> 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);
>
> [...]
Applied, thanks!
[1/9] dmaengine: stm32-dmamux: simplify getting .driver_data
(no commit info)
[2/9] firmware: meson: simplify getting .driver_data
(no commit info)
[3/9] gpio: xilinx: simplify getting .driver_data
(no commit info)
[4/9] drm/msm: simplify getting .driver_data
(no commit info)
[5/9] drm/panfrost: simplify getting .driver_data
(no commit info)
[6/9] iio: common: cros_ec_sensors: simplify getting .driver_data
(no commit info)
[7/9] net: mdio: mdio-bcm-iproc: simplify getting .driver_data
(no commit info)
[8/9] platform: chrome: cros_ec_sensorhub: simplify getting .driver_data
(no commit info)
[9/9] remoteproc: omap_remoteproc: simplify getting .driver_data
commit: c34bfafd7c6ce8bdb5205aa990973b6ec7a6557c
Best regards,
--
Bjorn Andersson <bjorn.andersson@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-15 17:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20 9:05 [PATCH 0/9] treewide: simplify getting .driver_data Wolfram Sang
2021-09-20 9:05 ` [PATCH 9/9] remoteproc: omap_remoteproc: " Wolfram Sang
2021-10-15 17:22 ` [PATCH 0/9] treewide: " Bjorn Andersson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).