Skip to content

Commit

Permalink
gpio: davinci: fix check for unbanked gpio
Browse files Browse the repository at this point in the history
This patch fixes a check for offset in gpio_to_irq_unbanked()
and also assigns gpio_irq, gpio_unbanked of chips[0] to
appropriate values which is used in gpio_to_irq_unbanked()
function.

Without this patch, unbanked IRQ handling is broken.

Reported-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
  • Loading branch information
Lad, Prabhakar authored and Sekhar Nori committed Nov 21, 2013
1 parent 527d151 commit 34af1ab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpio/gpio-davinci.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset)
* NOTE: we assume for now that only irqs in the first gpio_chip
* can provide direct-mapped IRQs to AINTC (up to 32 GPIOs).
*/
if (offset < d->irq_base)
if (offset < d->gpio_unbanked)
return d->gpio_irq + offset;
else
return -ENODEV;
Expand Down Expand Up @@ -419,6 +419,8 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)

/* pass "bank 0" GPIO IRQs to AINTC */
chips[0].chip.to_irq = gpio_to_irq_unbanked;
chips[0].gpio_irq = bank_irq;
chips[0].gpio_unbanked = pdata->gpio_unbanked;
binten = BIT(0);

/* AINTC handles mask/unmask; GPIO handles triggering */
Expand Down

0 comments on commit 34af1ab

Please sign in to comment.