Patchwork gpio: (gpio-pca953x) move header to linux/platform_data/

login
register
mail settings
Submitter Vivien Didelot
Date July 31, 2013, 8:57 p.m.
Message ID <1375304231-27281-1-git-send-email-vivien.didelot@savoirfairelinux.com>
Download mbox | patch
Permalink /patch/263802/
State New
Headers show

Comments

Vivien Didelot - July 31, 2013, 8:57 p.m.
This patch moves the pca953x.h header from include/linux/i2c to
include/linux/platform_data and updates existing support accordingly.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 arch/arm/mach-at91/board-snapper9260.c      |  2 +-
 arch/arm/mach-davinci/board-da850-evm.c     |  2 +-
 arch/arm/mach-ep93xx/vision_ep9307.c        |  2 +-
 arch/arm/mach-imx/mach-imx27_visstrim_m10.c |  2 +-
 arch/arm/mach-imx/mach-mxt_td60.c           |  2 +-
 arch/arm/mach-ks8695/board-acs5k.c          |  2 +-
 arch/arm/mach-mmp/ttc_dkb.c                 |  2 +-
 arch/arm/mach-omap2/board-am3517evm.c       |  2 +-
 arch/arm/mach-pxa/cm-x300.c                 |  2 +-
 arch/arm/mach-pxa/em-x270.c                 |  2 +-
 arch/arm/mach-pxa/pcm990-baseboard.c        |  2 +-
 arch/arm/mach-pxa/spitz.c                   |  2 +-
 arch/arm/mach-pxa/zeus.c                    |  2 +-
 arch/arm/mach-pxa/zylonite_pxa300.c         |  2 +-
 arch/arm/mach-s3c64xx/mach-crag6410.c       |  2 +-
 arch/x86/platform/mrst/mrst.c               |  2 +-
 drivers/gpio/gpio-pca953x.c                 |  2 +-
 include/linux/i2c/pca953x.h                 | 30 -----------------------------
 include/linux/platform_data/pca953x.h       | 30 +++++++++++++++++++++++++++++
 19 files changed, 47 insertions(+), 47 deletions(-)
 delete mode 100644 include/linux/i2c/pca953x.h
 create mode 100644 include/linux/platform_data/pca953x.h
hartleys - July 31, 2013, 9:03 p.m.
On Wednesday, July 31, 2013 1:57 PM, Vivien Didelot wrote:
>
> This patch moves the pca953x.h header from include/linux/i2c to
> include/linux/platform_data and updates existing support accordingly.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---

<snip>

arch/arm/mach-ep93xx/vision_ep9307.c        |  2 +-

For the ep93xx change:

Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>

Thanks
Linus Walleij - Aug. 16, 2013, 1:34 p.m.
On Wed, Jul 31, 2013 at 10:57 PM, Vivien Didelot
<vivien.didelot@savoirfairelinux.com> wrote:

> This patch moves the pca953x.h header from include/linux/i2c to
> include/linux/platform_data and updates existing support accordingly.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

On the concept:
Acked-by: Linus Walleij <linus.walleij@linaro.org>

But:

>  drivers/gpio/gpio-pca953x.c                 |  2 +-
(...)
> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> index 426c51d..8804aec 100644
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -18,7 +18,7 @@
>  #include <linux/irq.h>
>  #include <linux/irqdomain.h>
>  #include <linux/i2c.h>
> -#include <linux/i2c/pca953x.h>
> +#include <linux/platform_data/pca953x.h>

Why does the GPIO driver need platform data from the
I2C driver???

Can't this just be made to go away?

Yours,
Linus Walleij
Vivien Didelot - Aug. 16, 2013, 3:02 p.m.
Hi Linus,

You wrote:
> But:
> 
> >  drivers/gpio/gpio-pca953x.c                 |  2 +-
> (...)
> > diff --git a/drivers/gpio/gpio-pca953x.c
> > b/drivers/gpio/gpio-pca953x.c
> > index 426c51d..8804aec 100644
> > --- a/drivers/gpio/gpio-pca953x.c
> > +++ b/drivers/gpio/gpio-pca953x.c
> > @@ -18,7 +18,7 @@
> >  #include <linux/irq.h>
> >  #include <linux/irqdomain.h>
> >  #include <linux/i2c.h>
> > -#include <linux/i2c/pca953x.h>
> > +#include <linux/platform_data/pca953x.h>
> 
> Why does the GPIO driver need platform data from the
> I2C driver???
> 
> Can't this just be made to go away?

I didn't dig that much in the driver, but I cannot imagine
another way to pass, for instance, the setup callback.

What would be a good alternative for you?

Regards,
Vivien
Linus Walleij - Aug. 16, 2013, 3:42 p.m.
On Fri, Aug 16, 2013 at 5:02 PM, Vivien Didelot
<vivien.didelot@savoirfairelinux.com> wrote:

>> Why does the GPIO driver need platform data from the
>> I2C driver???
>>
>> Can't this just be made to go away?
>
> I didn't dig that much in the driver, but I cannot imagine
> another way to pass, for instance, the setup callback.

Hm so this is some combined platform data for I2C *and* GPIO?

Hmm ugly, but OK then.
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
hartleys - Aug. 16, 2013, 7:06 p.m.
On Friday, August 16, 2013 8:02 AM, Vivien Didelot wrote:
> Hi Linus,
>
> You wrote:
> > But:
>>
>>>  drivers/gpio/gpio-pca953x.c                 |  2 +-
>> (...)
>>> diff --git a/drivers/gpio/gpio-pca953x.c
>>> b/drivers/gpio/gpio-pca953x.c
>>> index 426c51d..8804aec 100644
>>> --- a/drivers/gpio/gpio-pca953x.c
>>> +++ b/drivers/gpio/gpio-pca953x.c
>>> @@ -18,7 +18,7 @@
>>>  #include <linux/irq.h>
>>>  #include <linux/irqdomain.h>
>>>  #include <linux/i2c.h>
>>> -#include <linux/i2c/pca953x.h>
>>> +#include <linux/platform_data/pca953x.h>
>> 
>> Why does the GPIO driver need platform data from the
>> I2C driver???
>> 
>> Can't this just be made to go away?
>
> I didn't dig that much in the driver, but I cannot imagine
> another way to pass, for instance, the setup callback.
>
> What would be a good alternative for you?

I think the confusion here is because the pca953x.h header was initially
placed in linux/i2c.

This device is an I2C connected GPIO expander. The pca953x.h header has
the information needed for the platform to hook up to the device. It doesn't
really expose the fact that it's an I2C driver.

Just by 2 cents...
Hartley
Vivien Didelot - Aug. 29, 2013, 5:52 p.m.
As this patch mainly touches arch/arm/*, Olof/Kevin, would you mind
applying it?

The first message in thread is here: https://lkml.org/lkml/2013/7/31/552
Here are the previous ACKs:

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>

Regards,
Vivien
Olof Johansson - Aug. 29, 2013, 6 p.m.
On Thu, Aug 29, 2013 at 01:52:58PM -0400, Vivien Didelot wrote:
> As this patch mainly touches arch/arm/*, Olof/Kevin, would you mind
> applying it?
> 
> The first message in thread is here: https://lkml.org/lkml/2013/7/31/552
> Here are the previous ACKs:
> 
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>

Looks like i2c or gpio maintainers should be taking it, but since Linus acked
it instead of applied it, I guess we can take it. :)

I'll apply it to next/cleanup for 3.12 if you resend me the patch with the
acks. Thanks!


-Olof
Linus Walleij - Aug. 29, 2013, 6:46 p.m.
On Thu, Aug 29, 2013 at 8:00 PM, Olof Johansson <olof@lixom.net> wrote:
> On Thu, Aug 29, 2013 at 01:52:58PM -0400, Vivien Didelot wrote:
>> As this patch mainly touches arch/arm/*, Olof/Kevin, would you mind
>> applying it?
>>
>> The first message in thread is here: https://lkml.org/lkml/2013/7/31/552
>> Here are the previous ACKs:
>>
>> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
>
> Looks like i2c or gpio maintainers should be taking it, but since Linus acked
> it instead of applied it, I guess we can take it. :)
>
> I'll apply it to next/cleanup for 3.12 if you resend me the patch with the
> acks. Thanks!

Thanks a lot Olof, I worried about all the hunks hitting the arch/arm/*
hierarchy, and not much is happening in drivers/gpio this cycle
so think it is better off in ARM SoC.

Yours,
Linus Walleij

Patch

diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
index 3aaa978..f1d49e9 100644
--- a/arch/arm/mach-at91/board-snapper9260.c
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -26,7 +26,7 @@ 
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index bea6793..af6dafb 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -19,7 +19,7 @@ 
 #include <linux/kernel.h>
 #include <linux/i2c.h>
 #include <linux/i2c/at24.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 #include <linux/input.h>
 #include <linux/input/tps6507x-ts.h>
 #include <linux/mfd/tps6507x.h>
diff --git a/arch/arm/mach-ep93xx/vision_ep9307.c b/arch/arm/mach-ep93xx/vision_ep9307.c
index 605956f..64f2e50 100644
--- a/arch/arm/mach-ep93xx/vision_ep9307.c
+++ b/arch/arm/mach-ep93xx/vision_ep9307.c
@@ -23,7 +23,7 @@ 
 #include <linux/mtd/partitions.h>
 #include <linux/i2c.h>
 #include <linux/i2c-gpio.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/flash.h>
 #include <linux/spi/mmc_spi.h>
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index 29ac8ee6..97f9c62 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -26,7 +26,7 @@ 
 #include <linux/platform_device.h>
 #include <linux/mtd/physmap.h>
 #include <linux/i2c.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 #include <linux/input.h>
 #include <linux/gpio.h>
 #include <linux/delay.h>
diff --git a/arch/arm/mach-imx/mach-mxt_td60.c b/arch/arm/mach-imx/mach-mxt_td60.c
index a27faab..c918940 100644
--- a/arch/arm/mach-imx/mach-mxt_td60.c
+++ b/arch/arm/mach-imx/mach-mxt_td60.c
@@ -26,7 +26,7 @@ 
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
 #include <linux/gpio.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 
 #include "common.h"
 #include "devices-imx27.h"
diff --git a/arch/arm/mach-ks8695/board-acs5k.c b/arch/arm/mach-ks8695/board-acs5k.c
index 456d638..9f9c044 100644
--- a/arch/arm/mach-ks8695/board-acs5k.c
+++ b/arch/arm/mach-ks8695/board-acs5k.c
@@ -20,7 +20,7 @@ 
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
 #include <linux/i2c-gpio.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index 8483906..7022329 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -15,7 +15,7 @@ 
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/onenand.h>
 #include <linux/interrupt.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 #include <linux/gpio.h>
 #include <linux/gpio-pxa.h>
 #include <linux/mfd/88pm860x.h>
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index d63f14b..c7196a6 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -21,7 +21,7 @@ 
 #include <linux/clk.h>
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 #include <linux/can/platform/ti_hecc.h>
 #include <linux/davinci_emac.h>
 #include <linux/mmc/host.h>
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index 8091aac..f942349 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -29,7 +29,7 @@ 
 #include <linux/pwm_backlight.h>
 
 #include <linux/i2c.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 #include <linux/i2c/pxa-i2c.h>
 
 #include <linux/mfd/da903x.h>
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 3a3362f..8eb4e23 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -30,7 +30,7 @@ 
 #include <linux/power_supply.h>
 #include <linux/apm-emulation.h>
 #include <linux/i2c.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 #include <linux/i2c/pxa-i2c.h>
 #include <linux/regulator/userspace-consumer.h>
 
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 13e5b00..3133ba8 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -408,7 +408,7 @@  struct pxacamera_platform_data pcm990_pxacamera_platform_data = {
 	.mclk_10khz = 1000,
 };
 
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 
 static struct pca953x_platform_data pca9536_data = {
 	.gpio_base	= PXA_NR_BUILTIN_GPIO,
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 4c29173..0b11c1a 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -20,7 +20,7 @@ 
 #include <linux/leds.h>
 #include <linux/i2c.h>
 #include <linux/i2c/pxa-i2c.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 #include <linux/spi/corgi_lcd.h>
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index f5d4364..126e4a8 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -26,7 +26,7 @@ 
 #include <linux/mtd/physmap.h>
 #include <linux/i2c.h>
 #include <linux/i2c/pxa-i2c.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 #include <linux/apm-emulation.h>
 #include <linux/can/platform/mcp251x.h>
 
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c
index 86e59c0..869bce7 100644
--- a/arch/arm/mach-pxa/zylonite_pxa300.c
+++ b/arch/arm/mach-pxa/zylonite_pxa300.c
@@ -18,7 +18,7 @@ 
 #include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/i2c/pxa-i2c.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 #include <linux/gpio.h>
 
 #include <mach/pxa300.h>
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 8ad88ac..007fc53 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -30,7 +30,7 @@ 
 #include <linux/basic_mmio_gpio.h>
 #include <linux/spi/spi.h>
 
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 #include <linux/platform_data/s3c-hsotg.h>
 
 #include <video/platform_lcd.h>
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index 47fe66f..3ca5957 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -20,7 +20,7 @@ 
 #include <linux/intel_pmic_gpio.h>
 #include <linux/spi/spi.h>
 #include <linux/i2c.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 #include <linux/gpio_keys.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 426c51d..8804aec 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -18,7 +18,7 @@ 
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
 #include <linux/i2c.h>
-#include <linux/i2c/pca953x.h>
+#include <linux/platform_data/pca953x.h>
 #include <linux/slab.h>
 #ifdef CONFIG_OF_GPIO
 #include <linux/of_platform.h>
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
deleted file mode 100644
index 3c98dd4..0000000
--- a/include/linux/i2c/pca953x.h
+++ /dev/null
@@ -1,30 +0,0 @@ 
-#ifndef _LINUX_PCA953X_H
-#define _LINUX_PCA953X_H
-
-#include <linux/types.h>
-#include <linux/i2c.h>
-
-/* platform data for the PCA9539 16-bit I/O expander driver */
-
-struct pca953x_platform_data {
-	/* number of the first GPIO */
-	unsigned	gpio_base;
-
-	/* initial polarity inversion setting */
-	u32		invert;
-
-	/* interrupt base */
-	int		irq_base;
-
-	void		*context;	/* param to setup/teardown */
-
-	int		(*setup)(struct i2c_client *client,
-				unsigned gpio, unsigned ngpio,
-				void *context);
-	int		(*teardown)(struct i2c_client *client,
-				unsigned gpio, unsigned ngpio,
-				void *context);
-	const char	*const *names;
-};
-
-#endif /* _LINUX_PCA953X_H */
diff --git a/include/linux/platform_data/pca953x.h b/include/linux/platform_data/pca953x.h
new file mode 100644
index 0000000..3c98dd4
--- /dev/null
+++ b/include/linux/platform_data/pca953x.h
@@ -0,0 +1,30 @@ 
+#ifndef _LINUX_PCA953X_H
+#define _LINUX_PCA953X_H
+
+#include <linux/types.h>
+#include <linux/i2c.h>
+
+/* platform data for the PCA9539 16-bit I/O expander driver */
+
+struct pca953x_platform_data {
+	/* number of the first GPIO */
+	unsigned	gpio_base;
+
+	/* initial polarity inversion setting */
+	u32		invert;
+
+	/* interrupt base */
+	int		irq_base;
+
+	void		*context;	/* param to setup/teardown */
+
+	int		(*setup)(struct i2c_client *client,
+				unsigned gpio, unsigned ngpio,
+				void *context);
+	int		(*teardown)(struct i2c_client *client,
+				unsigned gpio, unsigned ngpio,
+				void *context);
+	const char	*const *names;
+};
+
+#endif /* _LINUX_PCA953X_H */