All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] GPIO: Clean up asm/gpio.h
@ 2016-02-02 19:53 Bjorn Helgaas
  2016-02-02 19:53 ` [PATCH 1/2] gpio: Include linux/gpio.h instead of asm/gpio.h Bjorn Helgaas
                   ` (5 more replies)
  0 siblings, 6 replies; 44+ messages in thread
From: Bjorn Helgaas @ 2016-02-02 19:53 UTC (permalink / raw)
  To: Alexandre Courbot, Linus Walleij
  Cc: linux-arch, linux-gpio, Mark Brown, linux-kernel

Many arches supply an asm/gpio.h that contains only this:

  #warning Include linux/gpio.h instead of asm/gpio.h
  #include <linux/gpio.h>

These two patches change all the places that include asm/gpio.h
so they include linux/gpio.h instead, and then remove the asm/gpio.h
files.

There are several arches that supply asm/gpio.h with useful
arch-specific content; I didn't touch those.

I assume Mark was heading this direction with 7563bbf89d06
("gpiolib/arches: Centralise bolierplate asm/gpio.h").

---

Bjorn Helgaas (2):
      gpio: Include linux/gpio.h instead of asm/gpio.h
      gpio: Remove unused asm/gpio.h files


 arch/alpha/include/asm/gpio.h                   |    4 ----
 arch/avr32/boards/merisc/setup.c                |    1 -
 arch/avr32/mach-at32ap/pio.c                    |    2 +-
 arch/blackfin/kernel/debug-mmrs.c               |    2 +-
 arch/blackfin/mach-bf538/boards/ezkit.c         |    2 +-
 arch/blackfin/mach-bf538/ext-gpio.c             |    2 +-
 arch/blackfin/mach-bf548/boards/cm_bf548.c      |    2 +-
 arch/blackfin/mach-bf548/boards/ezkit.c         |    2 +-
 arch/blackfin/mach-bf609/boards/ezkit.c         |    2 +-
 arch/blackfin/mach-common/ints-priority.c       |    2 +-
 arch/blackfin/mach-common/pm.c                  |    2 +-
 arch/ia64/include/asm/gpio.h                    |    4 ----
 arch/metag/include/asm/gpio.h                   |    4 ----
 arch/microblaze/include/asm/gpio.h              |    4 ----
 arch/openrisc/include/asm/gpio.h                |    4 ----
 arch/powerpc/include/asm/gpio.h                 |    4 ----
 arch/sh/include/mach-common/mach/magicpanelr2.h |    2 +-
 arch/sparc/include/asm/gpio.h                   |    4 ----
 arch/x86/include/asm/gpio.h                     |    4 ----
 arch/xtensa/include/asm/gpio.h                  |    4 ----
 drivers/ata/pata_at91.c                         |    3 +--
 drivers/ata/pata_bf54x.c                        |    2 +-
 drivers/gpio/gpio-mpc5200.c                     |    1 -
 drivers/mfd/menelaus.c                          |    2 +-
 drivers/mtd/onenand/omap2.c                     |    2 +-
 drivers/pcmcia/bfin_cf_pcmcia.c                 |    2 +-
 drivers/pcmcia/pxa2xx_vpac270.c                 |    1 -
 drivers/usb/gadget/udc/atmel_usba_udc.c         |    2 --
 drivers/usb/host/ohci-at91.c                    |    2 --
 drivers/video/fbdev/atmel_lcdfb.c               |    2 --
 drivers/video/fbdev/omap/lcd_h3.c               |    2 +-
 drivers/video/fbdev/omap/lcd_osk.c              |    3 +--
 drivers/video/fbdev/omap/lcd_palmtt.c           |    2 +-
 33 files changed, 18 insertions(+), 65 deletions(-)
 delete mode 100644 arch/alpha/include/asm/gpio.h
 delete mode 100644 arch/ia64/include/asm/gpio.h
 delete mode 100644 arch/metag/include/asm/gpio.h
 delete mode 100644 arch/microblaze/include/asm/gpio.h
 delete mode 100644 arch/openrisc/include/asm/gpio.h
 delete mode 100644 arch/powerpc/include/asm/gpio.h
 delete mode 100644 arch/sparc/include/asm/gpio.h
 delete mode 100644 arch/x86/include/asm/gpio.h
 delete mode 100644 arch/xtensa/include/asm/gpio.h

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

* [PATCH 1/2] gpio: Include linux/gpio.h instead of asm/gpio.h
  2016-02-02 19:53 [PATCH 0/2] GPIO: Clean up asm/gpio.h Bjorn Helgaas
@ 2016-02-02 19:53 ` Bjorn Helgaas
  2016-02-03  0:02   ` Alexandre Courbot
  2016-02-15 13:35   ` Linus Walleij
  2016-02-02 19:53 ` [PATCH 2/2] gpio: Remove unused asm/gpio.h files Bjorn Helgaas
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 44+ messages in thread
From: Bjorn Helgaas @ 2016-02-02 19:53 UTC (permalink / raw)
  To: Alexandre Courbot, Linus Walleij
  Cc: linux-arch, linux-gpio, Mark Brown, linux-kernel

Most arches have an asm/gpio.h that merely includes linux/gpio.h.  The
others select ARCH_HAVE_CUSTOM_GPIO_H, and when that's selected,
linux/gpio.h includes asm/gpio.h.

Therefore, code should include linux/gpio.h instead of including asm/gpio.h
directly.

Remove includes of asm/gpio.h, adding an include of linux/gpio.h when
necessary.

This is a follow-on to 7563bbf89d06 ("gpiolib/arches: Centralise
bolierplate asm/gpio.h").

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 arch/avr32/boards/merisc/setup.c                |    1 -
 arch/avr32/mach-at32ap/pio.c                    |    2 +-
 arch/blackfin/kernel/debug-mmrs.c               |    2 +-
 arch/blackfin/mach-bf538/boards/ezkit.c         |    2 +-
 arch/blackfin/mach-bf538/ext-gpio.c             |    2 +-
 arch/blackfin/mach-bf548/boards/cm_bf548.c      |    2 +-
 arch/blackfin/mach-bf548/boards/ezkit.c         |    2 +-
 arch/blackfin/mach-bf609/boards/ezkit.c         |    2 +-
 arch/blackfin/mach-common/ints-priority.c       |    2 +-
 arch/blackfin/mach-common/pm.c                  |    2 +-
 arch/sh/include/mach-common/mach/magicpanelr2.h |    2 +-
 drivers/ata/pata_at91.c                         |    3 +--
 drivers/ata/pata_bf54x.c                        |    2 +-
 drivers/gpio/gpio-mpc5200.c                     |    1 -
 drivers/mfd/menelaus.c                          |    2 +-
 drivers/mtd/onenand/omap2.c                     |    2 +-
 drivers/pcmcia/bfin_cf_pcmcia.c                 |    2 +-
 drivers/pcmcia/pxa2xx_vpac270.c                 |    1 -
 drivers/usb/gadget/udc/atmel_usba_udc.c         |    2 --
 drivers/usb/host/ohci-at91.c                    |    2 --
 drivers/video/fbdev/atmel_lcdfb.c               |    2 --
 drivers/video/fbdev/omap/lcd_h3.c               |    2 +-
 drivers/video/fbdev/omap/lcd_osk.c              |    3 +--
 drivers/video/fbdev/omap/lcd_palmtt.c           |    2 +-
 24 files changed, 18 insertions(+), 29 deletions(-)

diff --git a/arch/avr32/boards/merisc/setup.c b/arch/avr32/boards/merisc/setup.c
index 83d896c..718a6d7 100644
--- a/arch/avr32/boards/merisc/setup.c
+++ b/arch/avr32/boards/merisc/setup.c
@@ -27,7 +27,6 @@
 
 #include <asm/io.h>
 #include <asm/setup.h>
-#include <asm/gpio.h>
 
 #include <mach/at32ap700x.h>
 #include <mach/board.h>
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c
index 5020057..83c2a00 100644
--- a/arch/avr32/mach-at32ap/pio.c
+++ b/arch/avr32/mach-at32ap/pio.c
@@ -14,8 +14,8 @@
 #include <linux/fs.h>
 #include <linux/platform_device.h>
 #include <linux/irq.h>
+#include <linux/gpio.h>
 
-#include <asm/gpio.h>
 #include <asm/io.h>
 
 #include <mach/portmux.h>
diff --git a/arch/blackfin/kernel/debug-mmrs.c b/arch/blackfin/kernel/debug-mmrs.c
index 86b1cd3..e272bca 100644
--- a/arch/blackfin/kernel/debug-mmrs.c
+++ b/arch/blackfin/kernel/debug-mmrs.c
@@ -11,9 +11,9 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/i2c/bfin_twi.h>
+#include <linux/gpio.h>
 
 #include <asm/blackfin.h>
-#include <asm/gpio.h>
 #include <asm/gptimers.h>
 #include <asm/bfin_can.h>
 #include <asm/bfin_dma.h>
diff --git a/arch/blackfin/mach-bf538/boards/ezkit.c b/arch/blackfin/mach-bf538/boards/ezkit.c
index ae2fcbb..c423af3 100644
--- a/arch/blackfin/mach-bf538/boards/ezkit.c
+++ b/arch/blackfin/mach-bf538/boards/ezkit.c
@@ -15,9 +15,9 @@
 #include <linux/spi/flash.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
+#include <linux/gpio.h>
 #include <asm/bfin5xx_spi.h>
 #include <asm/dma.h>
-#include <asm/gpio.h>
 #include <asm/nand.h>
 #include <asm/portmux.h>
 #include <asm/dpmc.h>
diff --git a/arch/blackfin/mach-bf538/ext-gpio.c b/arch/blackfin/mach-bf538/ext-gpio.c
index 471a9b1..d3e7b66 100644
--- a/arch/blackfin/mach-bf538/ext-gpio.c
+++ b/arch/blackfin/mach-bf538/ext-gpio.c
@@ -8,8 +8,8 @@
 
 #include <linux/module.h>
 #include <linux/err.h>
+#include <linux/gpio.h>
 #include <asm/blackfin.h>
-#include <asm/gpio.h>
 #include <asm/portmux.h>
 
 #define DEFINE_REG(reg, off) \
diff --git a/arch/blackfin/mach-bf548/boards/cm_bf548.c b/arch/blackfin/mach-bf548/boards/cm_bf548.c
index 6d5ffde..120c994 100644
--- a/arch/blackfin/mach-bf548/boards/cm_bf548.c
+++ b/arch/blackfin/mach-bf548/boards/cm_bf548.c
@@ -17,9 +17,9 @@
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/usb/musb.h>
+#include <linux/gpio.h>
 #include <asm/bfin5xx_spi.h>
 #include <asm/dma.h>
-#include <asm/gpio.h>
 #include <asm/nand.h>
 #include <asm/portmux.h>
 #include <asm/bfin_sdh.h>
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index 4204b98..3cdd483 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -20,9 +20,9 @@
 #include <linux/pinctrl/machine.h>
 #include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_data/pinctrl-adi2.h>
+#include <linux/gpio.h>
 #include <asm/bfin5xx_spi.h>
 #include <asm/dma.h>
-#include <asm/gpio.h>
 #include <asm/nand.h>
 #include <asm/dpmc.h>
 #include <asm/bfin_sport.h>
diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c
index c7928d8..aad5d74 100644
--- a/arch/blackfin/mach-bf609/boards/ezkit.c
+++ b/arch/blackfin/mach-bf609/boards/ezkit.c
@@ -21,8 +21,8 @@
 #include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_data/pinctrl-adi2.h>
 #include <linux/spi/adi_spi3.h>
+#include <linux/gpio.h>
 #include <asm/dma.h>
-#include <asm/gpio.h>
 #include <asm/nand.h>
 #include <asm/dpmc.h>
 #include <asm/portmux.h>
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c
index e8d4d74..4986b4fb 100644
--- a/arch/blackfin/mach-common/ints-priority.c
+++ b/arch/blackfin/mach-common/ints-priority.c
@@ -17,13 +17,13 @@
 #include <linux/irq.h>
 #include <linux/sched.h>
 #include <linux/syscore_ops.h>
+#include <linux/gpio.h>
 #include <asm/delay.h>
 #ifdef CONFIG_IPIPE
 #include <linux/ipipe.h>
 #endif
 #include <asm/traps.h>
 #include <asm/blackfin.h>
-#include <asm/gpio.h>
 #include <asm/irq_handler.h>
 #include <asm/dpmc.h>
 #include <asm/traps.h>
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c
index a66d979..5ece38a 100644
--- a/arch/blackfin/mach-common/pm.c
+++ b/arch/blackfin/mach-common/pm.c
@@ -15,9 +15,9 @@
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/delay.h>
+#include <linux/gpio.h>
 
 #include <asm/cplb.h>
-#include <asm/gpio.h>
 #include <asm/dma.h>
 #include <asm/dpmc.h>
 #include <asm/pm.h>
diff --git a/arch/sh/include/mach-common/mach/magicpanelr2.h b/arch/sh/include/mach-common/mach/magicpanelr2.h
index 183a2f7..eb0cf20 100644
--- a/arch/sh/include/mach-common/mach/magicpanelr2.h
+++ b/arch/sh/include/mach-common/mach/magicpanelr2.h
@@ -13,7 +13,7 @@
 #ifndef __ASM_SH_MAGICPANELR2_H
 #define __ASM_SH_MAGICPANELR2_H
 
-#include <asm/gpio.h>
+#include <linux/gpio.h>
 
 #define __IO_PREFIX mpr2
 #include <asm/io_generic.h>
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c
index ace0a4d..9f27b14 100644
--- a/drivers/ata/pata_at91.c
+++ b/drivers/ata/pata_at91.c
@@ -30,8 +30,7 @@
 #include <linux/ata_platform.h>
 #include <linux/platform_data/atmel.h>
 #include <linux/regmap.h>
-
-#include <asm/gpio.h>
+#include <linux/gpio.h>
 
 #define DRV_NAME		"pata_at91"
 #define DRV_VERSION		"0.3"
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index dd74100..ec748d3 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -36,8 +36,8 @@
 #include <scsi/scsi_host.h>
 #include <linux/libata.h>
 #include <linux/platform_device.h>
+#include <linux/gpio.h>
 #include <asm/dma.h>
-#include <asm/gpio.h>
 #include <asm/portmux.h>
 
 #define DRV_NAME		"pata-bf54x"
diff --git a/drivers/gpio/gpio-mpc5200.c b/drivers/gpio/gpio-mpc5200.c
index 0e5a670..fc10cf5 100644
--- a/drivers/gpio/gpio-mpc5200.c
+++ b/drivers/gpio/gpio-mpc5200.c
@@ -25,7 +25,6 @@
 #include <linux/of_platform.h>
 #include <linux/module.h>
 
-#include <asm/gpio.h>
 #include <asm/mpc52xx.h>
 #include <sysdev/fsl_soc.h>
 
diff --git a/drivers/mfd/menelaus.c b/drivers/mfd/menelaus.c
index 3ac36f5..a4a8f1e 100644
--- a/drivers/mfd/menelaus.c
+++ b/drivers/mfd/menelaus.c
@@ -42,10 +42,10 @@
 #include <linux/bcd.h>
 #include <linux/slab.h>
 #include <linux/mfd/menelaus.h>
+#include <linux/gpio.h>
 
 #include <asm/mach/irq.h>
 
-#include <asm/gpio.h>
 
 #define DRIVER_NAME			"menelaus"
 
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index 0aacf12..24a1388 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -35,10 +35,10 @@
 #include <linux/io.h>
 #include <linux/slab.h>
 #include <linux/regulator/consumer.h>
+#include <linux/gpio.h>
 
 #include <asm/mach/flash.h>
 #include <linux/platform_data/mtd-onenand-omap2.h>
-#include <asm/gpio.h>
 
 #include <linux/omap-dma.h>
 
diff --git a/drivers/pcmcia/bfin_cf_pcmcia.c b/drivers/pcmcia/bfin_cf_pcmcia.c
index bba1dcb..8b0923f 100644
--- a/drivers/pcmcia/bfin_cf_pcmcia.c
+++ b/drivers/pcmcia/bfin_cf_pcmcia.c
@@ -36,10 +36,10 @@
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/io.h>
+#include <linux/gpio.h>
 
 #include <pcmcia/ss.h>
 #include <pcmcia/cisreg.h>
-#include <asm/gpio.h>
 
 #define	SZ_1K	0x00000400
 #define	SZ_8K	0x00002000
diff --git a/drivers/pcmcia/pxa2xx_vpac270.c b/drivers/pcmcia/pxa2xx_vpac270.c
index a47dcd2..33c5b88 100644
--- a/drivers/pcmcia/pxa2xx_vpac270.c
+++ b/drivers/pcmcia/pxa2xx_vpac270.c
@@ -17,7 +17,6 @@
 
 #include <asm/mach-types.h>
 
-#include <asm/gpio.h>
 #include <mach/vpac270.h>
 
 #include "soc_common.h"
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 8755b2c..dbde114 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -25,8 +25,6 @@
 #include <linux/of.h>
 #include <linux/of_gpio.h>
 
-#include <asm/gpio.h>
-
 #include "atmel_usba_udc.h"
 
 #ifdef CONFIG_USB_GADGET_DEBUG_FS
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 8c6e15b..95c8ddd 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -24,8 +24,6 @@
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
 
-#include <asm/gpio.h>
-
 #include "ohci.h"
 
 #define valid_port(index)	((index) >= 0 && (index) < AT91_MAX_USBH_PORTS)
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
index 19eb42b..e13b9e4 100644
--- a/drivers/video/fbdev/atmel_lcdfb.c
+++ b/drivers/video/fbdev/atmel_lcdfb.c
@@ -26,8 +26,6 @@
 #include <linux/regulator/consumer.h>
 #include <video/videomode.h>
 
-#include <asm/gpio.h>
-
 #include <video/atmel_lcdc.h>
 
 struct atmel_lcdfb_config {
diff --git a/drivers/video/fbdev/omap/lcd_h3.c b/drivers/video/fbdev/omap/lcd_h3.c
index a0729d0..21512b0 100644
--- a/drivers/video/fbdev/omap/lcd_h3.c
+++ b/drivers/video/fbdev/omap/lcd_h3.c
@@ -22,8 +22,8 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/i2c/tps65010.h>
+#include <linux/gpio.h>
 
-#include <asm/gpio.h>
 #include "omapfb.h"
 
 #define MODULE_NAME	"omapfb-lcd_h3"
diff --git a/drivers/video/fbdev/omap/lcd_osk.c b/drivers/video/fbdev/omap/lcd_osk.c
index c3ddebf..b56886c 100644
--- a/drivers/video/fbdev/omap/lcd_osk.c
+++ b/drivers/video/fbdev/omap/lcd_osk.c
@@ -22,8 +22,7 @@
 
 #include <linux/module.h>
 #include <linux/platform_device.h>
-
-#include <asm/gpio.h>
+#include <linux/gpio.h>
 
 #include <mach/hardware.h>
 #include <mach/mux.h>
diff --git a/drivers/video/fbdev/omap/lcd_palmtt.c b/drivers/video/fbdev/omap/lcd_palmtt.c
index 3d0ea04..1a936d5 100644
--- a/drivers/video/fbdev/omap/lcd_palmtt.c
+++ b/drivers/video/fbdev/omap/lcd_palmtt.c
@@ -28,8 +28,8 @@ GPIO13 - screen blanking
 #include <linux/platform_device.h>
 #include <linux/module.h>
 #include <linux/io.h>
+#include <linux/gpio.h>
 
-#include <asm/gpio.h>
 #include "omapfb.h"
 
 static int palmtt_panel_init(struct lcd_panel *panel,

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

* [PATCH 2/2] gpio: Remove unused asm/gpio.h files
  2016-02-02 19:53 [PATCH 0/2] GPIO: Clean up asm/gpio.h Bjorn Helgaas
  2016-02-02 19:53 ` [PATCH 1/2] gpio: Include linux/gpio.h instead of asm/gpio.h Bjorn Helgaas
@ 2016-02-02 19:53 ` Bjorn Helgaas
  2016-02-03  0:03   ` Alexandre Courbot
  2016-02-03  8:19 ` [PATCH 0/2] GPIO: Clean up asm/gpio.h Thomas Gleixner
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 44+ messages in thread
From: Bjorn Helgaas @ 2016-02-02 19:53 UTC (permalink / raw)
  To: Alexandre Courbot, Linus Walleij
  Cc: linux-arch, linux-gpio, Mark Brown, linux-kernel

asm/gpio.h is included only by linux/gpio.h, and then only when the arch
selects ARCH_HAVE_CUSTOM_GPIO_H.  Only the following arches select it: arm
avr32 blackfin m68k (COLDFIRE only) sh unicore32.

Remove the unused asm/gpio.h files for the arches that do not select
ARCH_HAVE_CUSTOM_GPIO_H.

This is a follow-on to 7563bbf89d06 ("gpiolib/arches: Centralise
bolierplate asm/gpio.h").

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 arch/alpha/include/asm/gpio.h      |    4 ----
 arch/ia64/include/asm/gpio.h       |    4 ----
 arch/metag/include/asm/gpio.h      |    4 ----
 arch/microblaze/include/asm/gpio.h |    4 ----
 arch/openrisc/include/asm/gpio.h   |    4 ----
 arch/powerpc/include/asm/gpio.h    |    4 ----
 arch/sparc/include/asm/gpio.h      |    4 ----
 arch/x86/include/asm/gpio.h        |    4 ----
 arch/xtensa/include/asm/gpio.h     |    4 ----
 9 files changed, 36 deletions(-)
 delete mode 100644 arch/alpha/include/asm/gpio.h
 delete mode 100644 arch/ia64/include/asm/gpio.h
 delete mode 100644 arch/metag/include/asm/gpio.h
 delete mode 100644 arch/microblaze/include/asm/gpio.h
 delete mode 100644 arch/openrisc/include/asm/gpio.h
 delete mode 100644 arch/powerpc/include/asm/gpio.h
 delete mode 100644 arch/sparc/include/asm/gpio.h
 delete mode 100644 arch/x86/include/asm/gpio.h
 delete mode 100644 arch/xtensa/include/asm/gpio.h

diff --git a/arch/alpha/include/asm/gpio.h b/arch/alpha/include/asm/gpio.h
deleted file mode 100644
index b3799d8..0000000
--- a/arch/alpha/include/asm/gpio.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __LINUX_GPIO_H
-#warning Include linux/gpio.h instead of asm/gpio.h
-#include <linux/gpio.h>
-#endif
diff --git a/arch/ia64/include/asm/gpio.h b/arch/ia64/include/asm/gpio.h
deleted file mode 100644
index b3799d8..0000000
--- a/arch/ia64/include/asm/gpio.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __LINUX_GPIO_H
-#warning Include linux/gpio.h instead of asm/gpio.h
-#include <linux/gpio.h>
-#endif
diff --git a/arch/metag/include/asm/gpio.h b/arch/metag/include/asm/gpio.h
deleted file mode 100644
index b3799d8..0000000
--- a/arch/metag/include/asm/gpio.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __LINUX_GPIO_H
-#warning Include linux/gpio.h instead of asm/gpio.h
-#include <linux/gpio.h>
-#endif
diff --git a/arch/microblaze/include/asm/gpio.h b/arch/microblaze/include/asm/gpio.h
deleted file mode 100644
index b3799d8..0000000
--- a/arch/microblaze/include/asm/gpio.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __LINUX_GPIO_H
-#warning Include linux/gpio.h instead of asm/gpio.h
-#include <linux/gpio.h>
-#endif
diff --git a/arch/openrisc/include/asm/gpio.h b/arch/openrisc/include/asm/gpio.h
deleted file mode 100644
index b3799d8..0000000
--- a/arch/openrisc/include/asm/gpio.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __LINUX_GPIO_H
-#warning Include linux/gpio.h instead of asm/gpio.h
-#include <linux/gpio.h>
-#endif
diff --git a/arch/powerpc/include/asm/gpio.h b/arch/powerpc/include/asm/gpio.h
deleted file mode 100644
index b3799d8..0000000
--- a/arch/powerpc/include/asm/gpio.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __LINUX_GPIO_H
-#warning Include linux/gpio.h instead of asm/gpio.h
-#include <linux/gpio.h>
-#endif
diff --git a/arch/sparc/include/asm/gpio.h b/arch/sparc/include/asm/gpio.h
deleted file mode 100644
index b3799d8..0000000
--- a/arch/sparc/include/asm/gpio.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __LINUX_GPIO_H
-#warning Include linux/gpio.h instead of asm/gpio.h
-#include <linux/gpio.h>
-#endif
diff --git a/arch/x86/include/asm/gpio.h b/arch/x86/include/asm/gpio.h
deleted file mode 100644
index b3799d8..0000000
--- a/arch/x86/include/asm/gpio.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __LINUX_GPIO_H
-#warning Include linux/gpio.h instead of asm/gpio.h
-#include <linux/gpio.h>
-#endif
diff --git a/arch/xtensa/include/asm/gpio.h b/arch/xtensa/include/asm/gpio.h
deleted file mode 100644
index b3799d8..0000000
--- a/arch/xtensa/include/asm/gpio.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __LINUX_GPIO_H
-#warning Include linux/gpio.h instead of asm/gpio.h
-#include <linux/gpio.h>
-#endif

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

* Re: [PATCH 1/2] gpio: Include linux/gpio.h instead of asm/gpio.h
  2016-02-02 19:53 ` [PATCH 1/2] gpio: Include linux/gpio.h instead of asm/gpio.h Bjorn Helgaas
@ 2016-02-03  0:02   ` Alexandre Courbot
  2016-02-15 13:35   ` Linus Walleij
  1 sibling, 0 replies; 44+ messages in thread
From: Alexandre Courbot @ 2016-02-03  0:02 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Linus Walleij, linux-arch, linux-gpio, Mark Brown,
	Linux Kernel Mailing List

On Wed, Feb 3, 2016 at 4:53 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> Most arches have an asm/gpio.h that merely includes linux/gpio.h.  The
> others select ARCH_HAVE_CUSTOM_GPIO_H, and when that's selected,
> linux/gpio.h includes asm/gpio.h.

Looks correct if that's really what happens, GPIO includes can be tricky...

>  arch/avr32/boards/merisc/setup.c                |    1 -
>  arch/avr32/mach-at32ap/pio.c                    |    2 +-
>  arch/blackfin/kernel/debug-mmrs.c               |    2 +-
>  arch/blackfin/mach-bf538/boards/ezkit.c         |    2 +-
>  arch/blackfin/mach-bf538/ext-gpio.c             |    2 +-
>  arch/blackfin/mach-bf548/boards/cm_bf548.c      |    2 +-
>  arch/blackfin/mach-bf548/boards/ezkit.c         |    2 +-
>  arch/blackfin/mach-bf609/boards/ezkit.c         |    2 +-
>  arch/blackfin/mach-common/ints-priority.c       |    2 +-
>  arch/blackfin/mach-common/pm.c                  |    2 +-
>  arch/sh/include/mach-common/mach/magicpanelr2.h |    2 +-
>  drivers/ata/pata_at91.c                         |    3 +--
>  drivers/ata/pata_bf54x.c                        |    2 +-
>  drivers/gpio/gpio-mpc5200.c                     |    1 -
>  drivers/mfd/menelaus.c                          |    2 +-
>  drivers/mtd/onenand/omap2.c                     |    2 +-
>  drivers/pcmcia/bfin_cf_pcmcia.c                 |    2 +-
>  drivers/pcmcia/pxa2xx_vpac270.c                 |    1 -
>  drivers/usb/gadget/udc/atmel_usba_udc.c         |    2 --
>  drivers/usb/host/ohci-at91.c                    |    2 --
>  drivers/video/fbdev/atmel_lcdfb.c               |    2 --
>  drivers/video/fbdev/omap/lcd_h3.c               |    2 +-
>  drivers/video/fbdev/omap/lcd_osk.c              |    3 +--
>  drivers/video/fbdev/omap/lcd_palmtt.c           |    2 +-

Driver code should most definitely never include asm/gpio.h directly.

I may be overlooking some intricate detail, but the simplification is welcome.

Acked-by: Alexandre Courbot <acourbot@nvidia.com>

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

* Re: [PATCH 2/2] gpio: Remove unused asm/gpio.h files
  2016-02-02 19:53 ` [PATCH 2/2] gpio: Remove unused asm/gpio.h files Bjorn Helgaas
@ 2016-02-03  0:03   ` Alexandre Courbot
  0 siblings, 0 replies; 44+ messages in thread
From: Alexandre Courbot @ 2016-02-03  0:03 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Linus Walleij, linux-arch, linux-gpio, Mark Brown,
	Linux Kernel Mailing List

On Wed, Feb 3, 2016 at 4:53 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> asm/gpio.h is included only by linux/gpio.h, and then only when the arch
> selects ARCH_HAVE_CUSTOM_GPIO_H.  Only the following arches select it: arm
> avr32 blackfin m68k (COLDFIRE only) sh unicore32.
>
> Remove the unused asm/gpio.h files for the arches that do not select
> ARCH_HAVE_CUSTOM_GPIO_H.
>
> This is a follow-on to 7563bbf89d06 ("gpiolib/arches: Centralise
> bolierplate asm/gpio.h").

Very nice.

Acked-by: Alexandre Courbot <acourbot@nvidia.com>

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

* Re: [PATCH 0/2] GPIO: Clean up asm/gpio.h
  2016-02-02 19:53 [PATCH 0/2] GPIO: Clean up asm/gpio.h Bjorn Helgaas
  2016-02-02 19:53 ` [PATCH 1/2] gpio: Include linux/gpio.h instead of asm/gpio.h Bjorn Helgaas
  2016-02-02 19:53 ` [PATCH 2/2] gpio: Remove unused asm/gpio.h files Bjorn Helgaas
@ 2016-02-03  8:19 ` Thomas Gleixner
  2016-02-05 13:43 ` Linus Walleij
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 44+ messages in thread
From: Thomas Gleixner @ 2016-02-03  8:19 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Alexandre Courbot, Linus Walleij, linux-arch, linux-gpio,
	Mark Brown, linux-kernel

On Tue, 2 Feb 2016, Bjorn Helgaas wrote:

> Many arches supply an asm/gpio.h that contains only this:
> 
>   #warning Include linux/gpio.h instead of asm/gpio.h
>   #include <linux/gpio.h>
> 
> These two patches change all the places that include asm/gpio.h
> so they include linux/gpio.h instead, and then remove the asm/gpio.h
> files.
> 
> There are several arches that supply asm/gpio.h with useful
> arch-specific content; I didn't touch those.

Acked-by: Thomas Gleixner <tglx@linutronix.de>

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

* Re: [PATCH 0/2] GPIO: Clean up asm/gpio.h
  2016-02-02 19:53 [PATCH 0/2] GPIO: Clean up asm/gpio.h Bjorn Helgaas
                   ` (2 preceding siblings ...)
  2016-02-03  8:19 ` [PATCH 0/2] GPIO: Clean up asm/gpio.h Thomas Gleixner
@ 2016-02-05 13:43 ` Linus Walleij
  2016-02-15 15:46   ` Arnd Bergmann
  2016-02-16 15:37   ` Arnd Bergmann
  5 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2016-02-05 13:43 UTC (permalink / raw)
  To: Bjorn Helgaas, Arnd Bergmann
  Cc: Alexandre Courbot, linux-arch, linux-gpio, Mark Brown, linux-kernel

On Tue, Feb 2, 2016 at 8:53 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:

> Many arches supply an asm/gpio.h that contains only this:
>
>   #warning Include linux/gpio.h instead of asm/gpio.h
>   #include <linux/gpio.h>
>
> These two patches change all the places that include asm/gpio.h
> so they include linux/gpio.h instead, and then remove the asm/gpio.h
> files.
>
> There are several arches that supply asm/gpio.h with useful
> arch-specific content; I didn't touch those.
>
> I assume Mark was heading this direction with 7563bbf89d06
> ("gpiolib/arches: Centralise bolierplate asm/gpio.h").

Sweet, if I can get the arch maintainers ACK on this I can
merge it into the GPIO tree, Arnd?

Yours,
Linus Walleij

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

* Re: [PATCH 1/2] gpio: Include linux/gpio.h instead of asm/gpio.h
  2016-02-02 19:53 ` [PATCH 1/2] gpio: Include linux/gpio.h instead of asm/gpio.h Bjorn Helgaas
  2016-02-03  0:02   ` Alexandre Courbot
@ 2016-02-15 13:35   ` Linus Walleij
  1 sibling, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2016-02-15 13:35 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Alexandre Courbot, linux-arch, linux-gpio, Mark Brown, linux-kernel

On Tue, Feb 2, 2016 at 8:53 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:

> Most arches have an asm/gpio.h that merely includes linux/gpio.h.  The
> others select ARCH_HAVE_CUSTOM_GPIO_H, and when that's selected,
> linux/gpio.h includes asm/gpio.h.
>
> Therefore, code should include linux/gpio.h instead of including asm/gpio.h
> directly.
>
> Remove includes of asm/gpio.h, adding an include of linux/gpio.h when
> necessary.
>
> This is a follow-on to 7563bbf89d06 ("gpiolib/arches: Centralise
> bolierplate asm/gpio.h").
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Patch applied after getting Arnds ACK over IRC.

Yours,
Linus Walleij

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

* [PATCH 0/4] clean up irq_to_gpio and asm/gpio.h
  2016-02-02 19:53 [PATCH 0/2] GPIO: Clean up asm/gpio.h Bjorn Helgaas
@ 2016-02-15 15:46   ` Arnd Bergmann
  2016-02-02 19:53 ` [PATCH 2/2] gpio: Remove unused asm/gpio.h files Bjorn Helgaas
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-15 15:46 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, Arnd Bergmann, Russell King, Bjorn Helgaas,
	Alexandre Courbot, linux-gpio, linux-kernel

I noticed that arch/arm/include/asm/gpio.h can almost be removed,
after we have already removed the file for most other architectures
now.

When I removed it, I ran into problems with irq_to_gpio(), which
we had already killed off in ARM, but it survived (barely) in the
global headers. this kills it off some more as well.

I'd suggest merging all four patches through the GPIO tree.

	Arnd


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

* [PATCH 0/4] clean up irq_to_gpio and asm/gpio.h
@ 2016-02-15 15:46   ` Arnd Bergmann
  0 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-15 15:46 UTC (permalink / raw)
  To: linux-arm-kernel

I noticed that arch/arm/include/asm/gpio.h can almost be removed,
after we have already removed the file for most other architectures
now.

When I removed it, I ran into problems with irq_to_gpio(), which
we had already killed off in ARM, but it survived (barely) in the
global headers. this kills it off some more as well.

I'd suggest merging all four patches through the GPIO tree.

	Arnd

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

* [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
  2016-02-15 15:46   ` Arnd Bergmann
@ 2016-02-15 15:46     ` Arnd Bergmann
  -1 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-15 15:46 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot
  Cc: linux-arm-kernel, Arnd Bergmann, Russell King, Bjorn Helgaas,
	linux-gpio, linux-kernel, Ralf Baechle, Paul Burton, linux-mips

gpiolib has removed the irq_to_gpio() API several years ago,
but the global header still provided a non-working stub.

Apparently one new user has shown up in arch/mips, so this patch
moves the broken definition to where it is used, ensuring that
we get new users but not changing the current behavior on jz4740.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/mips/jz4740/gpio.c |  7 +++++++
 include/linux/gpio.h    | 12 ------------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/arch/mips/jz4740/gpio.c b/arch/mips/jz4740/gpio.c
index 8c6d76c9b2d6..e9bb43714892 100644
--- a/arch/mips/jz4740/gpio.c
+++ b/arch/mips/jz4740/gpio.c
@@ -16,6 +16,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/compiler.h>
 
 #include <linux/io.h>
 #include <linux/gpio.h>
@@ -270,6 +271,12 @@ uint32_t jz_gpio_port_get_value(int port, uint32_t mask)
 }
 EXPORT_SYMBOL(jz_gpio_port_get_value);
 
+static inline __deprecated int irq_to_gpio(unsigned int irq)
+{
+	/* this has clearly not worked for a long time */
+	return -EINVAL;
+}
+
 #define IRQ_TO_BIT(irq) BIT(irq_to_gpio(irq) & 0x1f)
 
 static void jz_gpio_check_trigger_both(struct jz_gpio_chip *chip, unsigned int irq)
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index d12b5d566e4b..6fc1c9e74854 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -70,11 +70,6 @@ static inline int gpio_to_irq(unsigned int gpio)
 	return __gpio_to_irq(gpio);
 }
 
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
 #endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */
 
 /* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */
@@ -222,13 +217,6 @@ static inline void gpiochip_unlock_as_irq(struct gpio_chip *chip,
 	WARN_ON(1);
 }
 
-static inline int irq_to_gpio(unsigned irq)
-{
-	/* irq can never have been returned from gpio_to_irq() */
-	WARN_ON(1);
-	return -EINVAL;
-}
-
 static inline int
 gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
 		       unsigned int gpio_offset, unsigned int pin_offset,
-- 
2.7.0

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

* [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
@ 2016-02-15 15:46     ` Arnd Bergmann
  0 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-15 15:46 UTC (permalink / raw)
  To: linux-arm-kernel

gpiolib has removed the irq_to_gpio() API several years ago,
but the global header still provided a non-working stub.

Apparently one new user has shown up in arch/mips, so this patch
moves the broken definition to where it is used, ensuring that
we get new users but not changing the current behavior on jz4740.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/mips/jz4740/gpio.c |  7 +++++++
 include/linux/gpio.h    | 12 ------------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/arch/mips/jz4740/gpio.c b/arch/mips/jz4740/gpio.c
index 8c6d76c9b2d6..e9bb43714892 100644
--- a/arch/mips/jz4740/gpio.c
+++ b/arch/mips/jz4740/gpio.c
@@ -16,6 +16,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/compiler.h>
 
 #include <linux/io.h>
 #include <linux/gpio.h>
@@ -270,6 +271,12 @@ uint32_t jz_gpio_port_get_value(int port, uint32_t mask)
 }
 EXPORT_SYMBOL(jz_gpio_port_get_value);
 
+static inline __deprecated int irq_to_gpio(unsigned int irq)
+{
+	/* this has clearly not worked for a long time */
+	return -EINVAL;
+}
+
 #define IRQ_TO_BIT(irq) BIT(irq_to_gpio(irq) & 0x1f)
 
 static void jz_gpio_check_trigger_both(struct jz_gpio_chip *chip, unsigned int irq)
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index d12b5d566e4b..6fc1c9e74854 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -70,11 +70,6 @@ static inline int gpio_to_irq(unsigned int gpio)
 	return __gpio_to_irq(gpio);
 }
 
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
 #endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */
 
 /* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */
@@ -222,13 +217,6 @@ static inline void gpiochip_unlock_as_irq(struct gpio_chip *chip,
 	WARN_ON(1);
 }
 
-static inline int irq_to_gpio(unsigned irq)
-{
-	/* irq can never have been returned from gpio_to_irq() */
-	WARN_ON(1);
-	return -EINVAL;
-}
-
 static inline int
 gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
 		       unsigned int gpio_offset, unsigned int pin_offset,
-- 
2.7.0

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

* [PATCH 2/4] gpio: ks8695: remove irq_to_gpio function
  2016-02-15 15:46   ` Arnd Bergmann
@ 2016-02-15 15:46     ` Arnd Bergmann
  -1 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-15 15:46 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, Arnd Bergmann, Russell King, Bjorn Helgaas,
	Alexandre Courbot, linux-gpio, linux-kernel

The ks8695 gpio driver has its own copy of the irq_to_gpio()
function. This is completely unused in the mainline kernel
after we converted all remaining users several years ago,
so we can remove the definition as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpio/gpio-ks8695.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/gpio/gpio-ks8695.c b/drivers/gpio/gpio-ks8695.c
index 9f86ed9c753b..179723d02f55 100644
--- a/drivers/gpio/gpio-ks8695.c
+++ b/drivers/gpio/gpio-ks8695.c
@@ -205,18 +205,6 @@ static int ks8695_gpio_to_irq(struct gpio_chip *gc, unsigned int pin)
 	return gpio_irq[pin];
 }
 
-/*
- * Map IRQ number to GPIO line.
- */
-int irq_to_gpio(unsigned int irq)
-{
-	if ((irq < KS8695_IRQ_EXTERN0) || (irq > KS8695_IRQ_EXTERN3))
-		return -EINVAL;
-
-	return (irq - KS8695_IRQ_EXTERN0);
-}
-EXPORT_SYMBOL(irq_to_gpio);
-
 /* GPIOLIB interface */
 
 static struct gpio_chip ks8695_gpio_chip = {
-- 
2.7.0

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

* [PATCH 2/4] gpio: ks8695: remove irq_to_gpio function
@ 2016-02-15 15:46     ` Arnd Bergmann
  0 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-15 15:46 UTC (permalink / raw)
  To: linux-arm-kernel

The ks8695 gpio driver has its own copy of the irq_to_gpio()
function. This is completely unused in the mainline kernel
after we converted all remaining users several years ago,
so we can remove the definition as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpio/gpio-ks8695.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/gpio/gpio-ks8695.c b/drivers/gpio/gpio-ks8695.c
index 9f86ed9c753b..179723d02f55 100644
--- a/drivers/gpio/gpio-ks8695.c
+++ b/drivers/gpio/gpio-ks8695.c
@@ -205,18 +205,6 @@ static int ks8695_gpio_to_irq(struct gpio_chip *gc, unsigned int pin)
 	return gpio_irq[pin];
 }
 
-/*
- * Map IRQ number to GPIO line.
- */
-int irq_to_gpio(unsigned int irq)
-{
-	if ((irq < KS8695_IRQ_EXTERN0) || (irq > KS8695_IRQ_EXTERN3))
-		return -EINVAL;
-
-	return (irq - KS8695_IRQ_EXTERN0);
-}
-EXPORT_SYMBOL(irq_to_gpio);
-
 /* GPIOLIB interface */
 
 static struct gpio_chip ks8695_gpio_chip = {
-- 
2.7.0

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

* [PATCH 3/4] gpio: ep93xx: remove private irq_to_gpio function
  2016-02-15 15:46   ` Arnd Bergmann
@ 2016-02-15 15:46     ` Arnd Bergmann
  -1 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-15 15:46 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, Arnd Bergmann, Russell King, Bjorn Helgaas,
	Alexandre Courbot, linux-gpio, linux-kernel

The ep93xx goes through its own back-and-forth dance every time
it wants to know the gpio number for an irq line, when it really
just hardcodes a fixed offset in ep93xx_gpio_to_irq().

This removes the pointless macro and replaces the conversion inside
of the driver with simple add/subtract operations, using an
explicit macro.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpio/gpio-ep93xx.c | 37 +++++++++++++++++--------------------
 1 file changed, 17 insertions(+), 20 deletions(-)

diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c
index 20e5846bda28..cd83d30e8ff7 100644
--- a/drivers/gpio/gpio-ep93xx.c
+++ b/drivers/gpio/gpio-ep93xx.c
@@ -18,12 +18,8 @@
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/slab.h>
-#include <linux/gpio/driver.h>
-/* FIXME: this is here for gpio_to_irq() - get rid of this! */
 #include <linux/gpio.h>
 
-#define irq_to_gpio(irq)	((irq) - gpio_to_irq(0))
-
 void __iomem *ep93xx_gpio_base; /* FIXME: put this into irq_data */
 
 #define EP93XX_GPIO_REG(x)		(ep93xx_gpio_base + (x))
@@ -35,6 +31,7 @@ void __iomem *ep93xx_gpio_base; /* FIXME: put this into irq_data */
 #define EP93XX_GPIO_LINE_MAX		63
 
 /* maximum value for irq capable line identifiers */
+#define EP93XX_GPIO_IRQ_BASE		64
 #define EP93XX_GPIO_LINE_MAX_IRQ	23
 
 
@@ -77,7 +74,7 @@ static void ep93xx_gpio_update_int_params(unsigned port)
 
 static void ep93xx_gpio_int_debounce(unsigned int irq, bool enable)
 {
-	int line = irq_to_gpio(irq);
+	int line = irq - EP93XX_GPIO_IRQ_BASE;
 	int port = line >> 3;
 	int port_mask = 1 << (line & 7);
 
@@ -98,7 +95,7 @@ static void ep93xx_gpio_ab_irq_handler(struct irq_desc *desc)
 	status = readb(EP93XX_GPIO_A_INT_STATUS);
 	for (i = 0; i < 8; i++) {
 		if (status & (1 << i)) {
-			int gpio_irq = gpio_to_irq(0) + i;
+			int gpio_irq = EP93XX_GPIO_IRQ_BASE + i;
 			generic_handle_irq(gpio_irq);
 		}
 	}
@@ -106,7 +103,7 @@ static void ep93xx_gpio_ab_irq_handler(struct irq_desc *desc)
 	status = readb(EP93XX_GPIO_B_INT_STATUS);
 	for (i = 0; i < 8; i++) {
 		if (status & (1 << i)) {
-			int gpio_irq = gpio_to_irq(8) + i;
+			int gpio_irq = EP93XX_GPIO_IRQ_BASE + 8 + i;
 			generic_handle_irq(gpio_irq);
 		}
 	}
@@ -121,14 +118,14 @@ static void ep93xx_gpio_f_irq_handler(struct irq_desc *desc)
 	 */
 	unsigned int irq = irq_desc_get_irq(desc);
 	int port_f_idx = ((irq + 1) & 7) ^ 4; /* {19..22,47..50} -> {0..7} */
-	int gpio_irq = gpio_to_irq(16) + port_f_idx;
+	int gpio_irq = EP93XX_GPIO_IRQ_BASE + 16 + port_f_idx;
 
 	generic_handle_irq(gpio_irq);
 }
 
 static void ep93xx_gpio_irq_ack(struct irq_data *d)
 {
-	int line = irq_to_gpio(d->irq);
+	int line = d->irq - EP93XX_GPIO_IRQ_BASE;
 	int port = line >> 3;
 	int port_mask = 1 << (line & 7);
 
@@ -142,7 +139,7 @@ static void ep93xx_gpio_irq_ack(struct irq_data *d)
 
 static void ep93xx_gpio_irq_mask_ack(struct irq_data *d)
 {
-	int line = irq_to_gpio(d->irq);
+	int line = d->irq - EP93XX_GPIO_IRQ_BASE;
 	int port = line >> 3;
 	int port_mask = 1 << (line & 7);
 
@@ -157,7 +154,7 @@ static void ep93xx_gpio_irq_mask_ack(struct irq_data *d)
 
 static void ep93xx_gpio_irq_mask(struct irq_data *d)
 {
-	int line = irq_to_gpio(d->irq);
+	int line = d->irq - EP93XX_GPIO_IRQ_BASE;
 	int port = line >> 3;
 
 	gpio_int_unmasked[port] &= ~(1 << (line & 7));
@@ -166,7 +163,7 @@ static void ep93xx_gpio_irq_mask(struct irq_data *d)
 
 static void ep93xx_gpio_irq_unmask(struct irq_data *d)
 {
-	int line = irq_to_gpio(d->irq);
+	int line = d->irq - EP93XX_GPIO_IRQ_BASE;
 	int port = line >> 3;
 
 	gpio_int_unmasked[port] |= 1 << (line & 7);
@@ -180,7 +177,7 @@ static void ep93xx_gpio_irq_unmask(struct irq_data *d)
  */
 static int ep93xx_gpio_irq_type(struct irq_data *d, unsigned int type)
 {
-	const int gpio = irq_to_gpio(d->irq);
+	const int gpio = d->irq - EP93XX_GPIO_IRQ_BASE;
 	const int port = gpio >> 3;
 	const int port_mask = 1 << (gpio & 7);
 	irq_flow_handler_t handler;
@@ -241,14 +238,14 @@ static struct irq_chip ep93xx_gpio_irq_chip = {
 
 static void ep93xx_gpio_init_irq(struct platform_device *pdev)
 {
-	int gpio_irq;
+	int gpio;
 	int i;
 
-	for (gpio_irq = gpio_to_irq(0);
-	     gpio_irq <= gpio_to_irq(EP93XX_GPIO_LINE_MAX_IRQ); ++gpio_irq) {
-		irq_set_chip_and_handler(gpio_irq, &ep93xx_gpio_irq_chip,
+	for (gpio = 0; gpio <= EP93XX_GPIO_LINE_MAX_IRQ; ++gpio) {
+		irq_set_chip_and_handler(EP93XX_GPIO_IRQ_BASE + gpio,
+					 &ep93xx_gpio_irq_chip,
 					 handle_level_irq);
-		irq_clear_status_flags(gpio_irq, IRQ_NOREQUEST);
+		irq_clear_status_flags(EP93XX_GPIO_IRQ_BASE + gpio, IRQ_NOREQUEST);
 	}
 
 	irq_set_chained_handler(platform_get_irq(pdev, 0),
@@ -294,7 +291,7 @@ static int ep93xx_gpio_set_debounce(struct gpio_chip *chip,
 				    unsigned offset, unsigned debounce)
 {
 	int gpio = chip->base + offset;
-	int irq = gpio_to_irq(gpio);
+	int irq = EP93XX_GPIO_IRQ_BASE + gpio;
 
 	if (irq < 0)
 		return -EINVAL;
@@ -316,7 +313,7 @@ static int ep93xx_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 	if (gpio > EP93XX_GPIO_LINE_MAX_IRQ)
 		return -EINVAL;
 
-	return 64 + gpio;
+	return EP93XX_GPIO_IRQ_BASE + gpio;
 }
 
 static int ep93xx_gpio_add_bank(struct gpio_chip *gc, struct device *dev,
-- 
2.7.0

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

* [PATCH 3/4] gpio: ep93xx: remove private irq_to_gpio function
@ 2016-02-15 15:46     ` Arnd Bergmann
  0 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-15 15:46 UTC (permalink / raw)
  To: linux-arm-kernel

The ep93xx goes through its own back-and-forth dance every time
it wants to know the gpio number for an irq line, when it really
just hardcodes a fixed offset in ep93xx_gpio_to_irq().

This removes the pointless macro and replaces the conversion inside
of the driver with simple add/subtract operations, using an
explicit macro.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpio/gpio-ep93xx.c | 37 +++++++++++++++++--------------------
 1 file changed, 17 insertions(+), 20 deletions(-)

diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c
index 20e5846bda28..cd83d30e8ff7 100644
--- a/drivers/gpio/gpio-ep93xx.c
+++ b/drivers/gpio/gpio-ep93xx.c
@@ -18,12 +18,8 @@
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/slab.h>
-#include <linux/gpio/driver.h>
-/* FIXME: this is here for gpio_to_irq() - get rid of this! */
 #include <linux/gpio.h>
 
-#define irq_to_gpio(irq)	((irq) - gpio_to_irq(0))
-
 void __iomem *ep93xx_gpio_base; /* FIXME: put this into irq_data */
 
 #define EP93XX_GPIO_REG(x)		(ep93xx_gpio_base + (x))
@@ -35,6 +31,7 @@ void __iomem *ep93xx_gpio_base; /* FIXME: put this into irq_data */
 #define EP93XX_GPIO_LINE_MAX		63
 
 /* maximum value for irq capable line identifiers */
+#define EP93XX_GPIO_IRQ_BASE		64
 #define EP93XX_GPIO_LINE_MAX_IRQ	23
 
 
@@ -77,7 +74,7 @@ static void ep93xx_gpio_update_int_params(unsigned port)
 
 static void ep93xx_gpio_int_debounce(unsigned int irq, bool enable)
 {
-	int line = irq_to_gpio(irq);
+	int line = irq - EP93XX_GPIO_IRQ_BASE;
 	int port = line >> 3;
 	int port_mask = 1 << (line & 7);
 
@@ -98,7 +95,7 @@ static void ep93xx_gpio_ab_irq_handler(struct irq_desc *desc)
 	status = readb(EP93XX_GPIO_A_INT_STATUS);
 	for (i = 0; i < 8; i++) {
 		if (status & (1 << i)) {
-			int gpio_irq = gpio_to_irq(0) + i;
+			int gpio_irq = EP93XX_GPIO_IRQ_BASE + i;
 			generic_handle_irq(gpio_irq);
 		}
 	}
@@ -106,7 +103,7 @@ static void ep93xx_gpio_ab_irq_handler(struct irq_desc *desc)
 	status = readb(EP93XX_GPIO_B_INT_STATUS);
 	for (i = 0; i < 8; i++) {
 		if (status & (1 << i)) {
-			int gpio_irq = gpio_to_irq(8) + i;
+			int gpio_irq = EP93XX_GPIO_IRQ_BASE + 8 + i;
 			generic_handle_irq(gpio_irq);
 		}
 	}
@@ -121,14 +118,14 @@ static void ep93xx_gpio_f_irq_handler(struct irq_desc *desc)
 	 */
 	unsigned int irq = irq_desc_get_irq(desc);
 	int port_f_idx = ((irq + 1) & 7) ^ 4; /* {19..22,47..50} -> {0..7} */
-	int gpio_irq = gpio_to_irq(16) + port_f_idx;
+	int gpio_irq = EP93XX_GPIO_IRQ_BASE + 16 + port_f_idx;
 
 	generic_handle_irq(gpio_irq);
 }
 
 static void ep93xx_gpio_irq_ack(struct irq_data *d)
 {
-	int line = irq_to_gpio(d->irq);
+	int line = d->irq - EP93XX_GPIO_IRQ_BASE;
 	int port = line >> 3;
 	int port_mask = 1 << (line & 7);
 
@@ -142,7 +139,7 @@ static void ep93xx_gpio_irq_ack(struct irq_data *d)
 
 static void ep93xx_gpio_irq_mask_ack(struct irq_data *d)
 {
-	int line = irq_to_gpio(d->irq);
+	int line = d->irq - EP93XX_GPIO_IRQ_BASE;
 	int port = line >> 3;
 	int port_mask = 1 << (line & 7);
 
@@ -157,7 +154,7 @@ static void ep93xx_gpio_irq_mask_ack(struct irq_data *d)
 
 static void ep93xx_gpio_irq_mask(struct irq_data *d)
 {
-	int line = irq_to_gpio(d->irq);
+	int line = d->irq - EP93XX_GPIO_IRQ_BASE;
 	int port = line >> 3;
 
 	gpio_int_unmasked[port] &= ~(1 << (line & 7));
@@ -166,7 +163,7 @@ static void ep93xx_gpio_irq_mask(struct irq_data *d)
 
 static void ep93xx_gpio_irq_unmask(struct irq_data *d)
 {
-	int line = irq_to_gpio(d->irq);
+	int line = d->irq - EP93XX_GPIO_IRQ_BASE;
 	int port = line >> 3;
 
 	gpio_int_unmasked[port] |= 1 << (line & 7);
@@ -180,7 +177,7 @@ static void ep93xx_gpio_irq_unmask(struct irq_data *d)
  */
 static int ep93xx_gpio_irq_type(struct irq_data *d, unsigned int type)
 {
-	const int gpio = irq_to_gpio(d->irq);
+	const int gpio = d->irq - EP93XX_GPIO_IRQ_BASE;
 	const int port = gpio >> 3;
 	const int port_mask = 1 << (gpio & 7);
 	irq_flow_handler_t handler;
@@ -241,14 +238,14 @@ static struct irq_chip ep93xx_gpio_irq_chip = {
 
 static void ep93xx_gpio_init_irq(struct platform_device *pdev)
 {
-	int gpio_irq;
+	int gpio;
 	int i;
 
-	for (gpio_irq = gpio_to_irq(0);
-	     gpio_irq <= gpio_to_irq(EP93XX_GPIO_LINE_MAX_IRQ); ++gpio_irq) {
-		irq_set_chip_and_handler(gpio_irq, &ep93xx_gpio_irq_chip,
+	for (gpio = 0; gpio <= EP93XX_GPIO_LINE_MAX_IRQ; ++gpio) {
+		irq_set_chip_and_handler(EP93XX_GPIO_IRQ_BASE + gpio,
+					 &ep93xx_gpio_irq_chip,
 					 handle_level_irq);
-		irq_clear_status_flags(gpio_irq, IRQ_NOREQUEST);
+		irq_clear_status_flags(EP93XX_GPIO_IRQ_BASE + gpio, IRQ_NOREQUEST);
 	}
 
 	irq_set_chained_handler(platform_get_irq(pdev, 0),
@@ -294,7 +291,7 @@ static int ep93xx_gpio_set_debounce(struct gpio_chip *chip,
 				    unsigned offset, unsigned debounce)
 {
 	int gpio = chip->base + offset;
-	int irq = gpio_to_irq(gpio);
+	int irq = EP93XX_GPIO_IRQ_BASE + gpio;
 
 	if (irq < 0)
 		return -EINVAL;
@@ -316,7 +313,7 @@ static int ep93xx_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 	if (gpio > EP93XX_GPIO_LINE_MAX_IRQ)
 		return -EINVAL;
 
-	return 64 + gpio;
+	return EP93XX_GPIO_IRQ_BASE + gpio;
 }
 
 static int ep93xx_gpio_add_bank(struct gpio_chip *gc, struct device *dev,
-- 
2.7.0

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

* [PATCH 4/4] ARM: remove asm/gpio.h
  2016-02-15 15:46   ` Arnd Bergmann
@ 2016-02-15 15:46     ` Arnd Bergmann
  -1 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-15 15:46 UTC (permalink / raw)
  To: Linus Walleij, Russell King
  Cc: linux-arm-kernel, Arnd Bergmann, Russell King, Bjorn Helgaas,
	Alexandre Courbot, linux-gpio, linux-kernel, linux-arch

The ARM version of asm/gpio.h basically just contains the same definitions
as the gpiolib version, with the exception of ARCH_NR_GPIOS.

This adds the option for overriding the constant through Kconfig to
the architecture-independent header, and removes the ARM version at
the same time.

This patch depends on a series done by Bjorn Helgaas, and the patch
removing irq_to_gpio().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig            |  1 -
 arch/arm/include/asm/gpio.h | 25 -------------------------
 include/asm-generic/gpio.h  |  4 ++++
 3 files changed, 4 insertions(+), 26 deletions(-)
 delete mode 100644 arch/arm/include/asm/gpio.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0366ad63e2ed..27aefbe43eea 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -5,7 +5,6 @@ config ARM
 	select ARCH_HAS_DEVMEM_IS_ALLOWED
 	select ARCH_HAS_ELF_RANDOMIZE
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
-	select ARCH_HAVE_CUSTOM_GPIO_H
 	select ARCH_HAS_GCOV_PROFILE_ALL
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_SUPPORTS_ATOMIC_RMW
diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
deleted file mode 100644
index 504dcddebfcc..000000000000
--- a/arch/arm/include/asm/gpio.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _ARCH_ARM_GPIO_H
-#define _ARCH_ARM_GPIO_H
-
-#if CONFIG_ARCH_NR_GPIO > 0
-#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO
-#endif
-
-/* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */
-#include <asm-generic/gpio.h>
-
-/* The trivial gpiolib dispatchers */
-#define gpio_get_value  __gpio_get_value
-#define gpio_set_value  __gpio_set_value
-#define gpio_cansleep   __gpio_cansleep
-
-/*
- * Provide a default gpio_to_irq() which should satisfy every case.
- * However, some platforms want to do this differently, so allow them
- * to override it.
- */
-#ifndef gpio_to_irq
-#define gpio_to_irq	__gpio_to_irq
-#endif
-
-#endif /* _ARCH_ARM_GPIO_H */
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 40ec1433f05d..2d04b321db13 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -26,8 +26,12 @@
  */
 
 #ifndef ARCH_NR_GPIOS
+#ifdef CONFIG_ARCH_NR_GPIO
+#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO
+#else
 #define ARCH_NR_GPIOS		512
 #endif
+#endif
 
 /*
  * "valid" GPIO numbers are nonnegative and may be passed to
-- 
2.7.0

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

* [PATCH 4/4] ARM: remove asm/gpio.h
@ 2016-02-15 15:46     ` Arnd Bergmann
  0 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-15 15:46 UTC (permalink / raw)
  To: linux-arm-kernel

The ARM version of asm/gpio.h basically just contains the same definitions
as the gpiolib version, with the exception of ARCH_NR_GPIOS.

This adds the option for overriding the constant through Kconfig to
the architecture-independent header, and removes the ARM version at
the same time.

This patch depends on a series done by Bjorn Helgaas, and the patch
removing irq_to_gpio().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig            |  1 -
 arch/arm/include/asm/gpio.h | 25 -------------------------
 include/asm-generic/gpio.h  |  4 ++++
 3 files changed, 4 insertions(+), 26 deletions(-)
 delete mode 100644 arch/arm/include/asm/gpio.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0366ad63e2ed..27aefbe43eea 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -5,7 +5,6 @@ config ARM
 	select ARCH_HAS_DEVMEM_IS_ALLOWED
 	select ARCH_HAS_ELF_RANDOMIZE
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
-	select ARCH_HAVE_CUSTOM_GPIO_H
 	select ARCH_HAS_GCOV_PROFILE_ALL
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_SUPPORTS_ATOMIC_RMW
diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
deleted file mode 100644
index 504dcddebfcc..000000000000
--- a/arch/arm/include/asm/gpio.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _ARCH_ARM_GPIO_H
-#define _ARCH_ARM_GPIO_H
-
-#if CONFIG_ARCH_NR_GPIO > 0
-#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO
-#endif
-
-/* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */
-#include <asm-generic/gpio.h>
-
-/* The trivial gpiolib dispatchers */
-#define gpio_get_value  __gpio_get_value
-#define gpio_set_value  __gpio_set_value
-#define gpio_cansleep   __gpio_cansleep
-
-/*
- * Provide a default gpio_to_irq() which should satisfy every case.
- * However, some platforms want to do this differently, so allow them
- * to override it.
- */
-#ifndef gpio_to_irq
-#define gpio_to_irq	__gpio_to_irq
-#endif
-
-#endif /* _ARCH_ARM_GPIO_H */
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 40ec1433f05d..2d04b321db13 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -26,8 +26,12 @@
  */
 
 #ifndef ARCH_NR_GPIOS
+#ifdef CONFIG_ARCH_NR_GPIO
+#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO
+#else
 #define ARCH_NR_GPIOS		512
 #endif
+#endif
 
 /*
  * "valid" GPIO numbers are nonnegative and may be passed to
-- 
2.7.0

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

* Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
  2016-02-15 15:46     ` Arnd Bergmann
@ 2016-02-15 16:01       ` Lars-Peter Clausen
  -1 siblings, 0 replies; 44+ messages in thread
From: Lars-Peter Clausen @ 2016-02-15 16:01 UTC (permalink / raw)
  To: Arnd Bergmann, Linus Walleij, Alexandre Courbot
  Cc: linux-arm-kernel, Russell King, Bjorn Helgaas, linux-gpio,
	linux-kernel, Ralf Baechle, Paul Burton, linux-mips

On 02/15/2016 04:46 PM, Arnd Bergmann wrote:
> +static inline __deprecated int irq_to_gpio(unsigned int irq)
> +{
> +	/* this has clearly not worked for a long time */
> +	return -EINVAL;
> +}
> +
>  #define IRQ_TO_BIT(irq) BIT(irq_to_gpio(irq) & 0x1f)

The issue seems to be a fallout from commit 832f5dacfa0b ("MIPS: Remove all
the uses of custom gpio.h").

The irq_to_gpio() should be replaced with "(irq - JZ4740_IRQ_GPIO(0))".

- Lars

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

* [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
@ 2016-02-15 16:01       ` Lars-Peter Clausen
  0 siblings, 0 replies; 44+ messages in thread
From: Lars-Peter Clausen @ 2016-02-15 16:01 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/15/2016 04:46 PM, Arnd Bergmann wrote:
> +static inline __deprecated int irq_to_gpio(unsigned int irq)
> +{
> +	/* this has clearly not worked for a long time */
> +	return -EINVAL;
> +}
> +
>  #define IRQ_TO_BIT(irq) BIT(irq_to_gpio(irq) & 0x1f)

The issue seems to be a fallout from commit 832f5dacfa0b ("MIPS: Remove all
the uses of custom gpio.h").

The irq_to_gpio() should be replaced with "(irq - JZ4740_IRQ_GPIO(0))".

- Lars

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

* Re: [PATCH 4/4] ARM: remove asm/gpio.h
  2016-02-15 15:46     ` Arnd Bergmann
@ 2016-02-15 16:03       ` Russell King - ARM Linux
  -1 siblings, 0 replies; 44+ messages in thread
From: Russell King - ARM Linux @ 2016-02-15 16:03 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Walleij, linux-arm-kernel, Bjorn Helgaas,
	Alexandre Courbot, linux-gpio, linux-kernel, linux-arch

On Mon, Feb 15, 2016 at 04:46:31PM +0100, Arnd Bergmann wrote:
> -#if CONFIG_ARCH_NR_GPIO > 0
> -#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO
> -#endif
...
> diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
> index 40ec1433f05d..2d04b321db13 100644
> --- a/include/asm-generic/gpio.h
> +++ b/include/asm-generic/gpio.h
> @@ -26,8 +26,12 @@
>   */
>  
>  #ifndef ARCH_NR_GPIOS
> +#ifdef CONFIG_ARCH_NR_GPIO
> +#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO
> +#else
>  #define ARCH_NR_GPIOS		512
>  #endif
> +#endif

This really isn't the same thing, especially when you look at:

config ARCH_NR_GPIO
        int
        default 1024 if ARCH_BRCMSTB || ARCH_SHMOBILE || ARCH_TEGRA || \
                ARCH_ZYNQ
        default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || \
                SOC_DRA7XX || ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210
        default 416 if ARCH_SUNXI
        default 392 if ARCH_U8500
        default 352 if ARCH_VT8500
        default 288 if ARCH_ROCKCHIP
        default 264 if MACH_H4700
        default 0

This has the effect of causing anything not mentioned above to end up
with ARCH_NR_GPIOS set to zero.

You really should _not_ be making these kinds of functional changes
when moving code around.  Separate the two changes: either first move
the code, and have a separate patch to make the functional changes, or
make the functional changes first, and then move the code around.

I'd have thought you would've known this by now...

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

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

* [PATCH 4/4] ARM: remove asm/gpio.h
@ 2016-02-15 16:03       ` Russell King - ARM Linux
  0 siblings, 0 replies; 44+ messages in thread
From: Russell King - ARM Linux @ 2016-02-15 16:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 15, 2016 at 04:46:31PM +0100, Arnd Bergmann wrote:
> -#if CONFIG_ARCH_NR_GPIO > 0
> -#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO
> -#endif
...
> diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
> index 40ec1433f05d..2d04b321db13 100644
> --- a/include/asm-generic/gpio.h
> +++ b/include/asm-generic/gpio.h
> @@ -26,8 +26,12 @@
>   */
>  
>  #ifndef ARCH_NR_GPIOS
> +#ifdef CONFIG_ARCH_NR_GPIO
> +#define ARCH_NR_GPIOS CONFIG_ARCH_NR_GPIO
> +#else
>  #define ARCH_NR_GPIOS		512
>  #endif
> +#endif

This really isn't the same thing, especially when you look at:

config ARCH_NR_GPIO
        int
        default 1024 if ARCH_BRCMSTB || ARCH_SHMOBILE || ARCH_TEGRA || \
                ARCH_ZYNQ
        default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || \
                SOC_DRA7XX || ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210
        default 416 if ARCH_SUNXI
        default 392 if ARCH_U8500
        default 352 if ARCH_VT8500
        default 288 if ARCH_ROCKCHIP
        default 264 if MACH_H4700
        default 0

This has the effect of causing anything not mentioned above to end up
with ARCH_NR_GPIOS set to zero.

You really should _not_ be making these kinds of functional changes
when moving code around.  Separate the two changes: either first move
the code, and have a separate patch to make the functional changes, or
make the functional changes first, and then move the code around.

I'd have thought you would've known this by now...

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

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

* Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
  2016-02-15 16:01       ` Lars-Peter Clausen
@ 2016-02-15 20:16         ` Arnd Bergmann
  -1 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-15 20:16 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Linus Walleij, Alexandre Courbot, linux-arm-kernel, Russell King,
	Bjorn Helgaas, linux-gpio, linux-kernel, Ralf Baechle,
	Paul Burton, linux-mips

On Monday 15 February 2016 17:01:09 Lars-Peter Clausen wrote:
> On 02/15/2016 04:46 PM, Arnd Bergmann wrote:
> > +static inline __deprecated int irq_to_gpio(unsigned int irq)
> > +{
> > +     /* this has clearly not worked for a long time */
> > +     return -EINVAL;
> > +}
> > +
> >  #define IRQ_TO_BIT(irq) BIT(irq_to_gpio(irq) & 0x1f)
> 
> The issue seems to be a fallout from commit 832f5dacfa0b ("MIPS: Remove all
> the uses of custom gpio.h").
> 
> The irq_to_gpio() should be replaced with "(irq - JZ4740_IRQ_GPIO(0))".
> 
> 

Ah, that explain it, so it has not been broken for that long.

	Arnd

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

* [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
@ 2016-02-15 20:16         ` Arnd Bergmann
  0 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-15 20:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 15 February 2016 17:01:09 Lars-Peter Clausen wrote:
> On 02/15/2016 04:46 PM, Arnd Bergmann wrote:
> > +static inline __deprecated int irq_to_gpio(unsigned int irq)
> > +{
> > +     /* this has clearly not worked for a long time */
> > +     return -EINVAL;
> > +}
> > +
> >  #define IRQ_TO_BIT(irq) BIT(irq_to_gpio(irq) & 0x1f)
> 
> The issue seems to be a fallout from commit 832f5dacfa0b ("MIPS: Remove all
> the uses of custom gpio.h").
> 
> The irq_to_gpio() should be replaced with "(irq - JZ4740_IRQ_GPIO(0))".
> 
> 

Ah, that explain it, so it has not been broken for that long.

	Arnd

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

* [PATCH v2 0/5] gpio: clean up irq_to_gpio and ARCH_NR_GPIOS
  2016-02-02 19:53 [PATCH 0/2] GPIO: Clean up asm/gpio.h Bjorn Helgaas
@ 2016-02-16 15:37   ` Arnd Bergmann
  2016-02-02 19:53 ` [PATCH 2/2] gpio: Remove unused asm/gpio.h files Bjorn Helgaas
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-16 15:37 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, Arnd Bergmann, Russell King, Bjorn Helgaas,
	Alexandre Courbot, linux-gpio, linux-kernel, Lars-Peter Clausen,
	Ralf Baechle, linux-mips

I noticed that arch/arm/include/asm/gpio.h can almost be removed,
after we have already removed the file for most other architectures
now.

When I removed it, I ran into problems with irq_to_gpio(), which
we had already killed off in ARM, but it survived (barely) in the
global headers and accidentally gained an invalid user

This kills it off some more.

The first patch should go as a bugfix into the MIPS tree, the
other ones should only get merged later, but I think that's fine
if they get submitted for 4.6. I left them as a series of five
patches to clarify the build-time dependency. Merging patch
2 before 1 turns the MIPS runtime error into a compiletime
error.

changes in v2:

* the MIPS change should now correctly fix the bug, thanks
  to Lars-Peter.

* I left out the ARM specific change for now, and just adapted
  the generic file so we don't need that any more.

*  Fixed the bug that Russell pointed out

	Arnd


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

* [PATCH v2 0/5] gpio: clean up irq_to_gpio and ARCH_NR_GPIOS
@ 2016-02-16 15:37   ` Arnd Bergmann
  0 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-16 15:37 UTC (permalink / raw)
  To: linux-arm-kernel

I noticed that arch/arm/include/asm/gpio.h can almost be removed,
after we have already removed the file for most other architectures
now.

When I removed it, I ran into problems with irq_to_gpio(), which
we had already killed off in ARM, but it survived (barely) in the
global headers and accidentally gained an invalid user

This kills it off some more.

The first patch should go as a bugfix into the MIPS tree, the
other ones should only get merged later, but I think that's fine
if they get submitted for 4.6. I left them as a series of five
patches to clarify the build-time dependency. Merging patch
2 before 1 turns the MIPS runtime error into a compiletime
error.

changes in v2:

* the MIPS change should now correctly fix the bug, thanks
  to Lars-Peter.

* I left out the ARM specific change for now, and just adapted
  the generic file so we don't need that any more.

*  Fixed the bug that Russell pointed out

	Arnd

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

* Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
  2016-02-15 15:46     ` Arnd Bergmann
  (?)
@ 2016-02-16 15:42       ` Linus Walleij
  -1 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2016-02-16 15:42 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alexandre Courbot, linux-arm-kernel, Russell King, Bjorn Helgaas,
	linux-gpio, linux-kernel, Ralf Baechle, Paul Burton, Linux MIPS

On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> gpiolib has removed the irq_to_gpio() API several years ago,
> but the global header still provided a non-working stub.
>
> Apparently one new user has shown up in arch/mips, so this patch
> moves the broken definition to where it is used, ensuring that
> we get new users but not changing the current behavior on jz4740.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Patch applied.

I expect the driver maintainer to deal with the resulting
deprecation fallout.

Yours,
Linus Walleij

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

* Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
@ 2016-02-16 15:42       ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2016-02-16 15:42 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alexandre Courbot, linux-arm-kernel, Russell King, Bjorn Helgaas,
	linux-gpio, linux-kernel, Ralf Baechle, Paul Burton, Linux MIPS

On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> gpiolib has removed the irq_to_gpio() API several years ago,
> but the global header still provided a non-working stub.
>
> Apparently one new user has shown up in arch/mips, so this patch
> moves the broken definition to where it is used, ensuring that
> we get new users but not changing the current behavior on jz4740.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Patch applied.

I expect the driver maintainer to deal with the resulting
deprecation fallout.

Yours,
Linus Walleij

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

* [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
@ 2016-02-16 15:42       ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2016-02-16 15:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> gpiolib has removed the irq_to_gpio() API several years ago,
> but the global header still provided a non-working stub.
>
> Apparently one new user has shown up in arch/mips, so this patch
> moves the broken definition to where it is used, ensuring that
> we get new users but not changing the current behavior on jz4740.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Patch applied.

I expect the driver maintainer to deal with the resulting
deprecation fallout.

Yours,
Linus Walleij

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

* Re: [PATCH 2/4] gpio: ks8695: remove irq_to_gpio function
  2016-02-15 15:46     ` Arnd Bergmann
  (?)
@ 2016-02-16 15:43       ` Linus Walleij
  -1 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2016-02-16 15:43 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Russell King, Bjorn Helgaas, Alexandre Courbot,
	linux-gpio, linux-kernel

On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> The ks8695 gpio driver has its own copy of the irq_to_gpio()
> function. This is completely unused in the mainline kernel
> after we converted all remaining users several years ago,
> so we can remove the definition as well.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Patch applied.

Yours,
Linus Walleij

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

* Re: [PATCH 2/4] gpio: ks8695: remove irq_to_gpio function
@ 2016-02-16 15:43       ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2016-02-16 15:43 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Russell King, Bjorn Helgaas, Alexandre Courbot,
	linux-gpio, linux-kernel

On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> The ks8695 gpio driver has its own copy of the irq_to_gpio()
> function. This is completely unused in the mainline kernel
> after we converted all remaining users several years ago,
> so we can remove the definition as well.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Patch applied.

Yours,
Linus Walleij

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

* [PATCH 2/4] gpio: ks8695: remove irq_to_gpio function
@ 2016-02-16 15:43       ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2016-02-16 15:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> The ks8695 gpio driver has its own copy of the irq_to_gpio()
> function. This is completely unused in the mainline kernel
> after we converted all remaining users several years ago,
> so we can remove the definition as well.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Patch applied.

Yours,
Linus Walleij

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

* Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
  2016-02-16 15:42       ` Linus Walleij
  (?)
@ 2016-02-16 15:45         ` Arnd Bergmann
  -1 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-16 15:45 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Courbot, linux-arm-kernel, Russell King, Bjorn Helgaas,
	linux-gpio, linux-kernel, Ralf Baechle, Paul Burton, Linux MIPS

On Tuesday 16 February 2016 16:42:18 Linus Walleij wrote:
> On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> 
> > gpiolib has removed the irq_to_gpio() API several years ago,
> > but the global header still provided a non-working stub.
> >
> > Apparently one new user has shown up in arch/mips, so this patch
> > moves the broken definition to where it is used, ensuring that
> > we get new users but not changing the current behavior on jz4740.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Patch applied.
> 
> I expect the driver maintainer to deal with the resulting
> deprecation fallout.
> 

I've just sent v2 of the series, with a separate patch for MIPS
that now conflicts with this one. Can you pick up the new patch
instead?

	Arnd

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

* Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
@ 2016-02-16 15:45         ` Arnd Bergmann
  0 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-16 15:45 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Courbot, linux-arm-kernel, Russell King, Bjorn Helgaas,
	linux-gpio, linux-kernel, Ralf Baechle, Paul Burton, Linux MIPS

On Tuesday 16 February 2016 16:42:18 Linus Walleij wrote:
> On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> 
> > gpiolib has removed the irq_to_gpio() API several years ago,
> > but the global header still provided a non-working stub.
> >
> > Apparently one new user has shown up in arch/mips, so this patch
> > moves the broken definition to where it is used, ensuring that
> > we get new users but not changing the current behavior on jz4740.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Patch applied.
> 
> I expect the driver maintainer to deal with the resulting
> deprecation fallout.
> 

I've just sent v2 of the series, with a separate patch for MIPS
that now conflicts with this one. Can you pick up the new patch
instead?

	Arnd

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

* [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
@ 2016-02-16 15:45         ` Arnd Bergmann
  0 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-16 15:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 16 February 2016 16:42:18 Linus Walleij wrote:
> On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> 
> > gpiolib has removed the irq_to_gpio() API several years ago,
> > but the global header still provided a non-working stub.
> >
> > Apparently one new user has shown up in arch/mips, so this patch
> > moves the broken definition to where it is used, ensuring that
> > we get new users but not changing the current behavior on jz4740.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Patch applied.
> 
> I expect the driver maintainer to deal with the resulting
> deprecation fallout.
> 

I've just sent v2 of the series, with a separate patch for MIPS
that now conflicts with this one. Can you pick up the new patch
instead?

	Arnd

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

* Re: [PATCH 3/4] gpio: ep93xx: remove private irq_to_gpio function
  2016-02-15 15:46     ` Arnd Bergmann
  (?)
@ 2016-02-16 15:51       ` Linus Walleij
  -1 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2016-02-16 15:51 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Russell King, Bjorn Helgaas, Alexandre Courbot,
	linux-gpio, linux-kernel

On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> The ep93xx goes through its own back-and-forth dance every time
> it wants to know the gpio number for an irq line, when it really
> just hardcodes a fixed offset in ep93xx_gpio_to_irq().
>
> This removes the pointless macro and replaces the conversion inside
> of the driver with simple add/subtract operations, using an
> explicit macro.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
(...)

> -#include <linux/gpio/driver.h>
> -/* FIXME: this is here for gpio_to_irq() - get rid of this! */
>  #include <linux/gpio.h>

No, what you want to get rid of is the #include <linux/gpio.h> not the
<linux/gpio/driver.h>, we want to be more specific. Sorry for putting the
comment wrong.

> @@ -35,6 +31,7 @@ void __iomem *ep93xx_gpio_base; /* FIXME: put this into irq_data */
>  #define EP93XX_GPIO_LINE_MAX           63
>
>  /* maximum value for irq capable line identifiers */
> +#define EP93XX_GPIO_IRQ_BASE           64
>  #define EP93XX_GPIO_LINE_MAX_IRQ       23

This doesn't apply to my tree :O

My EP93XX_GPIO_LINE_MAX_IRQ is in
arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h

So I think you must be having another patch somewhere in the ARM SoC
tree. (I can take it, just send it along with an update of this one.)

Yours,
Linus Walleij

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

* Re: [PATCH 3/4] gpio: ep93xx: remove private irq_to_gpio function
@ 2016-02-16 15:51       ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2016-02-16 15:51 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Russell King, Bjorn Helgaas, Alexandre Courbot,
	linux-gpio, linux-kernel

On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> The ep93xx goes through its own back-and-forth dance every time
> it wants to know the gpio number for an irq line, when it really
> just hardcodes a fixed offset in ep93xx_gpio_to_irq().
>
> This removes the pointless macro and replaces the conversion inside
> of the driver with simple add/subtract operations, using an
> explicit macro.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
(...)

> -#include <linux/gpio/driver.h>
> -/* FIXME: this is here for gpio_to_irq() - get rid of this! */
>  #include <linux/gpio.h>

No, what you want to get rid of is the #include <linux/gpio.h> not the
<linux/gpio/driver.h>, we want to be more specific. Sorry for putting the
comment wrong.

> @@ -35,6 +31,7 @@ void __iomem *ep93xx_gpio_base; /* FIXME: put this into irq_data */
>  #define EP93XX_GPIO_LINE_MAX           63
>
>  /* maximum value for irq capable line identifiers */
> +#define EP93XX_GPIO_IRQ_BASE           64
>  #define EP93XX_GPIO_LINE_MAX_IRQ       23

This doesn't apply to my tree :O

My EP93XX_GPIO_LINE_MAX_IRQ is in
arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h

So I think you must be having another patch somewhere in the ARM SoC
tree. (I can take it, just send it along with an update of this one.)

Yours,
Linus Walleij

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

* [PATCH 3/4] gpio: ep93xx: remove private irq_to_gpio function
@ 2016-02-16 15:51       ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2016-02-16 15:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> The ep93xx goes through its own back-and-forth dance every time
> it wants to know the gpio number for an irq line, when it really
> just hardcodes a fixed offset in ep93xx_gpio_to_irq().
>
> This removes the pointless macro and replaces the conversion inside
> of the driver with simple add/subtract operations, using an
> explicit macro.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
(...)

> -#include <linux/gpio/driver.h>
> -/* FIXME: this is here for gpio_to_irq() - get rid of this! */
>  #include <linux/gpio.h>

No, what you want to get rid of is the #include <linux/gpio.h> not the
<linux/gpio/driver.h>, we want to be more specific. Sorry for putting the
comment wrong.

> @@ -35,6 +31,7 @@ void __iomem *ep93xx_gpio_base; /* FIXME: put this into irq_data */
>  #define EP93XX_GPIO_LINE_MAX           63
>
>  /* maximum value for irq capable line identifiers */
> +#define EP93XX_GPIO_IRQ_BASE           64
>  #define EP93XX_GPIO_LINE_MAX_IRQ       23

This doesn't apply to my tree :O

My EP93XX_GPIO_LINE_MAX_IRQ is in
arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h

So I think you must be having another patch somewhere in the ARM SoC
tree. (I can take it, just send it along with an update of this one.)

Yours,
Linus Walleij

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

* Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
  2016-02-16 15:45         ` Arnd Bergmann
  (?)
@ 2016-02-16 15:53           ` Linus Walleij
  -1 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2016-02-16 15:53 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alexandre Courbot, linux-arm-kernel, Russell King, Bjorn Helgaas,
	linux-gpio, linux-kernel, Ralf Baechle, Paul Burton, Linux MIPS

On Tue, Feb 16, 2016 at 4:45 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> I've just sent v2 of the series, with a separate patch for MIPS
> that now conflicts with this one. Can you pick up the new patch
> instead?

OK I'll back out and apply the v2 versions.

Yours,
Linus Walleij

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

* Re: [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
@ 2016-02-16 15:53           ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2016-02-16 15:53 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alexandre Courbot, linux-arm-kernel, Russell King, Bjorn Helgaas,
	linux-gpio, linux-kernel, Ralf Baechle, Paul Burton, Linux MIPS

On Tue, Feb 16, 2016 at 4:45 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> I've just sent v2 of the series, with a separate patch for MIPS
> that now conflicts with this one. Can you pick up the new patch
> instead?

OK I'll back out and apply the v2 versions.

Yours,
Linus Walleij

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

* [PATCH 1/4] gpio: remove broken irq_to_gpio() interface
@ 2016-02-16 15:53           ` Linus Walleij
  0 siblings, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2016-02-16 15:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Feb 16, 2016 at 4:45 PM, Arnd Bergmann <arnd@arndb.de> wrote:

> I've just sent v2 of the series, with a separate patch for MIPS
> that now conflicts with this one. Can you pick up the new patch
> instead?

OK I'll back out and apply the v2 versions.

Yours,
Linus Walleij

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

* Re: [PATCH 3/4] gpio: ep93xx: remove private irq_to_gpio function
  2016-02-16 15:51       ` Linus Walleij
  (?)
@ 2016-02-16 16:12         ` Arnd Bergmann
  -1 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-16 16:12 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, Russell King, Bjorn Helgaas, Alexandre Courbot,
	linux-gpio, linux-kernel

On Tuesday 16 February 2016 16:51:57 Linus Walleij wrote:
> On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> 
> > The ep93xx goes through its own back-and-forth dance every time
> > it wants to know the gpio number for an irq line, when it really
> > just hardcodes a fixed offset in ep93xx_gpio_to_irq().
> >
> > This removes the pointless macro and replaces the conversion inside
> > of the driver with simple add/subtract operations, using an
> > explicit macro.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> (...)
> 
> > -#include <linux/gpio/driver.h>
> > -/* FIXME: this is here for gpio_to_irq() - get rid of this! */
> >  #include <linux/gpio.h>
> 
> No, what you want to get rid of is the #include <linux/gpio.h> not the
> <linux/gpio/driver.h>, we want to be more specific. Sorry for putting the
> comment wrong.

I think I initially did that, but ran into another build error then.

> 
> > @@ -35,6 +31,7 @@ void __iomem *ep93xx_gpio_base; /* FIXME: put this into irq_data */
> >  #define EP93XX_GPIO_LINE_MAX           63
> >
> >  /* maximum value for irq capable line identifiers */
> > +#define EP93XX_GPIO_IRQ_BASE           64
> >  #define EP93XX_GPIO_LINE_MAX_IRQ       23
> 
> This doesn't apply to my tree :O
> 
> My EP93XX_GPIO_LINE_MAX_IRQ is in
> arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h
> 
> So I think you must be having another patch somewhere in the ARM SoC
> tree. (I can take it, just send it along with an update of this one.)

Ah, that is right. Let's just drop this patch for now,
it's not important.

I have an old patch below to make the driver independent of
the headers, but I have to look at that patch again before
submitting it. I'll sort this one next to it.

	Arnd

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

* Re: [PATCH 3/4] gpio: ep93xx: remove private irq_to_gpio function
@ 2016-02-16 16:12         ` Arnd Bergmann
  0 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-16 16:12 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, Russell King, Bjorn Helgaas, Alexandre Courbot,
	linux-gpio, linux-kernel

On Tuesday 16 February 2016 16:51:57 Linus Walleij wrote:
> On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> 
> > The ep93xx goes through its own back-and-forth dance every time
> > it wants to know the gpio number for an irq line, when it really
> > just hardcodes a fixed offset in ep93xx_gpio_to_irq().
> >
> > This removes the pointless macro and replaces the conversion inside
> > of the driver with simple add/subtract operations, using an
> > explicit macro.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> (...)
> 
> > -#include <linux/gpio/driver.h>
> > -/* FIXME: this is here for gpio_to_irq() - get rid of this! */
> >  #include <linux/gpio.h>
> 
> No, what you want to get rid of is the #include <linux/gpio.h> not the
> <linux/gpio/driver.h>, we want to be more specific. Sorry for putting the
> comment wrong.

I think I initially did that, but ran into another build error then.

> 
> > @@ -35,6 +31,7 @@ void __iomem *ep93xx_gpio_base; /* FIXME: put this into irq_data */
> >  #define EP93XX_GPIO_LINE_MAX           63
> >
> >  /* maximum value for irq capable line identifiers */
> > +#define EP93XX_GPIO_IRQ_BASE           64
> >  #define EP93XX_GPIO_LINE_MAX_IRQ       23
> 
> This doesn't apply to my tree :O
> 
> My EP93XX_GPIO_LINE_MAX_IRQ is in
> arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h
> 
> So I think you must be having another patch somewhere in the ARM SoC
> tree. (I can take it, just send it along with an update of this one.)

Ah, that is right. Let's just drop this patch for now,
it's not important.

I have an old patch below to make the driver independent of
the headers, but I have to look at that patch again before
submitting it. I'll sort this one next to it.

	Arnd

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

* [PATCH 3/4] gpio: ep93xx: remove private irq_to_gpio function
@ 2016-02-16 16:12         ` Arnd Bergmann
  0 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2016-02-16 16:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 16 February 2016 16:51:57 Linus Walleij wrote:
> On Mon, Feb 15, 2016 at 4:46 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> 
> > The ep93xx goes through its own back-and-forth dance every time
> > it wants to know the gpio number for an irq line, when it really
> > just hardcodes a fixed offset in ep93xx_gpio_to_irq().
> >
> > This removes the pointless macro and replaces the conversion inside
> > of the driver with simple add/subtract operations, using an
> > explicit macro.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> (...)
> 
> > -#include <linux/gpio/driver.h>
> > -/* FIXME: this is here for gpio_to_irq() - get rid of this! */
> >  #include <linux/gpio.h>
> 
> No, what you want to get rid of is the #include <linux/gpio.h> not the
> <linux/gpio/driver.h>, we want to be more specific. Sorry for putting the
> comment wrong.

I think I initially did that, but ran into another build error then.

> 
> > @@ -35,6 +31,7 @@ void __iomem *ep93xx_gpio_base; /* FIXME: put this into irq_data */
> >  #define EP93XX_GPIO_LINE_MAX           63
> >
> >  /* maximum value for irq capable line identifiers */
> > +#define EP93XX_GPIO_IRQ_BASE           64
> >  #define EP93XX_GPIO_LINE_MAX_IRQ       23
> 
> This doesn't apply to my tree :O
> 
> My EP93XX_GPIO_LINE_MAX_IRQ is in
> arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h
> 
> So I think you must be having another patch somewhere in the ARM SoC
> tree. (I can take it, just send it along with an update of this one.)

Ah, that is right. Let's just drop this patch for now,
it's not important.

I have an old patch below to make the driver independent of
the headers, but I have to look at that patch again before
submitting it. I'll sort this one next to it.

	Arnd

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

end of thread, other threads:[~2016-02-16 16:13 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-02 19:53 [PATCH 0/2] GPIO: Clean up asm/gpio.h Bjorn Helgaas
2016-02-02 19:53 ` [PATCH 1/2] gpio: Include linux/gpio.h instead of asm/gpio.h Bjorn Helgaas
2016-02-03  0:02   ` Alexandre Courbot
2016-02-15 13:35   ` Linus Walleij
2016-02-02 19:53 ` [PATCH 2/2] gpio: Remove unused asm/gpio.h files Bjorn Helgaas
2016-02-03  0:03   ` Alexandre Courbot
2016-02-03  8:19 ` [PATCH 0/2] GPIO: Clean up asm/gpio.h Thomas Gleixner
2016-02-05 13:43 ` Linus Walleij
2016-02-15 15:46 ` [PATCH 0/4] clean up irq_to_gpio and asm/gpio.h Arnd Bergmann
2016-02-15 15:46   ` Arnd Bergmann
2016-02-15 15:46   ` [PATCH 1/4] gpio: remove broken irq_to_gpio() interface Arnd Bergmann
2016-02-15 15:46     ` Arnd Bergmann
2016-02-15 16:01     ` Lars-Peter Clausen
2016-02-15 16:01       ` Lars-Peter Clausen
2016-02-15 20:16       ` Arnd Bergmann
2016-02-15 20:16         ` Arnd Bergmann
2016-02-16 15:42     ` Linus Walleij
2016-02-16 15:42       ` Linus Walleij
2016-02-16 15:42       ` Linus Walleij
2016-02-16 15:45       ` Arnd Bergmann
2016-02-16 15:45         ` Arnd Bergmann
2016-02-16 15:45         ` Arnd Bergmann
2016-02-16 15:53         ` Linus Walleij
2016-02-16 15:53           ` Linus Walleij
2016-02-16 15:53           ` Linus Walleij
2016-02-15 15:46   ` [PATCH 2/4] gpio: ks8695: remove irq_to_gpio function Arnd Bergmann
2016-02-15 15:46     ` Arnd Bergmann
2016-02-16 15:43     ` Linus Walleij
2016-02-16 15:43       ` Linus Walleij
2016-02-16 15:43       ` Linus Walleij
2016-02-15 15:46   ` [PATCH 3/4] gpio: ep93xx: remove private " Arnd Bergmann
2016-02-15 15:46     ` Arnd Bergmann
2016-02-16 15:51     ` Linus Walleij
2016-02-16 15:51       ` Linus Walleij
2016-02-16 15:51       ` Linus Walleij
2016-02-16 16:12       ` Arnd Bergmann
2016-02-16 16:12         ` Arnd Bergmann
2016-02-16 16:12         ` Arnd Bergmann
2016-02-15 15:46   ` [PATCH 4/4] ARM: remove asm/gpio.h Arnd Bergmann
2016-02-15 15:46     ` Arnd Bergmann
2016-02-15 16:03     ` Russell King - ARM Linux
2016-02-15 16:03       ` Russell King - ARM Linux
2016-02-16 15:37 ` [PATCH v2 0/5] gpio: clean up irq_to_gpio and ARCH_NR_GPIOS Arnd Bergmann
2016-02-16 15:37   ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.