From: Wolfram Sang <wsa+renesas@sang-engineering.com> Date: 2021-09-20 09:06:19
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/dma/stm32-dmamux.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
@@ -305,8 +305,7 @@ static int stm32_dmamux_probe(struct platform_device *pdev)#ifdef CONFIG_PMstaticintstm32_dmamux_runtime_suspend(structdevice*dev){-structplatform_device*pdev=to_platform_device(dev);-structstm32_dmamux_data*stm32_dmamux=platform_get_drvdata(pdev);+structstm32_dmamux_data*stm32_dmamux=dev_get_drvdata(dev);clk_disable_unprepare(stm32_dmamux->clk);
@@ -315,13 +314,12 @@ static int stm32_dmamux_runtime_suspend(struct device *dev)staticintstm32_dmamux_runtime_resume(structdevice*dev){-structplatform_device*pdev=to_platform_device(dev);-structstm32_dmamux_data*stm32_dmamux=platform_get_drvdata(pdev);+structstm32_dmamux_data*stm32_dmamux=dev_get_drvdata(dev);intret;ret=clk_prepare_enable(stm32_dmamux->clk);if(ret){-dev_err(&pdev->dev,"failed to prepare_enable clock\n");+dev_err(dev,"failed to prepare_enable clock\n");returnret;}
@@ -332,8 +330,7 @@ static int stm32_dmamux_runtime_resume(struct device *dev)#ifdef CONFIG_PM_SLEEPstaticintstm32_dmamux_suspend(structdevice*dev){-structplatform_device*pdev=to_platform_device(dev);-structstm32_dmamux_data*stm32_dmamux=platform_get_drvdata(pdev);+structstm32_dmamux_data*stm32_dmamux=dev_get_drvdata(dev);inti,ret;ret=pm_runtime_resume_and_get(dev);
@@ -353,8 +350,7 @@ static int stm32_dmamux_suspend(struct device *dev)staticintstm32_dmamux_resume(structdevice*dev){-structplatform_device*pdev=to_platform_device(dev);-structstm32_dmamux_data*stm32_dmamux=platform_get_drvdata(pdev);+structstm32_dmamux_data*stm32_dmamux=dev_get_drvdata(dev);inti,ret;ret=pm_runtime_force_resume(dev);
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Wolfram Sang <wsa+renesas@sang-engineering.com> Date: 2021-09-20 09:06:40
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/gpio/gpio-xilinx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
From: Wolfram Sang <wsa+renesas@sang-engineering.com> Date: 2021-09-20 09:06:56
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/firmware/meson/meson_sm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
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(-)
From: Neil Armstrong <hidden> Date: 2021-09-20 12:22:46
On 20/09/2021 11:05, Wolfram Sang wrote:
quoted hunk
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/firmware/meson/meson_sm.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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
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, Sep 20, 2021 at 11:05 AM Wolfram Sang
[off-list ref] wrote:
quoted hunk
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/gpio/gpio-xilinx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
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]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel