linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] pinctrl: simplify getting .driver_data
@ 2018-10-21 20:00 Wolfram Sang
  2018-10-21 20:00 ` [PATCH 1/5] pinctrl: intel: pinctrl-baytrail: " Wolfram Sang
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-10-21 20:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-renesas-soc, Wolfram Sang, linux-arm-kernel, linux-gpio

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 have been asked if it couldn't be done for dev_set_drvdata as well. I checked
it and did not find one occasion where it could be simplified like this. Not
much of a surprise because driver_data is usually set in probe() functions
which access struct platform_device in many other ways.

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 (5):
  pinctrl: intel: pinctrl-baytrail: simplify getting .driver_data
  pinctrl: intel: pinctrl-cherryview: simplify getting .driver_data
  pinctrl: intel: pinctrl-intel: simplify getting .driver_data
  pinctrl: pinctrl-amd: simplify getting .driver_data
  pinctrl: pinctrl-at91-pio4: simplify getting .driver_data

 drivers/pinctrl/intel/pinctrl-baytrail.c   | 6 ++----
 drivers/pinctrl/intel/pinctrl-cherryview.c | 6 ++----
 drivers/pinctrl/intel/pinctrl-intel.c      | 6 ++----
 drivers/pinctrl/pinctrl-amd.c              | 6 ++----
 drivers/pinctrl/pinctrl-at91-pio4.c        | 6 ++----
 5 files changed, 10 insertions(+), 20 deletions(-)

-- 
2.19.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/5] pinctrl: intel: pinctrl-baytrail: simplify getting .driver_data
  2018-10-21 20:00 [PATCH 0/5] pinctrl: simplify getting .driver_data Wolfram Sang
@ 2018-10-21 20:00 ` Wolfram Sang
  2018-10-21 21:19   ` Andy Shevchenko
  2018-10-30 13:22   ` Linus Walleij
  2018-10-21 20:00 ` [PATCH 2/5] pinctrl: intel: pinctrl-cherryview: " Wolfram Sang
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-10-21 20:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-renesas-soc, Wolfram Sang, Mika Westerberg,
	Andy Shevchenko, Linus Walleij, linux-gpio

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/pinctrl/intel/pinctrl-baytrail.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 6d1a43c0c251..a1c2548123a1 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -1838,8 +1838,7 @@ static int byt_pinctrl_probe(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int byt_gpio_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct byt_gpio *vg = platform_get_drvdata(pdev);
+	struct byt_gpio *vg = dev_get_drvdata(dev);
 	int i;
 
 	for (i = 0; i < vg->soc_data->npins; i++) {
@@ -1867,8 +1866,7 @@ static int byt_gpio_suspend(struct device *dev)
 
 static int byt_gpio_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct byt_gpio *vg = platform_get_drvdata(pdev);
+	struct byt_gpio *vg = dev_get_drvdata(dev);
 	int i;
 
 	for (i = 0; i < vg->soc_data->npins; i++) {
-- 
2.19.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 2/5] pinctrl: intel: pinctrl-cherryview: simplify getting .driver_data
  2018-10-21 20:00 [PATCH 0/5] pinctrl: simplify getting .driver_data Wolfram Sang
  2018-10-21 20:00 ` [PATCH 1/5] pinctrl: intel: pinctrl-baytrail: " Wolfram Sang
@ 2018-10-21 20:00 ` Wolfram Sang
  2018-10-22  8:17   ` Mika Westerberg
  2018-10-21 20:00 ` [PATCH 3/5] pinctrl: intel: pinctrl-intel: " Wolfram Sang
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 16+ messages in thread
From: Wolfram Sang @ 2018-10-21 20:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-renesas-soc, Wolfram Sang, Mika Westerberg,
	Andy Shevchenko, Linus Walleij, linux-gpio

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/pinctrl/intel/pinctrl-cherryview.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c
index 9b0f4b9ef482..f685abef68c3 100644
--- a/drivers/pinctrl/intel/pinctrl-cherryview.c
+++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
@@ -1744,8 +1744,7 @@ static int chv_pinctrl_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int chv_pinctrl_suspend_noirq(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct chv_pinctrl *pctrl = platform_get_drvdata(pdev);
+	struct chv_pinctrl *pctrl = dev_get_drvdata(dev);
 	unsigned long flags;
 	int i;
 
@@ -1778,8 +1777,7 @@ static int chv_pinctrl_suspend_noirq(struct device *dev)
 
 static int chv_pinctrl_resume_noirq(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct chv_pinctrl *pctrl = platform_get_drvdata(pdev);
+	struct chv_pinctrl *pctrl = dev_get_drvdata(dev);
 	unsigned long flags;
 	int i;
 
-- 
2.19.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 3/5] pinctrl: intel: pinctrl-intel: simplify getting .driver_data
  2018-10-21 20:00 [PATCH 0/5] pinctrl: simplify getting .driver_data Wolfram Sang
  2018-10-21 20:00 ` [PATCH 1/5] pinctrl: intel: pinctrl-baytrail: " Wolfram Sang
  2018-10-21 20:00 ` [PATCH 2/5] pinctrl: intel: pinctrl-cherryview: " Wolfram Sang
@ 2018-10-21 20:00 ` Wolfram Sang
  2018-10-22  8:17   ` Mika Westerberg
  2018-10-21 20:00 ` [PATCH 4/5] pinctrl: pinctrl-amd: " Wolfram Sang
  2018-10-21 20:00 ` [PATCH 5/5] pinctrl: pinctrl-at91-pio4: " Wolfram Sang
  4 siblings, 1 reply; 16+ messages in thread
From: Wolfram Sang @ 2018-10-21 20:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-renesas-soc, Wolfram Sang, Mika Westerberg,
	Andy Shevchenko, Linus Walleij, linux-gpio

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/pinctrl/intel/pinctrl-intel.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 8cda7b535b02..98301750a5b1 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -1469,8 +1469,7 @@ static bool intel_pinctrl_should_save(struct intel_pinctrl *pctrl, unsigned int
 
 int intel_pinctrl_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct intel_pinctrl *pctrl = platform_get_drvdata(pdev);
+	struct intel_pinctrl *pctrl = dev_get_drvdata(dev);
 	struct intel_community_context *communities;
 	struct intel_pad_context *pads;
 	int i;
@@ -1531,8 +1530,7 @@ static void intel_gpio_irq_init(struct intel_pinctrl *pctrl)
 
 int intel_pinctrl_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct intel_pinctrl *pctrl = platform_get_drvdata(pdev);
+	struct intel_pinctrl *pctrl = dev_get_drvdata(dev);
 	const struct intel_community_context *communities;
 	const struct intel_pad_context *pads;
 	int i;
-- 
2.19.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 4/5] pinctrl: pinctrl-amd: simplify getting .driver_data
  2018-10-21 20:00 [PATCH 0/5] pinctrl: simplify getting .driver_data Wolfram Sang
                   ` (2 preceding siblings ...)
  2018-10-21 20:00 ` [PATCH 3/5] pinctrl: intel: pinctrl-intel: " Wolfram Sang
@ 2018-10-21 20:00 ` Wolfram Sang
  2018-10-30 13:16   ` Linus Walleij
  2018-10-21 20:00 ` [PATCH 5/5] pinctrl: pinctrl-at91-pio4: " Wolfram Sang
  4 siblings, 1 reply; 16+ messages in thread
From: Wolfram Sang @ 2018-10-21 20:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-renesas-soc, Wolfram Sang, Linus Walleij, linux-gpio

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/pinctrl/pinctrl-amd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
index 67718b0f978d..2a7d638978d8 100644
--- a/drivers/pinctrl/pinctrl-amd.c
+++ b/drivers/pinctrl/pinctrl-amd.c
@@ -791,8 +791,7 @@ static bool amd_gpio_should_save(struct amd_gpio *gpio_dev, unsigned int pin)
 
 static int amd_gpio_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct amd_gpio *gpio_dev = platform_get_drvdata(pdev);
+	struct amd_gpio *gpio_dev = dev_get_drvdata(dev);
 	struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
 	int i;
 
@@ -810,8 +809,7 @@ static int amd_gpio_suspend(struct device *dev)
 
 static int amd_gpio_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct amd_gpio *gpio_dev = platform_get_drvdata(pdev);
+	struct amd_gpio *gpio_dev = dev_get_drvdata(dev);
 	struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
 	int i;
 
-- 
2.19.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 5/5] pinctrl: pinctrl-at91-pio4: simplify getting .driver_data
  2018-10-21 20:00 [PATCH 0/5] pinctrl: simplify getting .driver_data Wolfram Sang
                   ` (3 preceding siblings ...)
  2018-10-21 20:00 ` [PATCH 4/5] pinctrl: pinctrl-amd: " Wolfram Sang
@ 2018-10-21 20:00 ` Wolfram Sang
  2018-10-24 11:15   ` Alexandre Belloni
                     ` (2 more replies)
  4 siblings, 3 replies; 16+ messages in thread
From: Wolfram Sang @ 2018-10-21 20:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-renesas-soc, Wolfram Sang, Ludovic Desroches,
	Linus Walleij, Nicolas Ferre, Alexandre Belloni,
	linux-arm-kernel, linux-gpio

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/pinctrl/pinctrl-at91-pio4.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
index 5a850491a5cb..4ee135d7b883 100644
--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -868,8 +868,7 @@ static struct pinctrl_desc atmel_pinctrl_desc = {
 
 static int __maybe_unused atmel_pctrl_suspend(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
+	struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(dev);
 	int i, j;
 
 	/*
@@ -897,8 +896,7 @@ static int __maybe_unused atmel_pctrl_suspend(struct device *dev)
 
 static int __maybe_unused atmel_pctrl_resume(struct device *dev)
 {
-	struct platform_device *pdev = to_platform_device(dev);
-	struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
+	struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(dev);
 	int i, j;
 
 	for (i = 0; i < atmel_pioctrl->nbanks; i++) {
-- 
2.19.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/5] pinctrl: intel: pinctrl-baytrail: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 1/5] pinctrl: intel: pinctrl-baytrail: " Wolfram Sang
@ 2018-10-21 21:19   ` Andy Shevchenko
  2018-10-22  8:17     ` Mika Westerberg
  2018-10-30 13:22   ` Linus Walleij
  1 sibling, 1 reply; 16+ messages in thread
From: Andy Shevchenko @ 2018-10-21 21:19 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Mika Westerberg, Linus Walleij,
	linux-gpio

On Sun, Oct 21, 2018 at 10:00:27PM +0200, Wolfram Sang wrote:
> We should get 'driver_data' from 'struct device' directly. Going via
> platform_device is an unneeded step back and forth.
> 

Thanks!

I see only 3 out of 5 patches.

Since we are about to establish a separate tree as well as an additional record
in MAINTAINERS data base for Intel pinctrl driver, I ask you to resend only
Intel related stuff in a separate series.

> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> Build tested only. buildbot is happy.
> 
>  drivers/pinctrl/intel/pinctrl-baytrail.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
> index 6d1a43c0c251..a1c2548123a1 100644
> --- a/drivers/pinctrl/intel/pinctrl-baytrail.c
> +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
> @@ -1838,8 +1838,7 @@ static int byt_pinctrl_probe(struct platform_device *pdev)
>  #ifdef CONFIG_PM_SLEEP
>  static int byt_gpio_suspend(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct byt_gpio *vg = platform_get_drvdata(pdev);
> +	struct byt_gpio *vg = dev_get_drvdata(dev);
>  	int i;
>  
>  	for (i = 0; i < vg->soc_data->npins; i++) {
> @@ -1867,8 +1866,7 @@ static int byt_gpio_suspend(struct device *dev)
>  
>  static int byt_gpio_resume(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct byt_gpio *vg = platform_get_drvdata(pdev);
> +	struct byt_gpio *vg = dev_get_drvdata(dev);
>  	int i;
>  
>  	for (i = 0; i < vg->soc_data->npins; i++) {
> -- 
> 2.19.0
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/5] pinctrl: intel: pinctrl-baytrail: simplify getting .driver_data
  2018-10-21 21:19   ` Andy Shevchenko
@ 2018-10-22  8:17     ` Mika Westerberg
  2018-10-22 10:55       ` Andy Shevchenko
  0 siblings, 1 reply; 16+ messages in thread
From: Mika Westerberg @ 2018-10-22  8:17 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Wolfram Sang, linux-kernel, linux-renesas-soc, Linus Walleij, linux-gpio

On Mon, Oct 22, 2018 at 12:19:51AM +0300, Andy Shevchenko wrote:
> On Sun, Oct 21, 2018 at 10:00:27PM +0200, Wolfram Sang wrote:
> > We should get 'driver_data' from 'struct device' directly. Going via
> > platform_device is an unneeded step back and forth.
> > 
> 
> Thanks!
> 
> I see only 3 out of 5 patches.
> 
> Since we are about to establish a separate tree as well as an additional record
> in MAINTAINERS data base for Intel pinctrl driver, I ask you to resend only
> Intel related stuff in a separate series.

Well, it is easy enough to apply to our tree even if part of larger
series :) So no need to resend anything IMHO.

Looks good to me,

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/5] pinctrl: intel: pinctrl-cherryview: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 2/5] pinctrl: intel: pinctrl-cherryview: " Wolfram Sang
@ 2018-10-22  8:17   ` Mika Westerberg
  0 siblings, 0 replies; 16+ messages in thread
From: Mika Westerberg @ 2018-10-22  8:17 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Andy Shevchenko, Linus Walleij,
	linux-gpio

On Sun, Oct 21, 2018 at 10:00:28PM +0200, Wolfram Sang wrote:
> 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>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/5] pinctrl: intel: pinctrl-intel: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 3/5] pinctrl: intel: pinctrl-intel: " Wolfram Sang
@ 2018-10-22  8:17   ` Mika Westerberg
  0 siblings, 0 replies; 16+ messages in thread
From: Mika Westerberg @ 2018-10-22  8:17 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Andy Shevchenko, Linus Walleij,
	linux-gpio

On Sun, Oct 21, 2018 at 10:00:29PM +0200, Wolfram Sang wrote:
> 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>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/5] pinctrl: intel: pinctrl-baytrail: simplify getting .driver_data
  2018-10-22  8:17     ` Mika Westerberg
@ 2018-10-22 10:55       ` Andy Shevchenko
  0 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2018-10-22 10:55 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Andy Shevchenko, Wolfram Sang, Linux Kernel Mailing List,
	Linux-Renesas, Linus Walleij, open list:GPIO SUBSYSTEM

On Mon, Oct 22, 2018 at 11:51 AM Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> On Mon, Oct 22, 2018 at 12:19:51AM +0300, Andy Shevchenko wrote:
> > On Sun, Oct 21, 2018 at 10:00:27PM +0200, Wolfram Sang wrote:
> > > We should get 'driver_data' from 'struct device' directly. Going via
> > > platform_device is an unneeded step back and forth.

> > Thanks!
> >
> > I see only 3 out of 5 patches.
> >
> > Since we are about to establish a separate tree as well as an additional record
> > in MAINTAINERS data base for Intel pinctrl driver, I ask you to resend only
> > Intel related stuff in a separate series.
>
> Well, it is easy enough to apply to our tree even if part of larger
> series :) So no need to resend anything IMHO.

I think it's slightly harder to sort things out for the more complex
series, anyway, I'm right now talking to Wolfram and he shared how he
did this series. The split is based on records in MAINTAINERS data
base, that's why we have non-Intel parts there. Whenever we push new
record, this automatically fixes the split.

> Looks good to me,
>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Thanks!

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/5] pinctrl: pinctrl-at91-pio4: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 5/5] pinctrl: pinctrl-at91-pio4: " Wolfram Sang
@ 2018-10-24 11:15   ` Alexandre Belloni
  2018-10-29 14:32   ` Ludovic Desroches
  2018-10-30 13:24   ` Linus Walleij
  2 siblings, 0 replies; 16+ messages in thread
From: Alexandre Belloni @ 2018-10-24 11:15 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Ludovic Desroches,
	Linus Walleij, Nicolas Ferre, linux-arm-kernel, linux-gpio

On 21/10/2018 22:00:31+0200, Wolfram Sang wrote:
> 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>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
> 
> Build tested only. buildbot is happy.
> 
>  drivers/pinctrl/pinctrl-at91-pio4.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
> index 5a850491a5cb..4ee135d7b883 100644
> --- a/drivers/pinctrl/pinctrl-at91-pio4.c
> +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
> @@ -868,8 +868,7 @@ static struct pinctrl_desc atmel_pinctrl_desc = {
>  
>  static int __maybe_unused atmel_pctrl_suspend(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
> +	struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(dev);
>  	int i, j;
>  
>  	/*
> @@ -897,8 +896,7 @@ static int __maybe_unused atmel_pctrl_suspend(struct device *dev)
>  
>  static int __maybe_unused atmel_pctrl_resume(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
> +	struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(dev);
>  	int i, j;
>  
>  	for (i = 0; i < atmel_pioctrl->nbanks; i++) {
> -- 
> 2.19.0
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/5] pinctrl: pinctrl-at91-pio4: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 5/5] pinctrl: pinctrl-at91-pio4: " Wolfram Sang
  2018-10-24 11:15   ` Alexandre Belloni
@ 2018-10-29 14:32   ` Ludovic Desroches
  2018-10-30 13:24   ` Linus Walleij
  2 siblings, 0 replies; 16+ messages in thread
From: Ludovic Desroches @ 2018-10-29 14:32 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Linus Walleij, Nicolas Ferre,
	Alexandre Belloni, linux-arm-kernel, linux-gpio

On Sun, Oct 21, 2018 at 10:00:31PM +0200, Wolfram Sang wrote:
> 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>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>

Thanks

> ---
> 
> Build tested only. buildbot is happy.
> 
>  drivers/pinctrl/pinctrl-at91-pio4.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
> index 5a850491a5cb..4ee135d7b883 100644
> --- a/drivers/pinctrl/pinctrl-at91-pio4.c
> +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
> @@ -868,8 +868,7 @@ static struct pinctrl_desc atmel_pinctrl_desc = {
>  
>  static int __maybe_unused atmel_pctrl_suspend(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
> +	struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(dev);
>  	int i, j;
>  
>  	/*
> @@ -897,8 +896,7 @@ static int __maybe_unused atmel_pctrl_suspend(struct device *dev)
>  
>  static int __maybe_unused atmel_pctrl_resume(struct device *dev)
>  {
> -	struct platform_device *pdev = to_platform_device(dev);
> -	struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
> +	struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(dev);
>  	int i, j;
>  
>  	for (i = 0; i < atmel_pioctrl->nbanks; i++) {
> -- 
> 2.19.0
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/5] pinctrl: pinctrl-amd: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 4/5] pinctrl: pinctrl-amd: " Wolfram Sang
@ 2018-10-30 13:16   ` Linus Walleij
  0 siblings, 0 replies; 16+ messages in thread
From: Linus Walleij @ 2018-10-30 13:16 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-kernel, Linux-Renesas, open list:GPIO SUBSYSTEM

On Sun, Oct 21, 2018 at 10:00 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:

> 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>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/5] pinctrl: intel: pinctrl-baytrail: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 1/5] pinctrl: intel: pinctrl-baytrail: " Wolfram Sang
  2018-10-21 21:19   ` Andy Shevchenko
@ 2018-10-30 13:22   ` Linus Walleij
  1 sibling, 0 replies; 16+ messages in thread
From: Linus Walleij @ 2018-10-30 13:22 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-kernel, Linux-Renesas, Mika Westerberg, Andy Shevchenko,
	open list:GPIO SUBSYSTEM

On Sun, Oct 21, 2018 at 10:00 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:

> 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>

Acked-by: Linus Walleij <linus.walleij@linaro.org>
for all 3 Intel patches

Andy is collecting Intel pin control patches so he will
pick these 3 up I think, let me know if all works out!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/5] pinctrl: pinctrl-at91-pio4: simplify getting .driver_data
  2018-10-21 20:00 ` [PATCH 5/5] pinctrl: pinctrl-at91-pio4: " Wolfram Sang
  2018-10-24 11:15   ` Alexandre Belloni
  2018-10-29 14:32   ` Ludovic Desroches
@ 2018-10-30 13:24   ` Linus Walleij
  2 siblings, 0 replies; 16+ messages in thread
From: Linus Walleij @ 2018-10-30 13:24 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-kernel, Linux-Renesas, Ludovic Desroches, Nicolas Ferre,
	Alexandre Belloni, Linux ARM, open list:GPIO SUBSYSTEM

On Sun, Oct 21, 2018 at 10:00 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:

> 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>

Patch applied with the acks.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2018-10-30 13:25 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-21 20:00 [PATCH 0/5] pinctrl: simplify getting .driver_data Wolfram Sang
2018-10-21 20:00 ` [PATCH 1/5] pinctrl: intel: pinctrl-baytrail: " Wolfram Sang
2018-10-21 21:19   ` Andy Shevchenko
2018-10-22  8:17     ` Mika Westerberg
2018-10-22 10:55       ` Andy Shevchenko
2018-10-30 13:22   ` Linus Walleij
2018-10-21 20:00 ` [PATCH 2/5] pinctrl: intel: pinctrl-cherryview: " Wolfram Sang
2018-10-22  8:17   ` Mika Westerberg
2018-10-21 20:00 ` [PATCH 3/5] pinctrl: intel: pinctrl-intel: " Wolfram Sang
2018-10-22  8:17   ` Mika Westerberg
2018-10-21 20:00 ` [PATCH 4/5] pinctrl: pinctrl-amd: " Wolfram Sang
2018-10-30 13:16   ` Linus Walleij
2018-10-21 20:00 ` [PATCH 5/5] pinctrl: pinctrl-at91-pio4: " Wolfram Sang
2018-10-24 11:15   ` Alexandre Belloni
2018-10-29 14:32   ` Ludovic Desroches
2018-10-30 13:24   ` Linus Walleij

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).