Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f408c985 authored by Russell King's avatar Russell King Committed by Grant Likely
Browse files

GPIO: sa1100: implement proper gpiolib gpio_to_irq conversion



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: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent fda87903
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -51,7 +51,4 @@ static inline void gpio_set_value(unsigned gpio, int value)


#define gpio_cansleep	__gpio_cansleep
#define gpio_cansleep	__gpio_cansleep


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

#endif
#endif
+6 −0
Original line number Original line Diff line number Diff line
@@ -47,12 +47,18 @@ static int sa1100_direction_output(struct gpio_chip *chip, unsigned offset, int
	return 0;
	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 = {
static struct gpio_chip sa1100_gpio_chip = {
	.label			= "gpio",
	.label			= "gpio",
	.direction_input	= sa1100_direction_input,
	.direction_input	= sa1100_direction_input,
	.direction_output	= sa1100_direction_output,
	.direction_output	= sa1100_direction_output,
	.set			= sa1100_gpio_set,
	.set			= sa1100_gpio_set,
	.get			= sa1100_gpio_get,
	.get			= sa1100_gpio_get,
	.to_irq			= sa1100_to_irq,
	.base			= 0,
	.base			= 0,
	.ngpio			= GPIO_MAX + 1,
	.ngpio			= GPIO_MAX + 1,
};
};