diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2013-11-19 08:14:50 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-12-04 08:46:35 -0500 |
commit | db6b3ad1772e0e0e82c52d6337378e79da2effad (patch) | |
tree | d0b9830f72d53f016cbbed0eb258f5bfddab15a1 /drivers/gpio/gpio-bcm-kona.c | |
parent | f41cd3c2876bd31e7c71908548ae3c7a5b7ff649 (diff) |
gpio: bcm-kona: lock IRQs when starting them
This uses the new API for tagging GPIO lines as in use by
IRQs. This enforces a few semantic checks on how the underlying
GPIO line is used.
Cc: Christian Daudt <csd@broadcom.com>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Reviewed-by: Markus Mayer <markus.mayer@linaro.org>
Tested-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Javier Martinez Canillas <javier@dowhile0.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-bcm-kona.c')
-rw-r--r-- | drivers/gpio/gpio-bcm-kona.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c index 72c927dc3be1..3437414eaef2 100644 --- a/drivers/gpio/gpio-bcm-kona.c +++ b/drivers/gpio/gpio-bcm-kona.c | |||
@@ -449,12 +449,34 @@ static void bcm_kona_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
449 | chained_irq_exit(chip, desc); | 449 | chained_irq_exit(chip, desc); |
450 | } | 450 | } |
451 | 451 | ||
452 | static unsigned int bcm_kona_gpio_irq_startup(struct irq_data *d) | ||
453 | { | ||
454 | struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d); | ||
455 | |||
456 | if (gpio_lock_as_irq(&kona_gpio->gpio_chip, d->hwirq)) | ||
457 | dev_err(kona_gpio->gpio_chip.dev, | ||
458 | "unable to lock HW IRQ %lu for IRQ\n", | ||
459 | d->hwirq); | ||
460 | bcm_kona_gpio_irq_unmask(d); | ||
461 | return 0; | ||
462 | } | ||
463 | |||
464 | static void bcm_kona_gpio_irq_shutdown(struct irq_data *d) | ||
465 | { | ||
466 | struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d); | ||
467 | |||
468 | bcm_kona_gpio_irq_mask(d); | ||
469 | gpio_unlock_as_irq(&kona_gpio->gpio_chip, d->hwirq); | ||
470 | } | ||
471 | |||
452 | static struct irq_chip bcm_gpio_irq_chip = { | 472 | static struct irq_chip bcm_gpio_irq_chip = { |
453 | .name = "bcm-kona-gpio", | 473 | .name = "bcm-kona-gpio", |
454 | .irq_ack = bcm_kona_gpio_irq_ack, | 474 | .irq_ack = bcm_kona_gpio_irq_ack, |
455 | .irq_mask = bcm_kona_gpio_irq_mask, | 475 | .irq_mask = bcm_kona_gpio_irq_mask, |
456 | .irq_unmask = bcm_kona_gpio_irq_unmask, | 476 | .irq_unmask = bcm_kona_gpio_irq_unmask, |
457 | .irq_set_type = bcm_kona_gpio_irq_set_type, | 477 | .irq_set_type = bcm_kona_gpio_irq_set_type, |
478 | .irq_startup = bcm_kona_gpio_irq_startup, | ||
479 | .irq_shutdown = bcm_kona_gpio_irq_shutdown, | ||
458 | }; | 480 | }; |
459 | 481 | ||
460 | static struct __initconst of_device_id bcm_kona_gpio_of_match[] = { | 482 | static struct __initconst of_device_id bcm_kona_gpio_of_match[] = { |