|
@@ -323,13 +323,6 @@ static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type)
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
|
- ret = gpiochip_lock_as_irq(&tgi->gc, gpio);
|
|
|
- if (ret) {
|
|
|
- dev_err(tgi->dev,
|
|
|
- "unable to lock Tegra GPIO %u as IRQ\n", gpio);
|
|
|
- return ret;
|
|
|
- }
|
|
|
-
|
|
|
spin_lock_irqsave(&bank->lvl_lock[port], flags);
|
|
|
|
|
|
val = tegra_gpio_readl(tgi, GPIO_INT_LVL(tgi, gpio));
|
|
@@ -342,6 +335,14 @@ static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type)
|
|
|
tegra_gpio_mask_write(tgi, GPIO_MSK_OE(tgi, gpio), gpio, 0);
|
|
|
tegra_gpio_enable(tgi, gpio);
|
|
|
|
|
|
+ ret = gpiochip_lock_as_irq(&tgi->gc, gpio);
|
|
|
+ if (ret) {
|
|
|
+ dev_err(tgi->dev,
|
|
|
+ "unable to lock Tegra GPIO %u as IRQ\n", gpio);
|
|
|
+ tegra_gpio_disable(tgi, gpio);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
|
|
|
irq_set_handler_locked(d, handle_level_irq);
|
|
|
else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
|