ARM: 8229/1: sa1100: replace irq numbers with names in irq driver

In preparation for further changes replace direct IRQ numbers with
pre-defined names. This imposes no real code changes.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Dmitry Eremin-Solenikov 2014-11-28 15:56:13 +01:00 committed by Russell King
parent ff7f6d0bc5
commit 0fea30c63e

View File

@ -37,14 +37,14 @@ static int GPIO_IRQ_mask = (1 << 11) - 1;
/* /*
* To get the GPIO number from an IRQ number * To get the GPIO number from an IRQ number
*/ */
#define GPIO_11_27_IRQ(i) ((i) - 21) #define GPIO_11_27_IRQ(i) ((i) + 11 - IRQ_GPIO11)
#define GPIO11_27_MASK(irq) (1 << GPIO_11_27_IRQ(irq)) #define GPIO11_27_MASK(irq) (1 << GPIO_11_27_IRQ(irq))
static int sa1100_gpio_type(struct irq_data *d, unsigned int type) static int sa1100_gpio_type(struct irq_data *d, unsigned int type)
{ {
unsigned int mask; unsigned int mask;
if (d->irq <= 10) if (d->irq <= IRQ_GPIO10)
mask = 1 << d->irq; mask = 1 << d->irq;
else else
mask = GPIO11_27_MASK(d->irq); mask = GPIO11_27_MASK(d->irq);
@ -71,7 +71,7 @@ static int sa1100_gpio_type(struct irq_data *d, unsigned int type)
} }
/* /*
* GPIO IRQs must be acknowledged. This is for IRQs from 0 to 10. * GPIO IRQs must be acknowledged. This is for IRQs from GPIO0 to 10.
*/ */
static void sa1100_low_gpio_ack(struct irq_data *d) static void sa1100_low_gpio_ack(struct irq_data *d)
{ {
@ -189,7 +189,7 @@ static struct irq_chip sa1100_high_gpio_chip = {
/* /*
* We don't need to ACK IRQs on the SA1100 unless they're GPIOs * We don't need to ACK IRQs on the SA1100 unless they're GPIOs
* this is for internal IRQs i.e. from 11 to 31. * this is for internal IRQs i.e. from IRQ LCD to RTCAlrm.
*/ */
static void sa1100_mask_irq(struct irq_data *d) static void sa1100_mask_irq(struct irq_data *d)
{ {
@ -332,19 +332,19 @@ void __init sa1100_init_irq(void)
*/ */
ICCR = 1; ICCR = 1;
for (irq = 0; irq <= 10; irq++) { for (irq = IRQ_GPIO0; irq <= IRQ_GPIO10; irq++) {
irq_set_chip_and_handler(irq, &sa1100_low_gpio_chip, irq_set_chip_and_handler(irq, &sa1100_low_gpio_chip,
handle_edge_irq); handle_edge_irq);
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
} }
for (irq = 12; irq <= 31; irq++) { for (irq = IRQ_LCD; irq <= IRQ_RTCAlrm; irq++) {
irq_set_chip_and_handler(irq, &sa1100_normal_chip, irq_set_chip_and_handler(irq, &sa1100_normal_chip,
handle_level_irq); handle_level_irq);
set_irq_flags(irq, IRQF_VALID); set_irq_flags(irq, IRQF_VALID);
} }
for (irq = 32; irq <= 48; irq++) { for (irq = IRQ_GPIO11; irq <= IRQ_GPIO27; irq++) {
irq_set_chip_and_handler(irq, &sa1100_high_gpio_chip, irq_set_chip_and_handler(irq, &sa1100_high_gpio_chip,
handle_edge_irq); handle_edge_irq);
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);