* [PATCH 1/6] dmaengine: at_hdmac: simplify getting .drvdata
2018-04-22 9:14 [PATCH 0/6] tree-wide: simplify getting .drvdata Wolfram Sang
@ 2018-04-22 9:14 ` Wolfram Sang
2018-04-23 5:46 ` Ludovic Desroches
2018-04-22 9:14 ` [PATCH 2/6] dmaengine: at_xdmac: " Wolfram Sang
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2018-04-22 9:14 UTC (permalink / raw)
To: linux-arm-kernel
We should get drvdata 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. Please apply to your tree directly.
drivers/dma/at_hdmac.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index a861b5b4d443..75f38d19fcbe 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -2041,8 +2041,7 @@ static void at_dma_shutdown(struct platform_device *pdev)
static int at_dma_prepare(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct at_dma *atdma = platform_get_drvdata(pdev);
+ struct at_dma *atdma = dev_get_drvdata(dev);
struct dma_chan *chan, *_chan;
list_for_each_entry_safe(chan, _chan, &atdma->dma_common.channels,
@@ -2076,8 +2075,7 @@ static void atc_suspend_cyclic(struct at_dma_chan *atchan)
static int at_dma_suspend_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct at_dma *atdma = platform_get_drvdata(pdev);
+ struct at_dma *atdma = dev_get_drvdata(dev);
struct dma_chan *chan, *_chan;
/* preserve data */
@@ -2118,8 +2116,7 @@ static void atc_resume_cyclic(struct at_dma_chan *atchan)
static int at_dma_resume_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct at_dma *atdma = platform_get_drvdata(pdev);
+ struct at_dma *atdma = dev_get_drvdata(dev);
struct dma_chan *chan, *_chan;
/* bring back DMA controller */
--
2.11.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 1/6] dmaengine: at_hdmac: simplify getting .drvdata
2018-04-22 9:14 ` [PATCH 1/6] dmaengine: at_hdmac: " Wolfram Sang
@ 2018-04-23 5:46 ` Ludovic Desroches
0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Desroches @ 2018-04-23 5:46 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Apr 22, 2018 at 11:14:09AM +0200, Wolfram Sang wrote:
> We should get drvdata 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>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Thanks
> ---
>
> Build tested only. buildbot is happy. Please apply to your tree directly.
>
> drivers/dma/at_hdmac.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index a861b5b4d443..75f38d19fcbe 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -2041,8 +2041,7 @@ static void at_dma_shutdown(struct platform_device *pdev)
>
> static int at_dma_prepare(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct at_dma *atdma = platform_get_drvdata(pdev);
> + struct at_dma *atdma = dev_get_drvdata(dev);
> struct dma_chan *chan, *_chan;
>
> list_for_each_entry_safe(chan, _chan, &atdma->dma_common.channels,
> @@ -2076,8 +2075,7 @@ static void atc_suspend_cyclic(struct at_dma_chan *atchan)
>
> static int at_dma_suspend_noirq(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct at_dma *atdma = platform_get_drvdata(pdev);
> + struct at_dma *atdma = dev_get_drvdata(dev);
> struct dma_chan *chan, *_chan;
>
> /* preserve data */
> @@ -2118,8 +2116,7 @@ static void atc_resume_cyclic(struct at_dma_chan *atchan)
>
> static int at_dma_resume_noirq(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct at_dma *atdma = platform_get_drvdata(pdev);
> + struct at_dma *atdma = dev_get_drvdata(dev);
> struct dma_chan *chan, *_chan;
>
> /* bring back DMA controller */
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/6] dmaengine: at_xdmac: simplify getting .drvdata
2018-04-22 9:14 [PATCH 0/6] tree-wide: simplify getting .drvdata Wolfram Sang
2018-04-22 9:14 ` [PATCH 1/6] dmaengine: at_hdmac: " Wolfram Sang
@ 2018-04-22 9:14 ` Wolfram Sang
2018-04-23 5:46 ` Ludovic Desroches
2018-04-22 9:14 ` [PATCH 5/6] dmaengine: ste_dma40: " Wolfram Sang
2018-04-22 16:11 ` [PATCH 0/6] tree-wide: " Vinod Koul
3 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2018-04-22 9:14 UTC (permalink / raw)
To: linux-arm-kernel
We should get drvdata 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. Please apply to your tree directly.
drivers/dma/at_xdmac.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
index 94236ec9d410..4bf72561667c 100644
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -1833,8 +1833,7 @@ static void at_xdmac_free_chan_resources(struct dma_chan *chan)
#ifdef CONFIG_PM
static int atmel_xdmac_prepare(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct at_xdmac *atxdmac = platform_get_drvdata(pdev);
+ struct at_xdmac *atxdmac = dev_get_drvdata(dev);
struct dma_chan *chan, *_chan;
list_for_each_entry_safe(chan, _chan, &atxdmac->dma.channels, device_node) {
@@ -1853,8 +1852,7 @@ static int atmel_xdmac_prepare(struct device *dev)
#ifdef CONFIG_PM_SLEEP
static int atmel_xdmac_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct at_xdmac *atxdmac = platform_get_drvdata(pdev);
+ struct at_xdmac *atxdmac = dev_get_drvdata(dev);
struct dma_chan *chan, *_chan;
list_for_each_entry_safe(chan, _chan, &atxdmac->dma.channels, device_node) {
@@ -1878,8 +1876,7 @@ static int atmel_xdmac_suspend(struct device *dev)
static int atmel_xdmac_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct at_xdmac *atxdmac = platform_get_drvdata(pdev);
+ struct at_xdmac *atxdmac = dev_get_drvdata(dev);
struct at_xdmac_chan *atchan;
struct dma_chan *chan, *_chan;
int i;
--
2.11.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/6] dmaengine: at_xdmac: simplify getting .drvdata
2018-04-22 9:14 ` [PATCH 2/6] dmaengine: at_xdmac: " Wolfram Sang
@ 2018-04-23 5:46 ` Ludovic Desroches
0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Desroches @ 2018-04-23 5:46 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Apr 22, 2018 at 11:14:10AM +0200, Wolfram Sang wrote:
> We should get drvdata 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>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Thanks
> ---
>
> Build tested only. buildbot is happy. Please apply to your tree directly.
>
> drivers/dma/at_xdmac.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
> index 94236ec9d410..4bf72561667c 100644
> --- a/drivers/dma/at_xdmac.c
> +++ b/drivers/dma/at_xdmac.c
> @@ -1833,8 +1833,7 @@ static void at_xdmac_free_chan_resources(struct dma_chan *chan)
> #ifdef CONFIG_PM
> static int atmel_xdmac_prepare(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct at_xdmac *atxdmac = platform_get_drvdata(pdev);
> + struct at_xdmac *atxdmac = dev_get_drvdata(dev);
> struct dma_chan *chan, *_chan;
>
> list_for_each_entry_safe(chan, _chan, &atxdmac->dma.channels, device_node) {
> @@ -1853,8 +1852,7 @@ static int atmel_xdmac_prepare(struct device *dev)
> #ifdef CONFIG_PM_SLEEP
> static int atmel_xdmac_suspend(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct at_xdmac *atxdmac = platform_get_drvdata(pdev);
> + struct at_xdmac *atxdmac = dev_get_drvdata(dev);
> struct dma_chan *chan, *_chan;
>
> list_for_each_entry_safe(chan, _chan, &atxdmac->dma.channels, device_node) {
> @@ -1878,8 +1876,7 @@ static int atmel_xdmac_suspend(struct device *dev)
>
> static int atmel_xdmac_resume(struct device *dev)
> {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct at_xdmac *atxdmac = platform_get_drvdata(pdev);
> + struct at_xdmac *atxdmac = dev_get_drvdata(dev);
> struct at_xdmac_chan *atchan;
> struct dma_chan *chan, *_chan;
> int i;
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 5/6] dmaengine: ste_dma40: simplify getting .drvdata
2018-04-22 9:14 [PATCH 0/6] tree-wide: simplify getting .drvdata Wolfram Sang
2018-04-22 9:14 ` [PATCH 1/6] dmaengine: at_hdmac: " Wolfram Sang
2018-04-22 9:14 ` [PATCH 2/6] dmaengine: at_xdmac: " Wolfram Sang
@ 2018-04-22 9:14 ` Wolfram Sang
2018-04-22 16:11 ` [PATCH 0/6] tree-wide: " Vinod Koul
3 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2018-04-22 9:14 UTC (permalink / raw)
To: linux-arm-kernel
We should get drvdata 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. Please apply to your tree directly.
drivers/dma/ste_dma40.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index c2b089af0420..1bc149af990e 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -2889,8 +2889,7 @@ static int __init d40_dmaengine_init(struct d40_base *base,
#ifdef CONFIG_PM_SLEEP
static int dma40_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct d40_base *base = platform_get_drvdata(pdev);
+ struct d40_base *base = dev_get_drvdata(dev);
int ret;
ret = pm_runtime_force_suspend(dev);
@@ -2904,8 +2903,7 @@ static int dma40_suspend(struct device *dev)
static int dma40_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct d40_base *base = platform_get_drvdata(pdev);
+ struct d40_base *base = dev_get_drvdata(dev);
int ret = 0;
if (base->lcpa_regulator) {
@@ -2970,8 +2968,7 @@ static void d40_save_restore_registers(struct d40_base *base, bool save)
static int dma40_runtime_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct d40_base *base = platform_get_drvdata(pdev);
+ struct d40_base *base = dev_get_drvdata(dev);
d40_save_restore_registers(base, true);
@@ -2985,8 +2982,7 @@ static int dma40_runtime_suspend(struct device *dev)
static int dma40_runtime_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct d40_base *base = platform_get_drvdata(pdev);
+ struct d40_base *base = dev_get_drvdata(dev);
d40_save_restore_registers(base, false);
--
2.11.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 0/6] tree-wide: simplify getting .drvdata
2018-04-22 9:14 [PATCH 0/6] tree-wide: simplify getting .drvdata Wolfram Sang
` (2 preceding siblings ...)
2018-04-22 9:14 ` [PATCH 5/6] dmaengine: ste_dma40: " Wolfram Sang
@ 2018-04-22 16:11 ` Vinod Koul
3 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2018-04-22 16:11 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Apr 22, 2018 at 11:14:08AM +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);
>
> I send this out as one patch per directory per subsystem. I think they should
> be applied individually. If you prefer a broken out series per subsystem, I can
> provide this as well. Just mail me.
Applied all, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 7+ messages in thread