aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-omap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio/gpio-omap.c')
-rw-r--r--drivers/gpio/gpio-omap.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 89675f862308..f319c9ffd4a8 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -514,6 +514,14 @@ static int gpio_irq_type(struct irq_data *d, unsigned type)
514 return -EINVAL; 514 return -EINVAL;
515 } 515 }
516 516
517 retval = gpio_lock_as_irq(&bank->chip, offset);
518 if (retval) {
519 dev_err(bank->dev, "unable to lock offset %d for IRQ\n",
520 offset);
521 spin_unlock_irqrestore(&bank->lock, flags);
522 return retval;
523 }
524
517 bank->irq_usage |= 1 << GPIO_INDEX(bank, gpio); 525 bank->irq_usage |= 1 << GPIO_INDEX(bank, gpio);
518 spin_unlock_irqrestore(&bank->lock, flags); 526 spin_unlock_irqrestore(&bank->lock, flags);
519 527
@@ -797,6 +805,7 @@ static void gpio_irq_shutdown(struct irq_data *d)
797 unsigned offset = GPIO_INDEX(bank, gpio); 805 unsigned offset = GPIO_INDEX(bank, gpio);
798 806
799 spin_lock_irqsave(&bank->lock, flags); 807 spin_lock_irqsave(&bank->lock, flags);
808 gpio_unlock_as_irq(&bank->chip, offset);
800 bank->irq_usage &= ~(1 << offset); 809 bank->irq_usage &= ~(1 << offset);
801 _disable_gpio_module(bank, offset); 810 _disable_gpio_module(bank, offset);
802 _reset_gpio(bank, gpio); 811 _reset_gpio(bank, gpio);
@@ -957,22 +966,13 @@ static int gpio_output(struct gpio_chip *chip, unsigned offset, int value)
957{ 966{
958 struct gpio_bank *bank; 967 struct gpio_bank *bank;
959 unsigned long flags; 968 unsigned long flags;
960 int retval = 0;
961 969
962 bank = container_of(chip, struct gpio_bank, chip); 970 bank = container_of(chip, struct gpio_bank, chip);
963 spin_lock_irqsave(&bank->lock, flags); 971 spin_lock_irqsave(&bank->lock, flags);
964
965 if (LINE_USED(bank->irq_usage, offset)) {
966 retval = -EINVAL;
967 goto exit;
968 }
969
970 bank->set_dataout(bank, offset, value); 972 bank->set_dataout(bank, offset, value);
971 _set_gpio_direction(bank, offset, 0); 973 _set_gpio_direction(bank, offset, 0);
972
973exit:
974 spin_unlock_irqrestore(&bank->lock, flags); 974 spin_unlock_irqrestore(&bank->lock, flags);
975 return retval; 975 return 0;
976} 976}
977 977
978static int gpio_debounce(struct gpio_chip *chip, unsigned offset, 978static int gpio_debounce(struct gpio_chip *chip, unsigned offset,