Commit 8f3c4537 authored by Russell King's avatar Russell King

ARM: gpio: make trivial GPIOLIB implementation the default

Rather than marking the mach/gpio.h header files which want to use the
trivial GPIOLIB implementation, mark those which do not want to use it
instead.  This means that by default, you get the trivial implementation
and only have to do something extra if you need to.  This should
encourage the use of the trivial default implementation.

As an additional bonus, several gpio.h header files become empty.
Acked-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Tested-by: default avatarJamie Iles <jamie@jamieiles.com>
Acked-by: default avatarKukjin Kim <kgene.kim@samsung.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 01e7dc89
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
/* not all ARM platforms necessarily support this API ... */ /* not all ARM platforms necessarily support this API ... */
#include <mach/gpio.h> #include <mach/gpio.h>
#ifdef __ARM_GPIOLIB_TRIVIAL #ifndef __ARM_GPIOLIB_COMPLEX
/* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */ /* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */
#include <asm-generic/gpio.h> #include <asm-generic/gpio.h>
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm-generic/gpio.h> #include <asm-generic/gpio.h>
#define __ARM_GPIOLIB_COMPLEX
#define IOP3XX_N_GPIOS 8 #define IOP3XX_N_GPIOS 8
static inline int gpio_get_value(unsigned gpio) static inline int gpio_get_value(unsigned gpio)
......
...@@ -215,8 +215,6 @@ extern void at91_gpio_resume(void); ...@@ -215,8 +215,6 @@ extern void at91_gpio_resume(void);
#include <asm/errno.h> #include <asm/errno.h>
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq(gpio) (gpio) #define gpio_to_irq(gpio) (gpio)
#define irq_to_gpio(irq) (irq) #define irq_to_gpio(irq) (irq)
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/common.h> #include <mach/common.h>
#define __ARM_GPIOLIB_COMPLEX
#define DAVINCI_GPIO_BASE 0x01C67000 #define DAVINCI_GPIO_BASE 0x01C67000
enum davinci_gpio_type { enum davinci_gpio_type {
......
...@@ -99,9 +99,6 @@ ...@@ -99,9 +99,6 @@
/* maximum value for irq capable line identifiers */ /* maximum value for irq capable line identifiers */
#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7) #define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7)
/* new generic GPIO API - see Documentation/gpio.txt */
#define __ARM_GPIOLIB_TRIVIAL
/* /*
* Map GPIO A0..A7 (0..7) to irq 64..71, * Map GPIO A0..A7 (0..7) to irq 64..71,
* B0..B7 (7..15) to irq 72..79, and * B0..B7 (7..15) to irq 72..79, and
......
...@@ -146,6 +146,4 @@ enum s5p_gpio_number { ...@@ -146,6 +146,4 @@ enum s5p_gpio_number {
#define ARCH_NR_GPIOS (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + \ #define ARCH_NR_GPIOS (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + \
CONFIG_SAMSUNG_GPIO_EXTRA + 1) CONFIG_SAMSUNG_GPIO_EXTRA + 1)
#define __ARM_GPIOLIB_TRIVIAL
#endif /* __ASM_ARCH_GPIO_H */ #endif /* __ASM_ARCH_GPIO_H */
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#include <mach/irqs.h> #include <mach/irqs.h>
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq(x) ((x) + GPIO_IRQ_BASE) #define gpio_to_irq(x) ((x) + GPIO_IRQ_BASE)
#define irq_to_gpio(x) ((x) - GPIO_IRQ_BASE) #define irq_to_gpio(x) ((x) - GPIO_IRQ_BASE)
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#define __ARM_GPIOLIB_COMPLEX
static inline int gpio_request(unsigned gpio, const char *label) static inline int gpio_request(unsigned gpio, const char *label)
{ {
return 0; return 0;
......
...@@ -40,8 +40,6 @@ extern int ks8695_gpio_interrupt(unsigned int pin, unsigned int type); ...@@ -40,8 +40,6 @@ extern int ks8695_gpio_interrupt(unsigned int pin, unsigned int type);
*/ */
extern int irq_to_gpio(unsigned int irq); extern int irq_to_gpio(unsigned int irq);
#define __ARM_GPIOLIB_TRIVIAL
/* Register the GPIOs */ /* Register the GPIOs */
extern void ks8695_register_gpios(void); extern void ks8695_register_gpios(void);
......
...@@ -49,6 +49,4 @@ ...@@ -49,6 +49,4 @@
*/ */
#define LPC32XX_GPIO(x, y) ((x) + (y)) #define LPC32XX_GPIO(x, y) ((x) + (y))
#define __ARM_GPIOLIB_TRIVIAL
#endif #endif
/* /* empty */
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
* Author: Mike Lockwood <lockwood@android.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __ASM_ARCH_MSM_GPIO_H
#define __ASM_ARCH_MSM_GPIO_H
#define __ARM_GPIOLIB_TRIVIAL
#endif /* __ASM_ARCH_MSM_GPIO_H */
...@@ -22,9 +22,6 @@ ...@@ -22,9 +22,6 @@
#define MXS_GPIO_NR(bank, nr) ((bank) * 32 + (nr)) #define MXS_GPIO_NR(bank, nr) ((bank) * 32 + (nr))
/* use gpiolib dispatchers */
#define __ARM_GPIOLIB_TRIVIAL
#define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START) #define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START)
#endif /* __MACH_MXS_GPIO_H__ */ #endif /* __MACH_MXS_GPIO_H__ */
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#define __ARM_GPIOLIB_TRIVIAL
/* some boards require extra gpio capacity to support external /* some boards require extra gpio capacity to support external
* devices that need GPIO. * devices that need GPIO.
*/ */
......
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#define __ARM_GPIOLIB_TRIVIAL
/* GPIO bank sizes */ /* GPIO bank sizes */
#define S3C64XX_GPIO_A_NR (8) #define S3C64XX_GPIO_A_NR (8)
#define S3C64XX_GPIO_B_NR (7) #define S3C64XX_GPIO_B_NR (7)
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#ifndef __ASM_ARCH_GPIO_H #ifndef __ASM_ARCH_GPIO_H
#define __ASM_ARCH_GPIO_H __FILE__ #define __ASM_ARCH_GPIO_H __FILE__
#define __ARM_GPIOLIB_TRIVIAL
/* GPIO bank sizes */ /* GPIO bank sizes */
#define S5P6440_GPIO_A_NR (6) #define S5P6440_GPIO_A_NR (6)
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#ifndef __ASM_ARCH_GPIO_H #ifndef __ASM_ARCH_GPIO_H
#define __ASM_ARCH_GPIO_H __FILE__ #define __ASM_ARCH_GPIO_H __FILE__
#define __ARM_GPIOLIB_TRIVIAL
/* GPIO bank sizes */ /* GPIO bank sizes */
#define S5PC100_GPIO_A0_NR (8) #define S5PC100_GPIO_A0_NR (8)
#define S5PC100_GPIO_A1_NR (5) #define S5PC100_GPIO_A1_NR (5)
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#ifndef __ASM_ARCH_GPIO_H #ifndef __ASM_ARCH_GPIO_H
#define __ASM_ARCH_GPIO_H __FILE__ #define __ASM_ARCH_GPIO_H __FILE__
#define __ARM_GPIOLIB_TRIVIAL
/* Practically, GPIO banks up to MP03 are the configurable gpio banks */ /* Practically, GPIO banks up to MP03 are the configurable gpio banks */
/* GPIO bank sizes */ /* GPIO bank sizes */
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <asm/irq.h> #include <asm/irq.h>
#include <asm-generic/gpio.h> #include <asm-generic/gpio.h>
#define __ARM_GPIOLIB_COMPLEX
static inline int gpio_get_value(unsigned gpio) static inline int gpio_get_value(unsigned gpio)
{ {
if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX)) if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
......
...@@ -18,13 +18,15 @@ ...@@ -18,13 +18,15 @@
#ifdef CONFIG_GPIOLIB #ifdef CONFIG_GPIOLIB
#define __ARM_GPIOLIB_TRIVIAL
static inline int irq_to_gpio(unsigned int irq) static inline int irq_to_gpio(unsigned int irq)
{ {
return -ENOSYS; return -ENOSYS;
} }
#else
#define __ARM_GPIOLIB_COMPLEX
#endif /* CONFIG_GPIOLIB */ #endif /* CONFIG_GPIOLIB */
#endif /* __ASM_ARCH_GPIO_H */ #endif /* __ASM_ARCH_GPIO_H */
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#define TEGRA_NR_GPIOS INT_GPIO_NR #define TEGRA_NR_GPIOS INT_GPIO_NR
#define __ARM_GPIOLIB_TRIVIAL
#define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio)) #define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio))
#define TEGRA_IRQ_TO_GPIO(irq) ((irq) - INT_GPIO_BASE) #define TEGRA_IRQ_TO_GPIO(irq) ((irq) - INT_GPIO_BASE)
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/irq.h> #include <asm/irq.h>
#define __ARM_GPIOLIB_COMPLEX
/* Switch type depending on platform/chip variant */ /* Switch type depending on platform/chip variant */
#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330) #if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
#define U300_COH901335 #define U300_COH901335
......
#define __ARM_GPIOLIB_TRIVIAL /* empty */
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/irq.h> #include <asm/irq.h>
#define __ARM_GPIOLIB_TRIVIAL
static inline int gpio_to_irq(unsigned gpio) static inline int gpio_to_irq(unsigned gpio)
{ {
return gpio; return gpio;
......
...@@ -27,9 +27,6 @@ ...@@ -27,9 +27,6 @@
/* range e.g. GPIO_1_5 is gpio 5 under linux */ /* range e.g. GPIO_1_5 is gpio 5 under linux */
#define IMX_GPIO_NR(bank, nr) (((bank) - 1) * 32 + (nr)) #define IMX_GPIO_NR(bank, nr) (((bank) - 1) * 32 + (nr))
/* use gpiolib dispatchers */
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq(gpio) (MXC_GPIO_IRQ_START + (gpio)) #define gpio_to_irq(gpio) (MXC_GPIO_IRQ_START + (gpio))
#define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START) #define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START)
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#define __ARM_GPIOLIB_TRIVIAL
/* /*
* "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving
* the "gpio" namespace for generic and cross-machine functions * the "gpio" namespace for generic and cross-machine functions
......
...@@ -222,8 +222,6 @@ extern void omap_gpio_restore_context(void); ...@@ -222,8 +222,6 @@ extern void omap_gpio_restore_context(void);
#include <linux/errno.h> #include <linux/errno.h>
#include <asm-generic/gpio.h> #include <asm-generic/gpio.h>
#define __ARM_GPIOLIB_TRIVIAL
static inline int irq_to_gpio(unsigned irq) static inline int irq_to_gpio(unsigned irq)
{ {
int tmp; int tmp;
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include <linux/init.h> #include <linux/init.h>
#define __ARM_GPIOLIB_TRIVIAL
/* /*
* Orion-specific GPIO API extensions. * Orion-specific GPIO API extensions.
*/ */
......
#ifndef __PLAT_GPIO_H #ifndef __PLAT_GPIO_H
#define __PLAT_GPIO_H #define __PLAT_GPIO_H
#define __ARM_GPIOLIB_COMPLEX
struct irq_data; struct irq_data;
/* /*
......
/* /* empty */
* arch/arm/plat-spear/include/plat/gpio.h
*
* GPIO macros for SPEAr platform
*
* Copyright (C) 2009 ST Microelectronics
* Viresh Kumar<viresh.kumar@st.com>
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#ifndef __PLAT_GPIO_H
#define __PLAT_GPIO_H
#define __ARM_GPIOLIB_TRIVIAL
#endif /* __PLAT_GPIO_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment