diff options
author | Sekhar Nori <nsekhar@ti.com> | 2012-03-11 08:46:12 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2012-03-12 13:53:33 -0400 |
commit | 81b279d80a63628e580c71a31d30a8c3b3047ad4 (patch) | |
tree | d0695169d5445ce6f7bcd50e558b196dd47f2a1e /drivers/gpio/gpio-davinci.c | |
parent | ab2dde9924dd1ddb791fa8b14aa52e1df681e20c (diff) |
gpio/davinci: fix enabling unbanked GPIO IRQs
Unbanked GPIO IRQ handling code made a copy of just
the irq_chip structure for GPIO IRQ lines which caused
problems after the generic IRQ chip conversion because
there was no valid irq_chip_type structure with the
right "regs" populated. irq_gc_mask_set_bit() was
therefore accessing random addresses.
Fix it by making a copy of irq_chip_type structure
instead. This will ensure sane register offsets.
Cc: <stable@vger.kernel.org> # v3.0.x+
Reported-by: Jon Povey <Jon.Povey@racelogic.co.uk>
Tested-by: Jon Povey <Jon.Povey@racelogic.co.uk>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/gpio/gpio-davinci.c')
-rw-r--r-- | drivers/gpio/gpio-davinci.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c index a6777e5e0ced..3d000169285d 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c | |||
@@ -386,7 +386,7 @@ static int __init davinci_gpio_irq_setup(void) | |||
386 | * IRQ mux conflicts; gpio_irq_type_unbanked() is only for GPIOs. | 386 | * IRQ mux conflicts; gpio_irq_type_unbanked() is only for GPIOs. |
387 | */ | 387 | */ |
388 | if (soc_info->gpio_unbanked) { | 388 | if (soc_info->gpio_unbanked) { |
389 | static struct irq_chip gpio_irqchip_unbanked; | 389 | static struct irq_chip_type gpio_unbanked; |
390 | 390 | ||
391 | /* pass "bank 0" GPIO IRQs to AINTC */ | 391 | /* pass "bank 0" GPIO IRQs to AINTC */ |
392 | chips[0].chip.to_irq = gpio_to_irq_unbanked; | 392 | chips[0].chip.to_irq = gpio_to_irq_unbanked; |
@@ -394,9 +394,10 @@ static int __init davinci_gpio_irq_setup(void) | |||
394 | 394 | ||
395 | /* AINTC handles mask/unmask; GPIO handles triggering */ | 395 | /* AINTC handles mask/unmask; GPIO handles triggering */ |
396 | irq = bank_irq; | 396 | irq = bank_irq; |
397 | gpio_irqchip_unbanked = *irq_get_chip(irq); | 397 | gpio_unbanked = *container_of(irq_get_chip(irq), |
398 | gpio_irqchip_unbanked.name = "GPIO-AINTC"; | 398 | struct irq_chip_type, chip); |
399 | gpio_irqchip_unbanked.irq_set_type = gpio_irq_type_unbanked; | 399 | gpio_unbanked.chip.name = "GPIO-AINTC"; |
400 | gpio_unbanked.chip.irq_set_type = gpio_irq_type_unbanked; | ||
400 | 401 | ||
401 | /* default trigger: both edges */ | 402 | /* default trigger: both edges */ |
402 | g = gpio2regs(0); | 403 | g = gpio2regs(0); |
@@ -405,7 +406,7 @@ static int __init davinci_gpio_irq_setup(void) | |||
405 | 406 | ||
406 | /* set the direct IRQs up to use that irqchip */ | 407 | /* set the direct IRQs up to use that irqchip */ |
407 | for (gpio = 0; gpio < soc_info->gpio_unbanked; gpio++, irq++) { | 408 | for (gpio = 0; gpio < soc_info->gpio_unbanked; gpio++, irq++) { |
408 | irq_set_chip(irq, &gpio_irqchip_unbanked); | 409 | irq_set_chip(irq, &gpio_unbanked.chip); |
409 | irq_set_handler_data(irq, &chips[gpio / 32]); | 410 | irq_set_handler_data(irq, &chips[gpio / 32]); |
410 | irq_set_status_flags(irq, IRQ_TYPE_EDGE_BOTH); | 411 | irq_set_status_flags(irq, IRQ_TYPE_EDGE_BOTH); |
411 | } | 412 | } |