Re: [PATCH 1/2] [ARM] tegra: introduce TEGRA_NR_GPIOS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ARCH_NR_GPIOS must be defined somewhere for gpiolib.  Where do you define it?

Some architectures seem to define ARCH_NR_GPIOS as something like
TEGRA_NR_GPIOS + CONFIG_BOARD_NR_GPIOS.  What do you think of that
approach?

On Tue, Jul 27, 2010 at 3:38 AM, Mike Rapoport <mike@xxxxxxxxxxxxxx> wrote:
> Tegra GPIO implementation defined ARCH_NR_GPIOS to be equal to number of
> GPIOs available on the Tegra SoC thus preventing usage of GPIO
> extensions. Introduction of TEGRA_NR_GPIOS allows gpiolib to
> manage non-Tegra GPIOs
>
> Signed-off-by: Mike Rapoport <mike@xxxxxxxxxxxxxx>
> ---
>  arch/arm/mach-tegra/gpio.c              |    8 ++++----
>  arch/arm/mach-tegra/include/mach/gpio.h |    4 ++--
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/mach-tegra/gpio.c b/arch/arm/mach-tegra/gpio.c
> index 7008a2b..4c66574 100644
> --- a/arch/arm/mach-tegra/gpio.c
> +++ b/arch/arm/mach-tegra/gpio.c
> @@ -144,7 +144,7 @@ static struct gpio_chip tegra_gpio_chip = {
>        .direction_output       = tegra_gpio_direction_output,
>        .set                    = tegra_gpio_set,
>        .base                   = 0,
> -       .ngpio                  = ARCH_NR_GPIOS,
> +       .ngpio                  = TEGRA_NR_GPIOS,
>  };
>
>  static void tegra_gpio_irq_ack(unsigned int irq)
> @@ -281,7 +281,7 @@ void tegra_gpio_resume(void)
>
>        local_irq_restore(flags);
>
> -       for (i=INT_GPIO_BASE; i<(INT_GPIO_BASE+ARCH_NR_GPIOS); i++) {
> +       for (i=INT_GPIO_BASE; i<(INT_GPIO_BASE+TEGRA_NR_GPIOS); i++) {
>                struct irq_desc *desc = irq_to_desc(i);
>                if (!desc || (desc->status & IRQ_WAKEUP)) continue;
>                enable_irq(i);
> @@ -294,7 +294,7 @@ void tegra_gpio_suspend(void)
>        int b, p, i;
>
>
> -       for (i=INT_GPIO_BASE; i<(INT_GPIO_BASE+ARCH_NR_GPIOS); i++) {
> +       for (i=INT_GPIO_BASE; i<(INT_GPIO_BASE+TEGRA_NR_GPIOS); i++) {
>                struct irq_desc *desc = irq_to_desc(i);
>                if (!desc) continue;
>                if (desc->status & IRQ_WAKEUP) {
> @@ -361,7 +361,7 @@ static int __init tegra_gpio_init(void)
>
>        gpiochip_add(&tegra_gpio_chip);
>
> -       for (i = INT_GPIO_BASE; i < (INT_GPIO_BASE + ARCH_NR_GPIOS); i++) {
> +       for (i = INT_GPIO_BASE; i < (INT_GPIO_BASE + TEGRA_NR_GPIOS); i++) {
>                bank = &tegra_gpio_banks[GPIO_BANK(irq_to_gpio(i))];
>
>                lockdep_set_class(&irq_desc[i].lock, &gpio_lock_class);
> diff --git a/arch/arm/mach-tegra/include/mach/gpio.h b/arch/arm/mach-tegra/include/mach/gpio.h
> index 3b5b8c9..e339e5b 100644
> --- a/arch/arm/mach-tegra/include/mach/gpio.h
> +++ b/arch/arm/mach-tegra/include/mach/gpio.h
> @@ -22,7 +22,7 @@
>
>  #include <mach/irqs.h>
>
> -#define ARCH_NR_GPIOS          INT_GPIO_NR
> +#define TEGRA_NR_GPIOS         INT_GPIO_NR
>
>  #include <asm-generic/gpio.h>
>
> @@ -35,7 +35,7 @@
>
>  static inline int gpio_to_irq(unsigned int gpio)
>  {
> -       if (gpio < ARCH_NR_GPIOS)
> +       if (gpio < TEGRA_NR_GPIOS)
>                return INT_GPIO_BASE + gpio;
>        return -EINVAL;
>  }
> --
> 1.6.6.2
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux