From: Wolfram Sang <wsa+renesas@sang-engineering.com> Date: 2021-09-20 09:06:58
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/net/mdio/mdio-bcm-iproc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
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/net/mdio/mdio-bcm-iproc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
@@ -181,8 +181,7 @@ static int iproc_mdio_remove(struct platform_device *pdev)#ifdef CONFIG_PM_SLEEPstaticintiproc_mdio_resume(structdevice*dev){-structplatform_device*pdev=to_platform_device(dev);-structiproc_mdio_priv*priv=platform_get_drvdata(pdev);+structiproc_mdio_priv*priv=dev_get_drvdata(dev);
The change looks good to me, however if you change from
platform_get_drvdata() to dev_get_drvdata(), you might also want to
change from using platform_set_drvdata() to dev_set_drvdata() for
symmetry no? If not, then maybe this patch should be dropped?
--
Florian
From: Wolfram Sang <wsa+renesas@sang-engineering.com> Date: 2021-09-21 05:52:29
The change looks good to me, however if you change from
platform_get_drvdata() to dev_get_drvdata(), you might also want to
change from using platform_set_drvdata() to dev_set_drvdata() for
symmetry no? If not, then maybe this patch should be dropped?
In theory, yes. However, I haven't finished the coccinelle script yet
because there are a lot more usage patterns. I can do this individually
for this driver first if you want.
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 [off-list ref]