diff mbox

[4/4] ARM: remove asm/gpio.h

Message ID 1455551208-2825510-5-git-send-email-arnd@arndb.de
State New
Headers show

Commit Message

Arnd Bergmann Feb. 15, 2016, 3:46 p.m. UTC
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

Comments

Russell King - ARM Linux Feb. 15, 2016, 4:03 p.m. UTC | #1
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...
diff mbox

Patch

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