* [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
` (5 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Wolfram Sang @ 2018-04-22 9:14 UTC (permalink / raw)
To: dmaengine
Cc: Wolfram Sang, Ludovic Desroches, Dan Williams, Vinod Koul,
linux-arm-kernel, linux-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] 10+ messages in thread* Re: [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; 10+ messages in thread
From: Ludovic Desroches @ 2018-04-23 5:46 UTC (permalink / raw)
To: Wolfram Sang
Cc: dmaengine, Ludovic Desroches, Dan Williams, Vinod Koul,
linux-arm-kernel, linux-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] 10+ 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 3/6] dmaengine: fsldma: " Wolfram Sang
` (4 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Wolfram Sang @ 2018-04-22 9:14 UTC (permalink / raw)
To: dmaengine
Cc: Wolfram Sang, Ludovic Desroches, Vinod Koul, Dan Williams,
linux-arm-kernel, linux-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] 10+ messages in thread* Re: [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; 10+ messages in thread
From: Ludovic Desroches @ 2018-04-23 5:46 UTC (permalink / raw)
To: Wolfram Sang
Cc: dmaengine, Ludovic Desroches, Vinod Koul, Dan Williams,
linux-arm-kernel, linux-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] 10+ messages in thread
* [PATCH 3/6] dmaengine: fsldma: 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 9:14 ` [PATCH 4/6] dmaengine: idma64: " Wolfram Sang
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2018-04-22 9:14 UTC (permalink / raw)
To: dmaengine
Cc: Wolfram Sang, Li Yang, Zhang Wei, Vinod Koul, Dan Williams,
linuxppc-dev, linux-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/fsldma.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 3eaece888e75..1117b5123a6f 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -1328,8 +1328,7 @@ static int fsldma_of_remove(struct platform_device *op)
#ifdef CONFIG_PM
static int fsldma_suspend_late(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct fsldma_device *fdev = platform_get_drvdata(pdev);
+ struct fsldma_device *fdev = dev_get_drvdata(dev);
struct fsldma_chan *chan;
int i;
@@ -1360,8 +1359,7 @@ static int fsldma_suspend_late(struct device *dev)
static int fsldma_resume_early(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct fsldma_device *fdev = platform_get_drvdata(pdev);
+ struct fsldma_device *fdev = dev_get_drvdata(dev);
struct fsldma_chan *chan;
u32 mode;
int i;
--
2.11.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 4/6] dmaengine: idma64: 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 3/6] dmaengine: fsldma: " Wolfram Sang
@ 2018-04-22 9:14 ` Wolfram Sang
2018-04-22 9:14 ` [PATCH 5/6] dmaengine: ste_dma40: " Wolfram Sang
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2018-04-22 9:14 UTC (permalink / raw)
To: dmaengine; +Cc: Wolfram Sang, Vinod Koul, Dan Williams, linux-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/idma64.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c
index 1953e57505f4..e5c911200bdb 100644
--- a/drivers/dma/idma64.c
+++ b/drivers/dma/idma64.c
@@ -670,8 +670,7 @@ static int idma64_platform_remove(struct platform_device *pdev)
static int idma64_pm_suspend(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct idma64_chip *chip = platform_get_drvdata(pdev);
+ struct idma64_chip *chip = dev_get_drvdata(dev);
idma64_off(chip->idma64);
return 0;
@@ -679,8 +678,7 @@ static int idma64_pm_suspend(struct device *dev)
static int idma64_pm_resume(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct idma64_chip *chip = platform_get_drvdata(pdev);
+ struct idma64_chip *chip = dev_get_drvdata(dev);
idma64_on(chip->idma64);
return 0;
--
2.11.0
^ permalink raw reply related [flat|nested] 10+ 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
` (3 preceding siblings ...)
2018-04-22 9:14 ` [PATCH 4/6] dmaengine: idma64: " Wolfram Sang
@ 2018-04-22 9:14 ` Wolfram Sang
2018-04-22 9:14 ` [PATCH 6/6] dmaengine: txx9dmac: " Wolfram Sang
2018-04-22 16:11 ` [PATCH 0/6] tree-wide: " Vinod Koul
6 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2018-04-22 9:14 UTC (permalink / raw)
To: dmaengine
Cc: Wolfram Sang, Linus Walleij, Dan Williams, Vinod Koul,
linux-arm-kernel, linux-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] 10+ messages in thread* [PATCH 6/6] dmaengine: txx9dmac: simplify getting .drvdata
2018-04-22 9:14 [PATCH 0/6] tree-wide: simplify getting .drvdata Wolfram Sang
` (4 preceding siblings ...)
2018-04-22 9:14 ` [PATCH 5/6] dmaengine: ste_dma40: " Wolfram Sang
@ 2018-04-22 9:14 ` Wolfram Sang
2018-04-22 16:11 ` [PATCH 0/6] tree-wide: " Vinod Koul
6 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2018-04-22 9:14 UTC (permalink / raw)
To: dmaengine; +Cc: Wolfram Sang, Dan Williams, Vinod Koul, linux-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/txx9dmac.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c
index 4d8c7b9078fd..eb45af71d3a3 100644
--- a/drivers/dma/txx9dmac.c
+++ b/drivers/dma/txx9dmac.c
@@ -1244,8 +1244,7 @@ static void txx9dmac_shutdown(struct platform_device *pdev)
static int txx9dmac_suspend_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct txx9dmac_dev *ddev = platform_get_drvdata(pdev);
+ struct txx9dmac_dev *ddev = dev_get_drvdata(dev);
txx9dmac_off(ddev);
return 0;
@@ -1253,9 +1252,8 @@ static int txx9dmac_suspend_noirq(struct device *dev)
static int txx9dmac_resume_noirq(struct device *dev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct txx9dmac_dev *ddev = platform_get_drvdata(pdev);
- struct txx9dmac_platform_data *pdata = dev_get_platdata(&pdev->dev);
+ struct txx9dmac_dev *ddev = dev_get_drvdata(dev);
+ struct txx9dmac_platform_data *pdata = dev_get_platdata(dev);
u32 mcr;
mcr = TXX9_DMA_MCR_MSTEN | MCR_LE;
--
2.11.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 0/6] tree-wide: simplify getting .drvdata
2018-04-22 9:14 [PATCH 0/6] tree-wide: simplify getting .drvdata Wolfram Sang
` (5 preceding siblings ...)
2018-04-22 9:14 ` [PATCH 6/6] dmaengine: txx9dmac: " Wolfram Sang
@ 2018-04-22 16:11 ` Vinod Koul
6 siblings, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2018-04-22 16:11 UTC (permalink / raw)
To: Wolfram Sang; +Cc: dmaengine, linux-arm-kernel, linux-kernel, linuxppc-dev
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] 10+ messages in thread