diff mbox

gpio: drop unnecessary includes from include/linux/gpio/driver.h

Message ID 1499140415-31677-1-git-send-email-yamada.masahiro@socionext.com
State Deferred
Headers show

Commit Message

Masahiro Yamada July 4, 2017, 3:53 a.m. UTC
Some of include directives in include/linux/gpio/driver.h are
unneeded because the header does not need to know the content of
struct device, irq_chip, etc.  Just declare they are structures.

On the other hand, <linux/irqhandler.h> and <linux/spinlock_types.h>
turned out to be necessary for irq_flow_handler_t and spinlock_t,
respectively.

Each driver should include what it needs without relying on what is
implicitly included from <linux/gpio/driver.h>.  This will cut down
unnecessary header parsing.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/gpio/gpio-104-dio-48e.c  |  1 +
 drivers/gpio/gpio-104-idi-48.c   |  1 +
 drivers/gpio/gpio-104-idio-16.c  |  1 +
 drivers/gpio/gpio-altera-a10sr.c |  2 ++
 drivers/gpio/gpio-altera.c       |  3 +++
 drivers/gpio/gpio-aspeed.c       |  5 +++++
 drivers/gpio/gpio-ath79.c        |  2 ++
 drivers/gpio/gpio-bcm-kona.c     |  1 +
 drivers/gpio/gpio-clps711x.c     |  1 +
 drivers/gpio/gpio-crystalcove.c  |  2 ++
 drivers/gpio/gpio-dln2.c         |  1 +
 drivers/gpio/gpio-dwapb.c        |  1 +
 drivers/gpio/gpio-etraxfs.c      |  1 +
 drivers/gpio/gpio-f7188x.c       |  1 +
 drivers/gpio/gpio-ftgpio010.c    |  3 +++
 drivers/gpio/gpio-ingenic.c      |  1 +
 drivers/gpio/gpio-intel-mid.c    |  2 ++
 drivers/gpio/gpio-lp873x.c       |  1 +
 drivers/gpio/gpio-lynxpoint.c    |  2 ++
 drivers/gpio/gpio-max732x.c      |  1 +
 drivers/gpio/gpio-max77620.c     |  1 +
 drivers/gpio/gpio-menz127.c      |  1 +
 drivers/gpio/gpio-merrifield.c   |  4 ++++
 drivers/gpio/gpio-omap.c         |  3 +++
 drivers/gpio/gpio-pca953x.c      |  1 +
 drivers/gpio/gpio-pci-idio-16.c  |  2 ++
 drivers/gpio/gpio-pisosr.c       |  1 +
 drivers/gpio/gpio-pl061.c        |  1 +
 drivers/gpio/gpio-rcar.c         |  1 +
 drivers/gpio/gpio-stmpe.c        |  2 ++
 drivers/gpio/gpio-tc3589x.c      |  3 +++
 drivers/gpio/gpio-tegra.c        |  1 +
 drivers/gpio/gpio-tps65218.c     |  1 +
 drivers/gpio/gpio-vf610.c        |  3 +++
 drivers/gpio/gpio-vx855.c        |  1 +
 drivers/gpio/gpio-wcove.c        |  2 ++
 drivers/gpio/gpio-wm831x.c       |  1 +
 drivers/gpio/gpio-wm8994.c       |  1 +
 drivers/gpio/gpio-ws16c48.c      |  1 +
 drivers/gpio/gpio-xgene-sb.c     |  2 ++
 drivers/gpio/gpio-xlp.c          |  1 +
 drivers/gpio/gpio-zx.c           |  1 +
 drivers/gpio/gpio-zynq.c         |  3 +++
 drivers/gpio/gpiolib-acpi.c      |  1 +
 drivers/gpio/gpiolib.c           |  2 ++
 include/linux/gpio/driver.h      | 11 ++++++-----
 46 files changed, 80 insertions(+), 5 deletions(-)

Comments

Charles Keepax July 4, 2017, 8:30 a.m. UTC | #1
On Tue, Jul 04, 2017 at 12:53:34PM +0900, Masahiro Yamada wrote:
> Some of include directives in include/linux/gpio/driver.h are
> unneeded because the header does not need to know the content of
> struct device, irq_chip, etc.  Just declare they are structures.
> 
> On the other hand, <linux/irqhandler.h> and <linux/spinlock_types.h>
> turned out to be necessary for irq_flow_handler_t and spinlock_t,
> respectively.
> 
> Each driver should include what it needs without relying on what is
> implicitly included from <linux/gpio/driver.h>.  This will cut down
> unnecessary header parsing.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  drivers/gpio/gpio-wm831x.c       |  1 +
>  drivers/gpio/gpio-wm8994.c       |  1 +

For the Wolfson Micro bits:

Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

Thanks,
Charles
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andy Shevchenko July 4, 2017, 10:06 a.m. UTC | #2
On Tue, 2017-07-04 at 12:53 +0900, Masahiro Yamada wrote:
> Some of include directives in include/linux/gpio/driver.h are
> unneeded because the header does not need to know the content of
> struct device, irq_chip, etc.  Just declare they are structures.
> 
> On the other hand, <linux/irqhandler.h> and <linux/spinlock_types.h>
> turned out to be necessary for irq_flow_handler_t and spinlock_t,
> respectively.
> 
> Each driver should include what it needs without relying on what is
> implicitly included from <linux/gpio/driver.h>.  This will cut down
> unnecessary header parsing.

If Linus is okay with the following proposal I would rather go with it,
i.e. logical split the series to

1. Fix IRQ related headers inclusion
2. Fix pinconf-generic.h inclusion
3. Fix OF headers inclusion (btw, of_gpio.h is not enough there?)

In any case take my tag

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

for the drivers I have been involved into development of:

 drivers/gpio/gpio-dwapb.c        |  1 +
 drivers/gpio/gpio-intel-mid.c    |  2 ++
 drivers/gpio/gpio-lynxpoint.c    |  2 ++
 drivers/gpio/gpio-merrifield.c   |  4 ++++
 drivers/gpio/gpio-pca953x.c      |  1 +
 drivers/gpio/gpio-wcove.c        |  2 ++

And 

Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

for

 drivers/gpio/gpiolib-acpi.c      |  1 +


> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  drivers/gpio/gpio-104-dio-48e.c  |  1 +
>  drivers/gpio/gpio-104-idi-48.c   |  1 +
>  drivers/gpio/gpio-104-idio-16.c  |  1 +
>  drivers/gpio/gpio-altera-a10sr.c |  2 ++
>  drivers/gpio/gpio-altera.c       |  3 +++
>  drivers/gpio/gpio-aspeed.c       |  5 +++++
>  drivers/gpio/gpio-ath79.c        |  2 ++
>  drivers/gpio/gpio-bcm-kona.c     |  1 +
>  drivers/gpio/gpio-clps711x.c     |  1 +
>  drivers/gpio/gpio-crystalcove.c  |  2 ++
>  drivers/gpio/gpio-dln2.c         |  1 +
>  drivers/gpio/gpio-dwapb.c        |  1 +
>  drivers/gpio/gpio-etraxfs.c      |  1 +
>  drivers/gpio/gpio-f7188x.c       |  1 +
>  drivers/gpio/gpio-ftgpio010.c    |  3 +++
>  drivers/gpio/gpio-ingenic.c      |  1 +
>  drivers/gpio/gpio-intel-mid.c    |  2 ++
>  drivers/gpio/gpio-lp873x.c       |  1 +
>  drivers/gpio/gpio-lynxpoint.c    |  2 ++
>  drivers/gpio/gpio-max732x.c      |  1 +
>  drivers/gpio/gpio-max77620.c     |  1 +
>  drivers/gpio/gpio-menz127.c      |  1 +
>  drivers/gpio/gpio-merrifield.c   |  4 ++++
>  drivers/gpio/gpio-omap.c         |  3 +++
>  drivers/gpio/gpio-pca953x.c      |  1 +
>  drivers/gpio/gpio-pci-idio-16.c  |  2 ++
>  drivers/gpio/gpio-pisosr.c       |  1 +
>  drivers/gpio/gpio-pl061.c        |  1 +
>  drivers/gpio/gpio-rcar.c         |  1 +
>  drivers/gpio/gpio-stmpe.c        |  2 ++
>  drivers/gpio/gpio-tc3589x.c      |  3 +++
>  drivers/gpio/gpio-tegra.c        |  1 +
>  drivers/gpio/gpio-tps65218.c     |  1 +
>  drivers/gpio/gpio-vf610.c        |  3 +++
>  drivers/gpio/gpio-vx855.c        |  1 +
>  drivers/gpio/gpio-wcove.c        |  2 ++
>  drivers/gpio/gpio-wm831x.c       |  1 +
>  drivers/gpio/gpio-wm8994.c       |  1 +
>  drivers/gpio/gpio-ws16c48.c      |  1 +
>  drivers/gpio/gpio-xgene-sb.c     |  2 ++
>  drivers/gpio/gpio-xlp.c          |  1 +
>  drivers/gpio/gpio-zx.c           |  1 +
>  drivers/gpio/gpio-zynq.c         |  3 +++
>  drivers/gpio/gpiolib-acpi.c      |  1 +
>  drivers/gpio/gpiolib.c           |  2 ++
>  include/linux/gpio/driver.h      | 11 ++++++-----
>  46 files changed, 80 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-
> dio-48e.c
> index 598e209efa2d..bdc52be7902a 100644
> --- a/drivers/gpio/gpio-104-dio-48e.c
> +++ b/drivers/gpio/gpio-104-dio-48e.c
> @@ -22,6 +22,7 @@
>  #include <linux/ioport.h>
>  #include <linux/interrupt.h>
>  #include <linux/irqdesc.h>
> +#include <linux/irqdomain.h>
>  #include <linux/isa.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
> diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-
> idi-48.c
> index 51f046e29ff7..7bbb0e8573d1 100644
> --- a/drivers/gpio/gpio-104-idi-48.c
> +++ b/drivers/gpio/gpio-104-idi-48.c
> @@ -22,6 +22,7 @@
>  #include <linux/ioport.h>
>  #include <linux/interrupt.h>
>  #include <linux/irqdesc.h>
> +#include <linux/irqdomain.h>
>  #include <linux/isa.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
> diff --git a/drivers/gpio/gpio-104-idio-16.c b/drivers/gpio/gpio-104-
> idio-16.c
> index ec2ce34ff473..7e3fc0bf3398 100644
> --- a/drivers/gpio/gpio-104-idio-16.c
> +++ b/drivers/gpio/gpio-104-idio-16.c
> @@ -22,6 +22,7 @@
>  #include <linux/ioport.h>
>  #include <linux/interrupt.h>
>  #include <linux/irqdesc.h>
> +#include <linux/irqdomain.h>
>  #include <linux/isa.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
> diff --git a/drivers/gpio/gpio-altera-a10sr.c b/drivers/gpio/gpio-
> altera-a10sr.c
> index 16a8951b2bed..4cdca9332043 100644
> --- a/drivers/gpio/gpio-altera-a10sr.c
> +++ b/drivers/gpio/gpio-altera-a10sr.c
> @@ -21,6 +21,8 @@
>  #include <linux/gpio/driver.h>
>  #include <linux/mfd/altera-a10sr.h>
>  #include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
>  
>  /**
>   * struct altr_a10sr_gpio - Altera Max5 GPIO device private data
> structure
> diff --git a/drivers/gpio/gpio-altera.c b/drivers/gpio/gpio-altera.c
> index 17485dc20384..40b26274acaf 100644
> --- a/drivers/gpio/gpio-altera.c
> +++ b/drivers/gpio/gpio-altera.c
> @@ -17,6 +17,9 @@
>   */
>  
>  #include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/irqchip/chained_irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/module.h>
>  #include <linux/of_gpio.h>
>  #include <linux/platform_device.h>
> diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
> index 4ca436e66bdb..a9d575e215da 100644
> --- a/drivers/gpio/gpio-aspeed.c
> +++ b/drivers/gpio/gpio-aspeed.c
> @@ -15,9 +15,14 @@
>  #include <linux/hashtable.h>
>  #include <linux/init.h>
>  #include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/irqchip/chained_irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
> +#include <linux/of.h>
>  #include <linux/pinctrl/consumer.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/platform_device.h>
>  #include <linux/spinlock.h>
>  #include <linux/string.h>
> diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c
> index f33d4a5fe671..1249ab0f8f4f 100644
> --- a/drivers/gpio/gpio-ath79.c
> +++ b/drivers/gpio/gpio-ath79.c
> @@ -17,6 +17,8 @@
>  #include <linux/interrupt.h>
>  #include <linux/module.h>
>  #include <linux/irq.h>
> +#include <linux/irqchip/chained_irq.h>
> +#include <linux/irqdomain.h>
>  
>  #define AR71XX_GPIO_REG_OE		0x00
>  #define AR71XX_GPIO_REG_IN		0x04
> diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-
> kona.c
> index dfcf56ee3c61..937d646d184b 100644
> --- a/drivers/gpio/gpio-bcm-kona.c
> +++ b/drivers/gpio/gpio-bcm-kona.c
> @@ -23,6 +23,7 @@
>  #include <linux/init.h>
>  #include <linux/irqdomain.h>
>  #include <linux/irqchip/chained_irq.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  
>  #define BCM_GPIO_PASSWD				0x00a5a501
>  #define GPIO_PER_BANK				32
> diff --git a/drivers/gpio/gpio-clps711x.c b/drivers/gpio/gpio-
> clps711x.c
> index 52fd63f02134..1f499b5e7f91 100644
> --- a/drivers/gpio/gpio-clps711x.c
> +++ b/drivers/gpio/gpio-clps711x.c
> @@ -12,6 +12,7 @@
>  #include <linux/err.h>
>  #include <linux/module.h>
>  #include <linux/gpio/driver.h>
> +#include <linux/of.h>
>  #include <linux/platform_device.h>
>  
>  static int clps711x_gpio_probe(struct platform_device *pdev)
> diff --git a/drivers/gpio/gpio-crystalcove.c b/drivers/gpio/gpio-
> crystalcove.c
> index e60156ec0c18..0f66ae796d4a 100644
> --- a/drivers/gpio/gpio-crystalcove.c
> +++ b/drivers/gpio/gpio-crystalcove.c
> @@ -16,6 +16,8 @@
>   */
>  
>  #include <linux/interrupt.h>
> +#include <linux/irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
>  #include <linux/gpio.h>
> diff --git a/drivers/gpio/gpio-dln2.c b/drivers/gpio/gpio-dln2.c
> index aecb847166f5..d524f3390196 100644
> --- a/drivers/gpio/gpio-dln2.c
> +++ b/drivers/gpio/gpio-dln2.c
> @@ -17,6 +17,7 @@
>  #include <linux/irqchip/chained_irq.h>
>  #include <linux/gpio.h>
>  #include <linux/gpio/driver.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/platform_device.h>
>  #include <linux/mfd/dln2.h>
>  
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index c07ada9c7af6..350454b9359e 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -23,6 +23,7 @@
>  #include <linux/of_address.h>
>  #include <linux/of_device.h>
>  #include <linux/of_irq.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/platform_device.h>
>  #include <linux/property.h>
>  #include <linux/spinlock.h>
> diff --git a/drivers/gpio/gpio-etraxfs.c b/drivers/gpio/gpio-etraxfs.c
> index 14c6aac26780..ef518aacbeac 100644
> --- a/drivers/gpio/gpio-etraxfs.c
> +++ b/drivers/gpio/gpio-etraxfs.c
> @@ -4,6 +4,7 @@
>  #include <linux/of_gpio.h>
>  #include <linux/io.h>
>  #include <linux/interrupt.h>
> +#include <linux/irq.h>
>  #include <linux/platform_device.h>
>  
>  #define ETRAX_FS_rw_pa_dout	0
> diff --git a/drivers/gpio/gpio-f7188x.c b/drivers/gpio/gpio-f7188x.c
> index 13350c9d7f5e..08604a76d543 100644
> --- a/drivers/gpio/gpio-f7188x.c
> +++ b/drivers/gpio/gpio-f7188x.c
> @@ -17,6 +17,7 @@
>  #include <linux/io.h>
>  #include <linux/gpio/driver.h>
>  #include <linux/bitops.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  
>  #define DRVNAME "gpio-f7188x"
>  
> diff --git a/drivers/gpio/gpio-ftgpio010.c b/drivers/gpio/gpio-
> ftgpio010.c
> index e9386f8b67f5..699a3709e357 100644
> --- a/drivers/gpio/gpio-ftgpio010.c
> +++ b/drivers/gpio/gpio-ftgpio010.c
> @@ -12,6 +12,9 @@
>  #include <linux/gpio/driver.h>
>  #include <linux/io.h>
>  #include <linux/interrupt.h>
> +#include <linux/irq.h>
> +#include <linux/irqchip/chained_irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/platform_device.h>
>  #include <linux/of_gpio.h>
>  #include <linux/bitops.h>
> diff --git a/drivers/gpio/gpio-ingenic.c b/drivers/gpio/gpio-ingenic.c
> index 254780730b95..7ec8de5ee926 100644
> --- a/drivers/gpio/gpio-ingenic.c
> +++ b/drivers/gpio/gpio-ingenic.c
> @@ -9,6 +9,7 @@
>  #include <linux/gpio/driver.h>
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
> +#include <linux/irqchip/chained_irq.h>
>  #include <linux/module.h>
>  #include <linux/of_address.h>
>  #include <linux/of_device.h>
> diff --git a/drivers/gpio/gpio-intel-mid.c b/drivers/gpio/gpio-intel-
> mid.c
> index b76ecee82c3f..af6b7d27ee41 100644
> --- a/drivers/gpio/gpio-intel-mid.c
> +++ b/drivers/gpio/gpio-intel-mid.c
> @@ -23,6 +23,8 @@
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/gpio/driver.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
> diff --git a/drivers/gpio/gpio-lp873x.c b/drivers/gpio/gpio-lp873x.c
> index df0ad2cef0d2..1cd5e7e08ad9 100644
> --- a/drivers/gpio/gpio-lp873x.c
> +++ b/drivers/gpio/gpio-lp873x.c
> @@ -16,6 +16,7 @@
>  
>  #include <linux/gpio.h>
>  #include <linux/module.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
>  
> diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-
> lynxpoint.c
> index fbd393b46ce0..9adbbac2ba5b 100644
> --- a/drivers/gpio/gpio-lynxpoint.c
> +++ b/drivers/gpio/gpio-lynxpoint.c
> @@ -25,6 +25,8 @@
>  #include <linux/types.h>
>  #include <linux/bitops.h>
>  #include <linux/interrupt.h>
> +#include <linux/irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/gpio.h>
>  #include <linux/slab.h>
>  #include <linux/acpi.h>
> diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
> index 7f4d26ce5f23..c277278af532 100644
> --- a/drivers/gpio/gpio-max732x.c
> +++ b/drivers/gpio/gpio-max732x.c
> @@ -20,6 +20,7 @@
>  #include <linux/gpio/driver.h>
>  #include <linux/interrupt.h>
>  #include <linux/i2c.h>
> +#include <linux/irq.h>
>  #include <linux/platform_data/max732x.h>
>  #include <linux/of.h>
>  
> diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-
> max77620.c
> index 743459d9477d..35dd0f133028 100644
> --- a/drivers/gpio/gpio-max77620.c
> +++ b/drivers/gpio/gpio-max77620.c
> @@ -12,6 +12,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/mfd/max77620.h>
>  #include <linux/module.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
>  
> diff --git a/drivers/gpio/gpio-menz127.c b/drivers/gpio/gpio-menz127.c
> index e1037582e34d..f265a841f787 100644
> --- a/drivers/gpio/gpio-menz127.c
> +++ b/drivers/gpio/gpio-menz127.c
> @@ -15,6 +15,7 @@
>  #include <linux/mcb.h>
>  #include <linux/bitops.h>
>  #include <linux/gpio/driver.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  
>  #define MEN_Z127_CTRL	0x00
>  #define MEN_Z127_PSR	0x04
> diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-
> merrifield.c
> index ec8560298805..2d84fcbe060f 100644
> --- a/drivers/gpio/gpio-merrifield.c
> +++ b/drivers/gpio/gpio-merrifield.c
> @@ -14,8 +14,12 @@
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/irqchip/chained_irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/module.h>
>  #include <linux/pci.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/pinctrl/consumer.h>
>  
>  #define GCCR		0x000	/* controller configuration
> */
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index f8c550de6c72..7ef062e14777 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -19,6 +19,8 @@
>  #include <linux/err.h>
>  #include <linux/clk.h>
>  #include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/device.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/pm.h>
> @@ -26,6 +28,7 @@
>  #include <linux/of_device.h>
>  #include <linux/gpio.h>
>  #include <linux/bitops.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/platform_data/gpio-omap.h>
>  
>  #define OFF_MODE	1
> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> index 4c9e21300a26..58a68ba8311f 100644
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -17,6 +17,7 @@
>  #include <linux/i2c.h>
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
> +#include <linux/irq.h>
>  #include <linux/module.h>
>  #include <linux/of_platform.h>
>  #include <linux/platform_data/pca953x.h>
> diff --git a/drivers/gpio/gpio-pci-idio-16.c b/drivers/gpio/gpio-pci-
> idio-16.c
> index 7de4f6a2cb49..313da56389f4 100644
> --- a/drivers/gpio/gpio-pci-idio-16.c
> +++ b/drivers/gpio/gpio-pci-idio-16.c
> @@ -16,7 +16,9 @@
>  #include <linux/errno.h>
>  #include <linux/gpio/driver.h>
>  #include <linux/interrupt.h>
> +#include <linux/irq.h>
>  #include <linux/irqdesc.h>
> +#include <linux/irqdomain.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/pci.h>
> diff --git a/drivers/gpio/gpio-pisosr.c b/drivers/gpio/gpio-pisosr.c
> index f5545049c187..4cca0c4dd85a 100644
> --- a/drivers/gpio/gpio-pisosr.c
> +++ b/drivers/gpio/gpio-pisosr.c
> @@ -17,6 +17,7 @@
>  #include <linux/gpio/driver.h>
>  #include <linux/module.h>
>  #include <linux/mutex.h>
> +#include <linux/of.h>
>  #include <linux/spi/spi.h>
>  
>  #define DEFAULT_NGPIO 8
> diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
> index 3d3d6b6645a7..8d502a83babc 100644
> --- a/drivers/gpio/gpio-pl061.c
> +++ b/drivers/gpio/gpio-pl061.c
> @@ -19,6 +19,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/irq.h>
>  #include <linux/irqchip/chained_irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/bitops.h>
>  #include <linux/gpio.h>
>  #include <linux/device.h>
> diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
> index 4a1536a050bc..9b2b00974163 100644
> --- a/drivers/gpio/gpio-rcar.c
> +++ b/drivers/gpio/gpio-rcar.c
> @@ -22,6 +22,7 @@
>  #include <linux/io.h>
>  #include <linux/ioport.h>
>  #include <linux/irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
>  #include <linux/pinctrl/consumer.h>
> diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
> index 16cbc5702865..0e6fae84c759 100644
> --- a/drivers/gpio/gpio-stmpe.c
> +++ b/drivers/gpio/gpio-stmpe.c
> @@ -10,6 +10,8 @@
>  #include <linux/slab.h>
>  #include <linux/gpio.h>
>  #include <linux/interrupt.h>
> +#include <linux/irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/of.h>
>  #include <linux/mfd/stmpe.h>
>  #include <linux/seq_file.h>
> diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
> index 433b45ef332e..d0ec9902d9c1 100644
> --- a/drivers/gpio/gpio-tc3589x.c
> +++ b/drivers/gpio/gpio-tc3589x.c
> @@ -12,8 +12,11 @@
>  #include <linux/gpio/driver.h>
>  #include <linux/of.h>
>  #include <linux/interrupt.h>
> +#include <linux/irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/mfd/tc3589x.h>
>  #include <linux/bitops.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  
>  /*
>   * These registers are modified under the irq bus lock and cached to
> avoid
> diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
> index 88529d3c06c9..5e012377be1e 100644
> --- a/drivers/gpio/gpio-tegra.c
> +++ b/drivers/gpio/gpio-tegra.c
> @@ -29,6 +29,7 @@
>  #include <linux/irqdomain.h>
>  #include <linux/irqchip/chained_irq.h>
>  #include <linux/pinctrl/consumer.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/pm.h>
>  
>  #define GPIO_BANK(x)		((x) >> 5)
> diff --git a/drivers/gpio/gpio-tps65218.c b/drivers/gpio/gpio-
> tps65218.c
> index a379bba57d31..97dca93b0529 100644
> --- a/drivers/gpio/gpio-tps65218.c
> +++ b/drivers/gpio/gpio-tps65218.c
> @@ -15,6 +15,7 @@
>  #include <linux/module.h>
>  #include <linux/errno.h>
>  #include <linux/gpio/driver.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
>  #include <linux/mfd/tps65218.h>
> diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
> index 521fbe338589..844bf591268b 100644
> --- a/drivers/gpio/gpio-vf610.c
> +++ b/drivers/gpio/gpio-vf610.c
> @@ -23,6 +23,9 @@
>  #include <linux/io.h>
>  #include <linux/ioport.h>
>  #include <linux/irq.h>
> +#include <linux/irqchip/chained_irq.h>
> +#include <linux/pinctrl/consumer.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/platform_device.h>
>  #include <linux/of.h>
>  #include <linux/of_device.h>
> diff --git a/drivers/gpio/gpio-vx855.c b/drivers/gpio/gpio-vx855.c
> index 98a6f1fcc561..96331a43c2c1 100644
> --- a/drivers/gpio/gpio-vx855.c
> +++ b/drivers/gpio/gpio-vx855.c
> @@ -28,6 +28,7 @@
>  #include <linux/gpio.h>
>  #include <linux/slab.h>
>  #include <linux/device.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/platform_device.h>
>  #include <linux/pci.h>
>  #include <linux/io.h>
> diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c
> index 37c103e50ebf..78161e22a859 100644
> --- a/drivers/gpio/gpio-wcove.c
> +++ b/drivers/gpio/gpio-wcove.c
> @@ -18,8 +18,10 @@
>  #include <linux/bitops.h>
>  #include <linux/module.h>
>  #include <linux/interrupt.h>
> +#include <linux/irqdomain.h>
>  #include <linux/gpio/driver.h>
>  #include <linux/mfd/intel_soc_pmic.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
>  #include <linux/seq_file.h>
> diff --git a/drivers/gpio/gpio-wm831x.c b/drivers/gpio/gpio-wm831x.c
> index 938bbe3f831c..b9f2f95a1309 100644
> --- a/drivers/gpio/gpio-wm831x.c
> +++ b/drivers/gpio/gpio-wm831x.c
> @@ -17,6 +17,7 @@
>  #include <linux/module.h>
>  #include <linux/gpio.h>
>  #include <linux/mfd/core.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/platform_device.h>
>  #include <linux/seq_file.h>
>  
> diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c
> index 1e35756ac55b..f2708fa3eefb 100644
> --- a/drivers/gpio/gpio-wm8994.c
> +++ b/drivers/gpio/gpio-wm8994.c
> @@ -17,6 +17,7 @@
>  #include <linux/module.h>
>  #include <linux/gpio.h>
>  #include <linux/mfd/core.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/platform_device.h>
>  #include <linux/seq_file.h>
>  #include <linux/regmap.h>
> diff --git a/drivers/gpio/gpio-ws16c48.c b/drivers/gpio/gpio-ws16c48.c
> index 5037974ac063..9eb42b983c75 100644
> --- a/drivers/gpio/gpio-ws16c48.c
> +++ b/drivers/gpio/gpio-ws16c48.c
> @@ -19,6 +19,7 @@
>  #include <linux/ioport.h>
>  #include <linux/interrupt.h>
>  #include <linux/irqdesc.h>
> +#include <linux/irqdomain.h>
>  #include <linux/isa.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
> diff --git a/drivers/gpio/gpio-xgene-sb.c b/drivers/gpio/gpio-xgene-
> sb.c
> index 033258634b8c..f0929da6c385 100644
> --- a/drivers/gpio/gpio-xgene-sb.c
> +++ b/drivers/gpio/gpio-xgene-sb.c
> @@ -22,6 +22,8 @@
>  
>  #include <linux/module.h>
>  #include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/platform_device.h>
>  #include <linux/of_gpio.h>
>  #include <linux/gpio/driver.h>
> diff --git a/drivers/gpio/gpio-xlp.c b/drivers/gpio/gpio-xlp.c
> index d857e1d8e731..646856127aa6 100644
> --- a/drivers/gpio/gpio-xlp.c
> +++ b/drivers/gpio/gpio-xlp.c
> @@ -17,6 +17,7 @@
>  #include <linux/of_device.h>
>  #include <linux/module.h>
>  #include <linux/irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/interrupt.h>
>  #include <linux/irqchip/chained_irq.h>
>  #include <linux/acpi.h>
> diff --git a/drivers/gpio/gpio-zx.c b/drivers/gpio/gpio-zx.c
> index be3a87da8438..4259ae6ff44c 100644
> --- a/drivers/gpio/gpio-zx.c
> +++ b/drivers/gpio/gpio-zx.c
> @@ -14,6 +14,7 @@
>  #include <linux/errno.h>
>  #include <linux/gpio/driver.h>
>  #include <linux/irqchip/chained_irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/init.h>
>  #include <linux/of.h>
>  #include <linux/pinctrl/consumer.h>
> diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
> index df0851464006..e0a83e32caef 100644
> --- a/drivers/gpio/gpio-zynq.c
> +++ b/drivers/gpio/gpio-zynq.c
> @@ -15,6 +15,9 @@
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
> +#include <linux/irq.h>
> +#include <linux/irqchip/chained_irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
>  #include <linux/pm_runtime.h>
> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
> index c9b42dd12dfa..2695a8cc3b71 100644
> --- a/drivers/gpio/gpiolib-acpi.c
> +++ b/drivers/gpio/gpiolib-acpi.c
> @@ -18,6 +18,7 @@
>  #include <linux/export.h>
>  #include <linux/acpi.h>
>  #include <linux/interrupt.h>
> +#include <linux/irq.h>
>  #include <linux/mutex.h>
>  #include <linux/pinctrl/pinctrl.h>
>  
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 9568708a550b..b81269c00381 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -3,6 +3,7 @@
>  #include <linux/module.h>
>  #include <linux/interrupt.h>
>  #include <linux/irq.h>
> +#include <linux/irqdomain.h>
>  #include <linux/spinlock.h>
>  #include <linux/list.h>
>  #include <linux/device.h>
> @@ -17,6 +18,7 @@
>  #include <linux/gpio/driver.h>
>  #include <linux/gpio/machine.h>
>  #include <linux/pinctrl/consumer.h>
> +#include <linux/pinctrl/pinconf-generic.h>
>  #include <linux/cdev.h>
>  #include <linux/fs.h>
>  #include <linux/uaccess.h>
> diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
> index af20369ec8e7..07b595e24695 100644
> --- a/include/linux/gpio/driver.h
> +++ b/include/linux/gpio/driver.h
> @@ -1,21 +1,22 @@
>  #ifndef __LINUX_GPIO_DRIVER_H
>  #define __LINUX_GPIO_DRIVER_H
>  
> -#include <linux/device.h>
>  #include <linux/types.h>
> -#include <linux/irq.h>
> -#include <linux/irqchip/chained_irq.h>
> -#include <linux/irqdomain.h>
> +#include <linux/irqhandler.h>
>  #include <linux/lockdep.h>
>  #include <linux/pinctrl/pinctrl.h>
> -#include <linux/pinctrl/pinconf-generic.h>
> +#include <linux/spinlock_types.h>
>  
>  struct gpio_desc;
>  struct of_phandle_args;
> +struct device;
>  struct device_node;
> +struct irq_chip;
> +struct irq_domain;
>  struct seq_file;
>  struct gpio_device;
>  struct module;
> +struct pinctrl_dev;
>  
>  #ifdef CONFIG_GPIOLIB
>
Masahiro Yamada July 4, 2017, 10:39 a.m. UTC | #3
2017-07-04 19:06 GMT+09:00 Andy Shevchenko <andriy.shevchenko@linux.intel.com>:
> On Tue, 2017-07-04 at 12:53 +0900, Masahiro Yamada wrote:
>> Some of include directives in include/linux/gpio/driver.h are
>> unneeded because the header does not need to know the content of
>> struct device, irq_chip, etc.  Just declare they are structures.
>>
>> On the other hand, <linux/irqhandler.h> and <linux/spinlock_types.h>
>> turned out to be necessary for irq_flow_handler_t and spinlock_t,
>> respectively.
>>
>> Each driver should include what it needs without relying on what is
>> implicitly included from <linux/gpio/driver.h>.  This will cut down
>> unnecessary header parsing.
>
> If Linus is okay with the following proposal I would rather go with it,
> i.e. logical split the series to
>
> 1. Fix IRQ related headers inclusion
> 2. Fix pinconf-generic.h inclusion
> 3. Fix OF headers inclusion (btw, of_gpio.h is not enough there?)

Maybe
  4.  Fix (platform_)device inclusion


But, I do not see much sense to touch headers multiple times.
William Breathitt Gray July 4, 2017, 12:58 p.m. UTC | #4
On Tue, Jul 04, 2017 at 12:53:34PM +0900, Masahiro Yamada wrote:
>Some of include directives in include/linux/gpio/driver.h are
>unneeded because the header does not need to know the content of
>struct device, irq_chip, etc.  Just declare they are structures.
>
>On the other hand, <linux/irqhandler.h> and <linux/spinlock_types.h>
>turned out to be necessary for irq_flow_handler_t and spinlock_t,
>respectively.
>
>Each driver should include what it needs without relying on what is
>implicitly included from <linux/gpio/driver.h>.  This will cut down
>unnecessary header parsing.
>
>Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>---
>
> drivers/gpio/gpio-104-dio-48e.c  |  1 +
> drivers/gpio/gpio-104-idi-48.c   |  1 +
> drivers/gpio/gpio-104-idio-16.c  |  1 +
> drivers/gpio/gpio-pci-idio-16.c  |  2 ++
> drivers/gpio/gpio-ws16c48.c      |  1 +

The changes to the above drivers look fine to me:

Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>

However, this patch as a whole does too many things; I'd like to see it
split-up logically similar to how Andy Shevchenko suggested in his
reply. That should allow ACKs by respective driver maintainers to be
accounted more properly.

William Breathitt Gray
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Masahiro Yamada July 4, 2017, 3:43 p.m. UTC | #5
2017-07-04 21:58 GMT+09:00 William Breathitt Gray <vilhelm.gray@gmail.com>:
> On Tue, Jul 04, 2017 at 12:53:34PM +0900, Masahiro Yamada wrote:
>>Some of include directives in include/linux/gpio/driver.h are
>>unneeded because the header does not need to know the content of
>>struct device, irq_chip, etc.  Just declare they are structures.
>>
>>On the other hand, <linux/irqhandler.h> and <linux/spinlock_types.h>
>>turned out to be necessary for irq_flow_handler_t and spinlock_t,
>>respectively.
>>
>>Each driver should include what it needs without relying on what is
>>implicitly included from <linux/gpio/driver.h>.  This will cut down
>>unnecessary header parsing.
>>
>>Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>---
>>
>> drivers/gpio/gpio-104-dio-48e.c  |  1 +
>> drivers/gpio/gpio-104-idi-48.c   |  1 +
>> drivers/gpio/gpio-104-idio-16.c  |  1 +
>> drivers/gpio/gpio-pci-idio-16.c  |  2 ++
>> drivers/gpio/gpio-ws16c48.c      |  1 +
>
> The changes to the above drivers look fine to me:
>
> Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
>
> However, this patch as a whole does too many things; I'd like to see it
> split-up logically similar to how Andy Shevchenko suggested in his
> reply. That should allow ACKs by respective driver maintainers to be
> accounted more properly.
>
> William Breathitt Gray


I was missing a very important thing.

<linux/gpio/driver.h> is used in various subsystems.

I tested only under drivers/gpio/, but
drivers/pinctrl/ is one of the biggest source of compile errors.

(Probably I will get reports from kbuild test robot.)


So, I need to think about how to merge this (if the basic idea of this is OK).

Maybe,

[1] Send patches to subsystems (gpio, pinctrl, etc.) for v4.14
[2] Drop unneeded includes from linux/gpio/driver.h for v4.15
Andy Shevchenko July 4, 2017, 3:51 p.m. UTC | #6
On Tue, Jul 4, 2017 at 6:43 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> 2017-07-04 21:58 GMT+09:00 William Breathitt Gray <vilhelm.gray@gmail.com>:

> So, I need to think about how to merge this (if the basic idea of this is OK).
>
> Maybe,
>
> [1] Send patches to subsystems (gpio, pinctrl, etc.) for v4.14
> [2] Drop unneeded includes from linux/gpio/driver.h for v4.15

Perhaps, fixing users (drivers!) first. then frameworks / libraries,
at last header itself (in each case perhaps follow the split I
proposed earlier).

My wish is to get gpiolib-acpi patch completely separate from the bunch.
kernel test robot July 6, 2017, 6:13 a.m. UTC | #7
Hi Masahiro,

[auto build test ERROR on next-20170705]
[cannot apply to gpio/for-next tegra/for-next xlnx/master v4.12 v4.12-rc7 v4.12-rc6 v4.12]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Masahiro-Yamada/gpio-drop-unnecessary-includes-from-include-linux-gpio-driver-h/20170706-123711
config: blackfin-allyesconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=blackfin 

All error/warnings (new ones prefixed by >>):

   drivers//i2c/muxes/i2c-mux-ltc4306.c: In function 'ltc4306_gpio_set_config':
>> drivers//i2c/muxes/i2c-mux-ltc4306.c:138:10: error: implicit declaration of function 'pinconf_to_config_param' [-Werror=implicit-function-declaration]
     switch (pinconf_to_config_param(config)) {
             ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers//i2c/muxes/i2c-mux-ltc4306.c:139:7: error: 'PIN_CONFIG_DRIVE_OPEN_DRAIN' undeclared (first use in this function)
     case PIN_CONFIG_DRIVE_OPEN_DRAIN:
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers//i2c/muxes/i2c-mux-ltc4306.c:139:7: note: each undeclared identifier is reported only once for each function it appears in
>> drivers//i2c/muxes/i2c-mux-ltc4306.c:142:7: error: 'PIN_CONFIG_DRIVE_PUSH_PULL' undeclared (first use in this function)
     case PIN_CONFIG_DRIVE_PUSH_PULL:
          ^~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   drivers//staging/greybus/gpio.c: In function 'gb_gpio_set_config':
>> drivers//staging/greybus/gpio.c:483:6: error: implicit declaration of function 'pinconf_to_config_param' [-Werror=implicit-function-declaration]
     if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE)
         ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers//staging/greybus/gpio.c:483:41: error: 'PIN_CONFIG_INPUT_DEBOUNCE' undeclared (first use in this function)
     if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE)
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers//staging/greybus/gpio.c:483:41: note: each undeclared identifier is reported only once for each function it appears in
>> drivers//staging/greybus/gpio.c:486:13: error: implicit declaration of function 'pinconf_to_config_argument' [-Werror=implicit-function-declaration]
     debounce = pinconf_to_config_argument(config);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   drivers/usb/serial/cp210x.c: In function 'cp210x_gpio_set_config':
>> drivers/usb/serial/cp210x.c:1340:7: error: variable 'param' has initializer but incomplete type
     enum pin_config_param param = pinconf_to_config_param(config);
          ^~~~~~~~~~~~~~~~
>> drivers/usb/serial/cp210x.c:1340:32: error: implicit declaration of function 'pinconf_to_config_param' [-Werror=implicit-function-declaration]
     enum pin_config_param param = pinconf_to_config_param(config);
                                   ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/serial/cp210x.c:1340:24: error: storage size of 'param' isn't known
     enum pin_config_param param = pinconf_to_config_param(config);
                           ^~~~~
>> drivers/usb/serial/cp210x.c:1343:16: error: 'PIN_CONFIG_DRIVE_PUSH_PULL' undeclared (first use in this function)
     if ((param == PIN_CONFIG_DRIVE_PUSH_PULL) &&
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/serial/cp210x.c:1343:16: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/usb/serial/cp210x.c:1347:16: error: 'PIN_CONFIG_DRIVE_OPEN_DRAIN' undeclared (first use in this function)
     if ((param == PIN_CONFIG_DRIVE_OPEN_DRAIN) &&
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/serial/cp210x.c:1340:24: warning: unused variable 'param' [-Wunused-variable]
     enum pin_config_param param = pinconf_to_config_param(config);
                           ^~~~~
   cc1: some warnings being treated as errors
--
   drivers/hid/hid-cp2112.c: In function 'cp2112_gpio_irq_mask':
>> drivers/hid/hid-cp2112.c:1065:25: error: implicit declaration of function 'irq_data_get_irq_chip_data' [-Werror=implicit-function-declaration]
     struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/hid/hid-cp2112.c:1065:25: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
>> drivers/hid/hid-cp2112.c:1068:15: error: dereferencing pointer to incomplete type 'struct irq_data'
     __clear_bit(d->hwirq, &dev->irq_mask);
                  ^~
   drivers/hid/hid-cp2112.c: In function 'cp2112_gpio_irq_unmask':
   drivers/hid/hid-cp2112.c:1073:25: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-cp2112.c: In function 'cp2112_gpio_poll_callback':
>> drivers/hid/hid-cp2112.c:1106:7: error: implicit declaration of function 'irq_get_irq_data' [-Werror=implicit-function-declaration]
      d = irq_get_irq_data(irq);
          ^~~~~~~~~~~~~~~~
>> drivers/hid/hid-cp2112.c:1106:5: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      d = irq_get_irq_data(irq);
        ^
>> drivers/hid/hid-cp2112.c:1110:14: error: implicit declaration of function 'irqd_get_trigger_type' [-Werror=implicit-function-declaration]
      irq_type = irqd_get_trigger_type(d);
                 ^~~~~~~~~~~~~~~~~~~~~
>> drivers/hid/hid-cp2112.c:1115:19: error: 'IRQ_TYPE_LEVEL_HIGH' undeclared (first use in this function)
       if (irq_type & IRQ_TYPE_LEVEL_HIGH)
                      ^~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-cp2112.c:1115:19: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/hid/hid-cp2112.c:1116:5: error: implicit declaration of function 'handle_nested_irq' [-Werror=implicit-function-declaration]
        handle_nested_irq(irq);
        ^~~~~~~~~~~~~~~~~
>> drivers/hid/hid-cp2112.c:1118:20: error: 'IRQ_TYPE_EDGE_RISING' undeclared (first use in this function)
       if ((irq_type & IRQ_TYPE_EDGE_RISING) &&
                       ^~~~~~~~~~~~~~~~~~~~
>> drivers/hid/hid-cp2112.c:1124:19: error: 'IRQ_TYPE_LEVEL_LOW' undeclared (first use in this function)
       if (irq_type & IRQ_TYPE_LEVEL_LOW)
                      ^~~~~~~~~~~~~~~~~~
>> drivers/hid/hid-cp2112.c:1127:20: error: 'IRQ_TYPE_EDGE_FALLING' undeclared (first use in this function)
       if ((irq_type & IRQ_TYPE_EDGE_FALLING) &&
                       ^~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-cp2112.c: In function 'cp2112_gpio_irq_startup':
   drivers/hid/hid-cp2112.c:1143:25: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-cp2112.c: In function 'cp2112_gpio_irq_shutdown':
   drivers/hid/hid-cp2112.c:1161:25: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-cp2112.c: At top level:
>> drivers/hid/hid-cp2112.c:1172:15: error: variable 'cp2112_gpio_irqchip' has initializer but incomplete type
    static struct irq_chip cp2112_gpio_irqchip = {
                  ^~~~~~~~
>> drivers/hid/hid-cp2112.c:1173:2: error: unknown field 'name' specified in initializer
     .name = "cp2112-gpio",
     ^
>> drivers/hid/hid-cp2112.c:1173:10: warning: excess elements in struct initializer
     .name = "cp2112-gpio",
             ^~~~~~~~~~~~~
   drivers/hid/hid-cp2112.c:1173:10: note: (near initialization for 'cp2112_gpio_irqchip')
>> drivers/hid/hid-cp2112.c:1174:2: error: unknown field 'irq_startup' specified in initializer
     .irq_startup = cp2112_gpio_irq_startup,
     ^
   drivers/hid/hid-cp2112.c:1174:17: warning: excess elements in struct initializer
     .irq_startup = cp2112_gpio_irq_startup,
                    ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-cp2112.c:1174:17: note: (near initialization for 'cp2112_gpio_irqchip')
>> drivers/hid/hid-cp2112.c:1175:2: error: unknown field 'irq_shutdown' specified in initializer
     .irq_shutdown = cp2112_gpio_irq_shutdown,
     ^
   drivers/hid/hid-cp2112.c:1175:18: warning: excess elements in struct initializer
     .irq_shutdown = cp2112_gpio_irq_shutdown,
                     ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-cp2112.c:1175:18: note: (near initialization for 'cp2112_gpio_irqchip')
>> drivers/hid/hid-cp2112.c:1176:2: error: unknown field 'irq_ack' specified in initializer
     .irq_ack = cp2112_gpio_irq_ack,
     ^
   drivers/hid/hid-cp2112.c:1176:13: warning: excess elements in struct initializer
     .irq_ack = cp2112_gpio_irq_ack,
                ^~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-cp2112.c:1176:13: note: (near initialization for 'cp2112_gpio_irqchip')
>> drivers/hid/hid-cp2112.c:1177:2: error: unknown field 'irq_mask' specified in initializer
     .irq_mask = cp2112_gpio_irq_mask,
     ^
   drivers/hid/hid-cp2112.c:1177:14: warning: excess elements in struct initializer
     .irq_mask = cp2112_gpio_irq_mask,
                 ^~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-cp2112.c:1177:14: note: (near initialization for 'cp2112_gpio_irqchip')
>> drivers/hid/hid-cp2112.c:1178:2: error: unknown field 'irq_unmask' specified in initializer
     .irq_unmask = cp2112_gpio_irq_unmask,
     ^
   drivers/hid/hid-cp2112.c:1178:16: warning: excess elements in struct initializer
     .irq_unmask = cp2112_gpio_irq_unmask,
                   ^~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-cp2112.c:1178:16: note: (near initialization for 'cp2112_gpio_irqchip')
>> drivers/hid/hid-cp2112.c:1179:2: error: unknown field 'irq_set_type' specified in initializer
     .irq_set_type = cp2112_gpio_irq_type,
     ^
   drivers/hid/hid-cp2112.c:1179:18: warning: excess elements in struct initializer
     .irq_set_type = cp2112_gpio_irq_type,
                     ^~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-cp2112.c:1179:18: note: (near initialization for 'cp2112_gpio_irqchip')
   drivers/hid/hid-cp2112.c: In function 'cp2112_probe':

vim +/pinconf_to_config_param +138 drivers//i2c/muxes/i2c-mux-ltc4306.c

dbed8a80 Michael Hennerich 2017-04-11  132  static int ltc4306_gpio_set_config(struct gpio_chip *chip,
dbed8a80 Michael Hennerich 2017-04-11  133  				   unsigned int offset, unsigned long config)
dbed8a80 Michael Hennerich 2017-04-11  134  {
dbed8a80 Michael Hennerich 2017-04-11  135  	struct ltc4306 *data = gpiochip_get_data(chip);
dbed8a80 Michael Hennerich 2017-04-11  136  	unsigned int val;
dbed8a80 Michael Hennerich 2017-04-11  137  
dbed8a80 Michael Hennerich 2017-04-11 @138  	switch (pinconf_to_config_param(config)) {
dbed8a80 Michael Hennerich 2017-04-11 @139  	case PIN_CONFIG_DRIVE_OPEN_DRAIN:
dbed8a80 Michael Hennerich 2017-04-11  140  		val = 0;
dbed8a80 Michael Hennerich 2017-04-11  141  		break;
dbed8a80 Michael Hennerich 2017-04-11 @142  	case PIN_CONFIG_DRIVE_PUSH_PULL:
dbed8a80 Michael Hennerich 2017-04-11  143  		val = BIT(4 - offset);
dbed8a80 Michael Hennerich 2017-04-11  144  		break;
dbed8a80 Michael Hennerich 2017-04-11  145  	default:

:::::: The code at line 138 was first introduced by commit
:::::: dbed8a803bd3fb64339a6180adaff2cec46242ce i2c: mux: ltc4306: LTC4306 and LTC4305 I2C multiplexer/switch

:::::: TO: Michael Hennerich <michael.hennerich@analog.com>
:::::: CC: Peter Rosin <peda@axentia.se>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot July 6, 2017, 6:15 a.m. UTC | #8
Hi Masahiro,

[auto build test ERROR on next-20170705]
[cannot apply to gpio/for-next tegra/for-next xlnx/master v4.12 v4.12-rc7 v4.12-rc6 v4.12]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Masahiro-Yamada/gpio-drop-unnecessary-includes-from-include-linux-gpio-driver-h/20170706-123711
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   drivers//gpio/gpio-exar.c: In function 'gpio_exar_probe':
>> drivers//gpio/gpio-exar.c:135:2: error: implicit declaration of function 'device_property_read_u32' [-Werror=implicit-function-declaration]
     ret = device_property_read_u32(&pdev->dev, "linux,first-pin",
     ^
   cc1: some warnings being treated as errors
--
   drivers//gpio/gpio-lp87565.c: In function 'lp87565_gpio_set_config':
>> drivers//gpio/gpio-lp87565.c:116:2: error: implicit declaration of function 'pinconf_to_config_param' [-Werror=implicit-function-declaration]
     switch (pinconf_to_config_param(config)) {
     ^
>> drivers//gpio/gpio-lp87565.c:117:7: error: 'PIN_CONFIG_DRIVE_OPEN_DRAIN' undeclared (first use in this function)
     case PIN_CONFIG_DRIVE_OPEN_DRAIN:
          ^
   drivers//gpio/gpio-lp87565.c:117:7: note: each undeclared identifier is reported only once for each function it appears in
>> drivers//gpio/gpio-lp87565.c:124:7: error: 'PIN_CONFIG_DRIVE_PUSH_PULL' undeclared (first use in this function)
     case PIN_CONFIG_DRIVE_PUSH_PULL:
          ^
   cc1: some warnings being treated as errors

vim +/device_property_read_u32 +135 drivers//gpio/gpio-exar.c

6596e59e Sudip Mukherjee 2017-01-19  119  static int gpio_exar_probe(struct platform_device *pdev)
6596e59e Sudip Mukherjee 2017-01-19  120  {
d3936d74 Jan Kiszka      2017-06-09  121  	struct pci_dev *pcidev = to_pci_dev(pdev->dev.parent);
6596e59e Sudip Mukherjee 2017-01-19  122  	struct exar_gpio_chip *exar_gpio;
380b1e2f Jan Kiszka      2017-05-22  123  	u32 first_pin, ngpios;
6596e59e Sudip Mukherjee 2017-01-19  124  	void __iomem *p;
6596e59e Sudip Mukherjee 2017-01-19  125  	int index, ret;
6596e59e Sudip Mukherjee 2017-01-19  126  
6596e59e Sudip Mukherjee 2017-01-19  127  	/*
8847f5f9 Jan Kiszka      2017-05-02  128  	 * The UART driver must have mapped region 0 prior to registering this
8847f5f9 Jan Kiszka      2017-05-02  129  	 * device - use it.
6596e59e Sudip Mukherjee 2017-01-19  130  	 */
8847f5f9 Jan Kiszka      2017-05-02  131  	p = pcim_iomap_table(pcidev)[0];
6596e59e Sudip Mukherjee 2017-01-19  132  	if (!p)
6596e59e Sudip Mukherjee 2017-01-19  133  		return -ENOMEM;
6596e59e Sudip Mukherjee 2017-01-19  134  
380b1e2f Jan Kiszka      2017-05-22 @135  	ret = device_property_read_u32(&pdev->dev, "linux,first-pin",
380b1e2f Jan Kiszka      2017-05-22  136  				       &first_pin);
380b1e2f Jan Kiszka      2017-05-22  137  	if (ret)
380b1e2f Jan Kiszka      2017-05-22  138  		return ret;
380b1e2f Jan Kiszka      2017-05-22  139  
380b1e2f Jan Kiszka      2017-05-22  140  	ret = device_property_read_u32(&pdev->dev, "ngpios", &ngpios);
380b1e2f Jan Kiszka      2017-05-22  141  	if (ret)
380b1e2f Jan Kiszka      2017-05-22  142  		return ret;
380b1e2f Jan Kiszka      2017-05-22  143  

:::::: The code at line 135 was first introduced by commit
:::::: 380b1e2f3a2f32bfe9c0aa85a68629eb99b043c0 gpio-exar/8250-exar: Make set of exported GPIOs configurable

:::::: TO: Jan Kiszka <jan.kiszka@siemens.com>
:::::: CC: Jan Kiszka <jan.kiszka@siemens.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Linus Walleij July 31, 2017, 1:48 p.m. UTC | #9
On Tue, Jul 4, 2017 at 12:06 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Tue, 2017-07-04 at 12:53 +0900, Masahiro Yamada wrote:
>> Some of include directives in include/linux/gpio/driver.h are
>> unneeded because the header does not need to know the content of
>> struct device, irq_chip, etc.  Just declare they are structures.
>>
>> On the other hand, <linux/irqhandler.h> and <linux/spinlock_types.h>
>> turned out to be necessary for irq_flow_handler_t and spinlock_t,
>> respectively.
>>
>> Each driver should include what it needs without relying on what is
>> implicitly included from <linux/gpio/driver.h>.  This will cut down
>> unnecessary header parsing.
>
> If Linus is okay with the following proposal I would rather go with it,
> i.e. logical split the series to
>
> 1. Fix IRQ related headers inclusion
> 2. Fix pinconf-generic.h inclusion
> 3. Fix OF headers inclusion (btw, of_gpio.h is not enough there?)

That works fine with me, but also one big patch actually, I do not
want to make it too much work to refactor obviously incorrect things.

As soon as we have rough consensus on this and the build robot
are happy I will apply it to GPIO and also pull it into the pinctrl
subsystem.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andy Shevchenko July 31, 2017, 2:04 p.m. UTC | #10
On Mon, 2017-07-31 at 15:48 +0200, Linus Walleij wrote:
> On Tue, Jul 4, 2017 at 12:06 PM, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Tue, 2017-07-04 at 12:53 +0900, Masahiro Yamada wrote:
> > > Some of include directives in include/linux/gpio/driver.h are
> > > unneeded because the header does not need to know the content of
> > > struct device, irq_chip, etc.  Just declare they are structures.
> > > 
> > > On the other hand, <linux/irqhandler.h> and
> > > <linux/spinlock_types.h>
> > > turned out to be necessary for irq_flow_handler_t and spinlock_t,
> > > respectively.
> > > 
> > > Each driver should include what it needs without relying on what
> > > is
> > > implicitly included from <linux/gpio/driver.h>.  This will cut
> > > down
> > > unnecessary header parsing.
> > 
> > If Linus is okay with the following proposal I would rather go with
> > it,
> > i.e. logical split the series to
> > 
> > 1. Fix IRQ related headers inclusion
> > 2. Fix pinconf-generic.h inclusion
> > 3. Fix OF headers inclusion (btw, of_gpio.h is not enough there?)
> 
> That works fine with me, but also one big patch actually, I do not
> want to make it too much work to refactor obviously incorrect things.
> 
> As soon as we have rough consensus on this and the build robot
> are happy I will apply it to GPIO and also pull it into the pinctrl
> subsystem.

For me priorities like this:
1) it works after the patch being applied (no regressions);
2) it makes code cleaner at the end;
3) it is presented in logically split parts.

So, as long as 1) and 2) are satisfied I can neglect on 3).
Linus Walleij Aug. 1, 2017, 7:53 a.m. UTC | #11
On Mon, Jul 31, 2017 at 4:04 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Mon, 2017-07-31 at 15:48 +0200, Linus Walleij wrote:
>> On Tue, Jul 4, 2017 at 12:06 PM, Andy Shevchenko
>> <andriy.shevchenko@linux.intel.com> wrote:
>> > On Tue, 2017-07-04 at 12:53 +0900, Masahiro Yamada wrote:
>> > > Some of include directives in include/linux/gpio/driver.h are
>> > > unneeded because the header does not need to know the content of
>> > > struct device, irq_chip, etc.  Just declare they are structures.
>> > >
>> > > On the other hand, <linux/irqhandler.h> and
>> > > <linux/spinlock_types.h>
>> > > turned out to be necessary for irq_flow_handler_t and spinlock_t,
>> > > respectively.
>> > >
>> > > Each driver should include what it needs without relying on what
>> > > is
>> > > implicitly included from <linux/gpio/driver.h>.  This will cut
>> > > down
>> > > unnecessary header parsing.
>> >
>> > If Linus is okay with the following proposal I would rather go with
>> > it,
>> > i.e. logical split the series to
>> >
>> > 1. Fix IRQ related headers inclusion
>> > 2. Fix pinconf-generic.h inclusion
>> > 3. Fix OF headers inclusion (btw, of_gpio.h is not enough there?)
>>
>> That works fine with me, but also one big patch actually, I do not
>> want to make it too much work to refactor obviously incorrect things.
>>
>> As soon as we have rough consensus on this and the build robot
>> are happy I will apply it to GPIO and also pull it into the pinctrl
>> subsystem.
>
> For me priorities like this:
> 1) it works after the patch being applied (no regressions);
> 2) it makes code cleaner at the end;
> 3) it is presented in logically split parts.
>
> So, as long as 1) and 2) are satisfied I can neglect on 3).

We are in violent agreement :D

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andy Shevchenko Aug. 1, 2017, 11:04 a.m. UTC | #12
On Tue, Aug 1, 2017 at 10:53 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Mon, Jul 31, 2017 at 4:04 PM, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
>> On Mon, 2017-07-31 at 15:48 +0200, Linus Walleij wrote:
>>> On Tue, Jul 4, 2017 at 12:06 PM, Andy Shevchenko
>>> <andriy.shevchenko@linux.intel.com> wrote:

>>> > If Linus is okay with the following proposal I would rather go with
>>> > it,
>>> > i.e. logical split the series to
>>> >
>>> > 1. Fix IRQ related headers inclusion
>>> > 2. Fix pinconf-generic.h inclusion
>>> > 3. Fix OF headers inclusion (btw, of_gpio.h is not enough there?)
>>>
>>> That works fine with me, but also one big patch actually, I do not
>>> want to make it too much work to refactor obviously incorrect things.
>>>
>>> As soon as we have rough consensus on this and the build robot
>>> are happy I will apply it to GPIO and also pull it into the pinctrl
>>> subsystem.
>>
>> For me priorities like this:
>> 1) it works after the patch being applied (no regressions);
>> 2) it makes code cleaner at the end;
>> 3) it is presented in logically split parts.
>>
>> So, as long as 1) and 2) are satisfied I can neglect on 3).
>
> We are in violent agreement :D

What I would like to say is that is up to you after all :-)
For me looks better to split.
Thor Thayer Aug. 1, 2017, 6:57 p.m. UTC | #13
On 07/03/2017 10:53 PM, Masahiro Yamada wrote:
> Some of include directives in include/linux/gpio/driver.h are
> unneeded because the header does not need to know the content of
> struct device, irq_chip, etc.  Just declare they are structures.
> 
> On the other hand, <linux/irqhandler.h> and <linux/spinlock_types.h>
> turned out to be necessary for irq_flow_handler_t and spinlock_t,
> respectively.
> 
> Each driver should include what it needs without relying on what is
> implicitly included from <linux/gpio/driver.h>.  This will cut down
> unnecessary header parsing.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>   drivers/gpio/gpio-altera-a10sr.c |  2 ++
>   drivers/gpio/gpio-altera.c       |  3 +++

For the Altera GPIO files:

Acked-by: Thor Thayer <thor.thayer@linux.intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Masahiro Yamada Aug. 2, 2017, 1:19 a.m. UTC | #14
Hi.

2017-08-01 20:04 GMT+09:00 Andy Shevchenko <andy.shevchenko@gmail.com>:
> On Tue, Aug 1, 2017 at 10:53 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
>> On Mon, Jul 31, 2017 at 4:04 PM, Andy Shevchenko
>> <andriy.shevchenko@linux.intel.com> wrote:
>>> On Mon, 2017-07-31 at 15:48 +0200, Linus Walleij wrote:
>>>> On Tue, Jul 4, 2017 at 12:06 PM, Andy Shevchenko
>>>> <andriy.shevchenko@linux.intel.com> wrote:
>
>>>> > If Linus is okay with the following proposal I would rather go with
>>>> > it,
>>>> > i.e. logical split the series to
>>>> >
>>>> > 1. Fix IRQ related headers inclusion
>>>> > 2. Fix pinconf-generic.h inclusion
>>>> > 3. Fix OF headers inclusion (btw, of_gpio.h is not enough there?)
>>>>
>>>> That works fine with me, but also one big patch actually, I do not
>>>> want to make it too much work to refactor obviously incorrect things.
>>>>
>>>> As soon as we have rough consensus on this and the build robot
>>>> are happy I will apply it to GPIO and also pull it into the pinctrl
>>>> subsystem.
>>>
>>> For me priorities like this:
>>> 1) it works after the patch being applied (no regressions);
>>> 2) it makes code cleaner at the end;
>>> 3) it is presented in logically split parts.
>>>
>>> So, as long as 1) and 2) are satisfied I can neglect on 3).
>>
>> We are in violent agreement :D
>
> What I would like to say is that is up to you after all :-)
> For me looks better to split.



I will split this into sensible chunks.


As I mentioned before, linux/gpio/driver.h is included from several sub-systems,
so I need at least two development cycles to finish this task.


Maybe,

[1] Send patches to subsystems (gpio, pinctrl, etc.) for v4.14
     (splitting into sensible chunks, like per-driver)
[2] Drop unneeded includes from linux/gpio/driver.h for v4.15
diff mbox

Patch

diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c
index 598e209efa2d..bdc52be7902a 100644
--- a/drivers/gpio/gpio-104-dio-48e.c
+++ b/drivers/gpio/gpio-104-dio-48e.c
@@ -22,6 +22,7 @@ 
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
 #include <linux/irqdesc.h>
+#include <linux/irqdomain.h>
 #include <linux/isa.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c
index 51f046e29ff7..7bbb0e8573d1 100644
--- a/drivers/gpio/gpio-104-idi-48.c
+++ b/drivers/gpio/gpio-104-idi-48.c
@@ -22,6 +22,7 @@ 
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
 #include <linux/irqdesc.h>
+#include <linux/irqdomain.h>
 #include <linux/isa.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
diff --git a/drivers/gpio/gpio-104-idio-16.c b/drivers/gpio/gpio-104-idio-16.c
index ec2ce34ff473..7e3fc0bf3398 100644
--- a/drivers/gpio/gpio-104-idio-16.c
+++ b/drivers/gpio/gpio-104-idio-16.c
@@ -22,6 +22,7 @@ 
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
 #include <linux/irqdesc.h>
+#include <linux/irqdomain.h>
 #include <linux/isa.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
diff --git a/drivers/gpio/gpio-altera-a10sr.c b/drivers/gpio/gpio-altera-a10sr.c
index 16a8951b2bed..4cdca9332043 100644
--- a/drivers/gpio/gpio-altera-a10sr.c
+++ b/drivers/gpio/gpio-altera-a10sr.c
@@ -21,6 +21,8 @@ 
 #include <linux/gpio/driver.h>
 #include <linux/mfd/altera-a10sr.h>
 #include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
 
 /**
  * struct altr_a10sr_gpio - Altera Max5 GPIO device private data structure
diff --git a/drivers/gpio/gpio-altera.c b/drivers/gpio/gpio-altera.c
index 17485dc20384..40b26274acaf 100644
--- a/drivers/gpio/gpio-altera.c
+++ b/drivers/gpio/gpio-altera.c
@@ -17,6 +17,9 @@ 
  */
 
 #include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
 #include <linux/module.h>
 #include <linux/of_gpio.h>
 #include <linux/platform_device.h>
diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 4ca436e66bdb..a9d575e215da 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -15,9 +15,14 @@ 
 #include <linux/hashtable.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/pinctrl/consumer.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
 #include <linux/string.h>
diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c
index f33d4a5fe671..1249ab0f8f4f 100644
--- a/drivers/gpio/gpio-ath79.c
+++ b/drivers/gpio/gpio-ath79.c
@@ -17,6 +17,8 @@ 
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/irq.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
 
 #define AR71XX_GPIO_REG_OE		0x00
 #define AR71XX_GPIO_REG_IN		0x04
diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c
index dfcf56ee3c61..937d646d184b 100644
--- a/drivers/gpio/gpio-bcm-kona.c
+++ b/drivers/gpio/gpio-bcm-kona.c
@@ -23,6 +23,7 @@ 
 #include <linux/init.h>
 #include <linux/irqdomain.h>
 #include <linux/irqchip/chained_irq.h>
+#include <linux/pinctrl/pinconf-generic.h>
 
 #define BCM_GPIO_PASSWD				0x00a5a501
 #define GPIO_PER_BANK				32
diff --git a/drivers/gpio/gpio-clps711x.c b/drivers/gpio/gpio-clps711x.c
index 52fd63f02134..1f499b5e7f91 100644
--- a/drivers/gpio/gpio-clps711x.c
+++ b/drivers/gpio/gpio-clps711x.c
@@ -12,6 +12,7 @@ 
 #include <linux/err.h>
 #include <linux/module.h>
 #include <linux/gpio/driver.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 
 static int clps711x_gpio_probe(struct platform_device *pdev)
diff --git a/drivers/gpio/gpio-crystalcove.c b/drivers/gpio/gpio-crystalcove.c
index e60156ec0c18..0f66ae796d4a 100644
--- a/drivers/gpio/gpio-crystalcove.c
+++ b/drivers/gpio/gpio-crystalcove.c
@@ -16,6 +16,8 @@ 
  */
 
 #include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
diff --git a/drivers/gpio/gpio-dln2.c b/drivers/gpio/gpio-dln2.c
index aecb847166f5..d524f3390196 100644
--- a/drivers/gpio/gpio-dln2.c
+++ b/drivers/gpio/gpio-dln2.c
@@ -17,6 +17,7 @@ 
 #include <linux/irqchip/chained_irq.h>
 #include <linux/gpio.h>
 #include <linux/gpio/driver.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_device.h>
 #include <linux/mfd/dln2.h>
 
diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index c07ada9c7af6..350454b9359e 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -23,6 +23,7 @@ 
 #include <linux/of_address.h>
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
 #include <linux/spinlock.h>
diff --git a/drivers/gpio/gpio-etraxfs.c b/drivers/gpio/gpio-etraxfs.c
index 14c6aac26780..ef518aacbeac 100644
--- a/drivers/gpio/gpio-etraxfs.c
+++ b/drivers/gpio/gpio-etraxfs.c
@@ -4,6 +4,7 @@ 
 #include <linux/of_gpio.h>
 #include <linux/io.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/platform_device.h>
 
 #define ETRAX_FS_rw_pa_dout	0
diff --git a/drivers/gpio/gpio-f7188x.c b/drivers/gpio/gpio-f7188x.c
index 13350c9d7f5e..08604a76d543 100644
--- a/drivers/gpio/gpio-f7188x.c
+++ b/drivers/gpio/gpio-f7188x.c
@@ -17,6 +17,7 @@ 
 #include <linux/io.h>
 #include <linux/gpio/driver.h>
 #include <linux/bitops.h>
+#include <linux/pinctrl/pinconf-generic.h>
 
 #define DRVNAME "gpio-f7188x"
 
diff --git a/drivers/gpio/gpio-ftgpio010.c b/drivers/gpio/gpio-ftgpio010.c
index e9386f8b67f5..699a3709e357 100644
--- a/drivers/gpio/gpio-ftgpio010.c
+++ b/drivers/gpio/gpio-ftgpio010.c
@@ -12,6 +12,9 @@ 
 #include <linux/gpio/driver.h>
 #include <linux/io.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
 #include <linux/platform_device.h>
 #include <linux/of_gpio.h>
 #include <linux/bitops.h>
diff --git a/drivers/gpio/gpio-ingenic.c b/drivers/gpio/gpio-ingenic.c
index 254780730b95..7ec8de5ee926 100644
--- a/drivers/gpio/gpio-ingenic.c
+++ b/drivers/gpio/gpio-ingenic.c
@@ -9,6 +9,7 @@ 
 #include <linux/gpio/driver.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/irqchip/chained_irq.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
diff --git a/drivers/gpio/gpio-intel-mid.c b/drivers/gpio/gpio-intel-mid.c
index b76ecee82c3f..af6b7d27ee41 100644
--- a/drivers/gpio/gpio-intel-mid.c
+++ b/drivers/gpio/gpio-intel-mid.c
@@ -23,6 +23,8 @@ 
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
 #include <linux/gpio/driver.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
diff --git a/drivers/gpio/gpio-lp873x.c b/drivers/gpio/gpio-lp873x.c
index df0ad2cef0d2..1cd5e7e08ad9 100644
--- a/drivers/gpio/gpio-lp873x.c
+++ b/drivers/gpio/gpio-lp873x.c
@@ -16,6 +16,7 @@ 
 
 #include <linux/gpio.h>
 #include <linux/module.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 
diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
index fbd393b46ce0..9adbbac2ba5b 100644
--- a/drivers/gpio/gpio-lynxpoint.c
+++ b/drivers/gpio/gpio-lynxpoint.c
@@ -25,6 +25,8 @@ 
 #include <linux/types.h>
 #include <linux/bitops.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
 #include <linux/gpio.h>
 #include <linux/slab.h>
 #include <linux/acpi.h>
diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index 7f4d26ce5f23..c277278af532 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -20,6 +20,7 @@ 
 #include <linux/gpio/driver.h>
 #include <linux/interrupt.h>
 #include <linux/i2c.h>
+#include <linux/irq.h>
 #include <linux/platform_data/max732x.h>
 #include <linux/of.h>
 
diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c
index 743459d9477d..35dd0f133028 100644
--- a/drivers/gpio/gpio-max77620.c
+++ b/drivers/gpio/gpio-max77620.c
@@ -12,6 +12,7 @@ 
 #include <linux/interrupt.h>
 #include <linux/mfd/max77620.h>
 #include <linux/module.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 
diff --git a/drivers/gpio/gpio-menz127.c b/drivers/gpio/gpio-menz127.c
index e1037582e34d..f265a841f787 100644
--- a/drivers/gpio/gpio-menz127.c
+++ b/drivers/gpio/gpio-menz127.c
@@ -15,6 +15,7 @@ 
 #include <linux/mcb.h>
 #include <linux/bitops.h>
 #include <linux/gpio/driver.h>
+#include <linux/pinctrl/pinconf-generic.h>
 
 #define MEN_Z127_CTRL	0x00
 #define MEN_Z127_PSR	0x04
diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c
index ec8560298805..2d84fcbe060f 100644
--- a/drivers/gpio/gpio-merrifield.c
+++ b/drivers/gpio/gpio-merrifield.c
@@ -14,8 +14,12 @@ 
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
 #include <linux/module.h>
 #include <linux/pci.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/pinctrl/consumer.h>
 
 #define GCCR		0x000	/* controller configuration */
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index f8c550de6c72..7ef062e14777 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -19,6 +19,8 @@ 
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
 #include <linux/device.h>
 #include <linux/pm_runtime.h>
 #include <linux/pm.h>
@@ -26,6 +28,7 @@ 
 #include <linux/of_device.h>
 #include <linux/gpio.h>
 #include <linux/bitops.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_data/gpio-omap.h>
 
 #define OFF_MODE	1
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 4c9e21300a26..58a68ba8311f 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -17,6 +17,7 @@ 
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/of_platform.h>
 #include <linux/platform_data/pca953x.h>
diff --git a/drivers/gpio/gpio-pci-idio-16.c b/drivers/gpio/gpio-pci-idio-16.c
index 7de4f6a2cb49..313da56389f4 100644
--- a/drivers/gpio/gpio-pci-idio-16.c
+++ b/drivers/gpio/gpio-pci-idio-16.c
@@ -16,7 +16,9 @@ 
 #include <linux/errno.h>
 #include <linux/gpio/driver.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/irqdesc.h>
+#include <linux/irqdomain.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
diff --git a/drivers/gpio/gpio-pisosr.c b/drivers/gpio/gpio-pisosr.c
index f5545049c187..4cca0c4dd85a 100644
--- a/drivers/gpio/gpio-pisosr.c
+++ b/drivers/gpio/gpio-pisosr.c
@@ -17,6 +17,7 @@ 
 #include <linux/gpio/driver.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
+#include <linux/of.h>
 #include <linux/spi/spi.h>
 
 #define DEFAULT_NGPIO 8
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index 3d3d6b6645a7..8d502a83babc 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -19,6 +19,7 @@ 
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
 #include <linux/bitops.h>
 #include <linux/gpio.h>
 #include <linux/device.h>
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 4a1536a050bc..9b2b00974163 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -22,6 +22,7 @@ 
 #include <linux/io.h>
 #include <linux/ioport.h>
 #include <linux/irq.h>
+#include <linux/irqdomain.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/pinctrl/consumer.h>
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index 16cbc5702865..0e6fae84c759 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -10,6 +10,8 @@ 
 #include <linux/slab.h>
 #include <linux/gpio.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
 #include <linux/of.h>
 #include <linux/mfd/stmpe.h>
 #include <linux/seq_file.h>
diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
index 433b45ef332e..d0ec9902d9c1 100644
--- a/drivers/gpio/gpio-tc3589x.c
+++ b/drivers/gpio/gpio-tc3589x.c
@@ -12,8 +12,11 @@ 
 #include <linux/gpio/driver.h>
 #include <linux/of.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
 #include <linux/mfd/tc3589x.h>
 #include <linux/bitops.h>
+#include <linux/pinctrl/pinconf-generic.h>
 
 /*
  * These registers are modified under the irq bus lock and cached to avoid
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 88529d3c06c9..5e012377be1e 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -29,6 +29,7 @@ 
 #include <linux/irqdomain.h>
 #include <linux/irqchip/chained_irq.h>
 #include <linux/pinctrl/consumer.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/pm.h>
 
 #define GPIO_BANK(x)		((x) >> 5)
diff --git a/drivers/gpio/gpio-tps65218.c b/drivers/gpio/gpio-tps65218.c
index a379bba57d31..97dca93b0529 100644
--- a/drivers/gpio/gpio-tps65218.c
+++ b/drivers/gpio/gpio-tps65218.c
@@ -15,6 +15,7 @@ 
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/gpio/driver.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/mfd/tps65218.h>
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index 521fbe338589..844bf591268b 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -23,6 +23,9 @@ 
 #include <linux/io.h>
 #include <linux/ioport.h>
 #include <linux/irq.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/pinctrl/consumer.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_device.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
diff --git a/drivers/gpio/gpio-vx855.c b/drivers/gpio/gpio-vx855.c
index 98a6f1fcc561..96331a43c2c1 100644
--- a/drivers/gpio/gpio-vx855.c
+++ b/drivers/gpio/gpio-vx855.c
@@ -28,6 +28,7 @@ 
 #include <linux/gpio.h>
 #include <linux/slab.h>
 #include <linux/device.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_device.h>
 #include <linux/pci.h>
 #include <linux/io.h>
diff --git a/drivers/gpio/gpio-wcove.c b/drivers/gpio/gpio-wcove.c
index 37c103e50ebf..78161e22a859 100644
--- a/drivers/gpio/gpio-wcove.c
+++ b/drivers/gpio/gpio-wcove.c
@@ -18,8 +18,10 @@ 
 #include <linux/bitops.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
+#include <linux/irqdomain.h>
 #include <linux/gpio/driver.h>
 #include <linux/mfd/intel_soc_pmic.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/seq_file.h>
diff --git a/drivers/gpio/gpio-wm831x.c b/drivers/gpio/gpio-wm831x.c
index 938bbe3f831c..b9f2f95a1309 100644
--- a/drivers/gpio/gpio-wm831x.c
+++ b/drivers/gpio/gpio-wm831x.c
@@ -17,6 +17,7 @@ 
 #include <linux/module.h>
 #include <linux/gpio.h>
 #include <linux/mfd/core.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_device.h>
 #include <linux/seq_file.h>
 
diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c
index 1e35756ac55b..f2708fa3eefb 100644
--- a/drivers/gpio/gpio-wm8994.c
+++ b/drivers/gpio/gpio-wm8994.c
@@ -17,6 +17,7 @@ 
 #include <linux/module.h>
 #include <linux/gpio.h>
 #include <linux/mfd/core.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_device.h>
 #include <linux/seq_file.h>
 #include <linux/regmap.h>
diff --git a/drivers/gpio/gpio-ws16c48.c b/drivers/gpio/gpio-ws16c48.c
index 5037974ac063..9eb42b983c75 100644
--- a/drivers/gpio/gpio-ws16c48.c
+++ b/drivers/gpio/gpio-ws16c48.c
@@ -19,6 +19,7 @@ 
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
 #include <linux/irqdesc.h>
+#include <linux/irqdomain.h>
 #include <linux/isa.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
diff --git a/drivers/gpio/gpio-xgene-sb.c b/drivers/gpio/gpio-xgene-sb.c
index 033258634b8c..f0929da6c385 100644
--- a/drivers/gpio/gpio-xgene-sb.c
+++ b/drivers/gpio/gpio-xgene-sb.c
@@ -22,6 +22,8 @@ 
 
 #include <linux/module.h>
 #include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
 #include <linux/platform_device.h>
 #include <linux/of_gpio.h>
 #include <linux/gpio/driver.h>
diff --git a/drivers/gpio/gpio-xlp.c b/drivers/gpio/gpio-xlp.c
index d857e1d8e731..646856127aa6 100644
--- a/drivers/gpio/gpio-xlp.c
+++ b/drivers/gpio/gpio-xlp.c
@@ -17,6 +17,7 @@ 
 #include <linux/of_device.h>
 #include <linux/module.h>
 #include <linux/irq.h>
+#include <linux/irqdomain.h>
 #include <linux/interrupt.h>
 #include <linux/irqchip/chained_irq.h>
 #include <linux/acpi.h>
diff --git a/drivers/gpio/gpio-zx.c b/drivers/gpio/gpio-zx.c
index be3a87da8438..4259ae6ff44c 100644
--- a/drivers/gpio/gpio-zx.c
+++ b/drivers/gpio/gpio-zx.c
@@ -14,6 +14,7 @@ 
 #include <linux/errno.h>
 #include <linux/gpio/driver.h>
 #include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
 #include <linux/init.h>
 #include <linux/of.h>
 #include <linux/pinctrl/consumer.h>
diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
index df0851464006..e0a83e32caef 100644
--- a/drivers/gpio/gpio-zynq.c
+++ b/drivers/gpio/gpio-zynq.c
@@ -15,6 +15,9 @@ 
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index c9b42dd12dfa..2695a8cc3b71 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -18,6 +18,7 @@ 
 #include <linux/export.h>
 #include <linux/acpi.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/mutex.h>
 #include <linux/pinctrl/pinctrl.h>
 
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 9568708a550b..b81269c00381 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -3,6 +3,7 @@ 
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
+#include <linux/irqdomain.h>
 #include <linux/spinlock.h>
 #include <linux/list.h>
 #include <linux/device.h>
@@ -17,6 +18,7 @@ 
 #include <linux/gpio/driver.h>
 #include <linux/gpio/machine.h>
 #include <linux/pinctrl/consumer.h>
+#include <linux/pinctrl/pinconf-generic.h>
 #include <linux/cdev.h>
 #include <linux/fs.h>
 #include <linux/uaccess.h>
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index af20369ec8e7..07b595e24695 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -1,21 +1,22 @@ 
 #ifndef __LINUX_GPIO_DRIVER_H
 #define __LINUX_GPIO_DRIVER_H
 
-#include <linux/device.h>
 #include <linux/types.h>
-#include <linux/irq.h>
-#include <linux/irqchip/chained_irq.h>
-#include <linux/irqdomain.h>
+#include <linux/irqhandler.h>
 #include <linux/lockdep.h>
 #include <linux/pinctrl/pinctrl.h>
-#include <linux/pinctrl/pinconf-generic.h>
+#include <linux/spinlock_types.h>
 
 struct gpio_desc;
 struct of_phandle_args;
+struct device;
 struct device_node;
+struct irq_chip;
+struct irq_domain;
 struct seq_file;
 struct gpio_device;
 struct module;
+struct pinctrl_dev;
 
 #ifdef CONFIG_GPIOLIB