Skip to content

Commit

Permalink
GPIO: sa1100: implement proper gpiolib gpio_to_irq conversion
Browse files Browse the repository at this point in the history
The existing gpio_to_irq() implementation on sa1100 only translates
validly for internal GPIOs.  Since this sub-arch enables GPIOLIB
support, this results in buggy translations for non-internal GPIOs.

Get rid of the private gpio_to_irq() implementation, replacing it
with the .to_irq method in the sa1100 gpio chip instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
  • Loading branch information
Russell King authored and Grant Likely committed Jan 14, 2012
1 parent fda8790 commit f408c98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 0 additions & 3 deletions arch/arm/mach-sa1100/include/mach/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,4 @@ static inline void gpio_set_value(unsigned gpio, int value)

#define gpio_cansleep __gpio_cansleep

#define gpio_to_irq(gpio) ((gpio < 11) ? (IRQ_GPIO0 + gpio) : \
(IRQ_GPIO11 - 11 + gpio))

#endif
6 changes: 6 additions & 0 deletions drivers/gpio/gpio-sa1100.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,18 @@ static int sa1100_direction_output(struct gpio_chip *chip, unsigned offset, int
return 0;
}

static int sa1100_to_irq(struct gpio_chip *chip, unsigned offset)
{
return offset < 11 ? (IRQ_GPIO0 + offset) : (IRQ_GPIO11 - 11 + offset);
}

static struct gpio_chip sa1100_gpio_chip = {
.label = "gpio",
.direction_input = sa1100_direction_input,
.direction_output = sa1100_direction_output,
.set = sa1100_gpio_set,
.get = sa1100_gpio_get,
.to_irq = sa1100_to_irq,
.base = 0,
.ngpio = GPIO_MAX + 1,
};
Expand Down

0 comments on commit f408c98

Please sign in to comment.