|
@@ -2685,6 +2685,15 @@ int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset)
|
|
|
}
|
|
|
|
|
|
set_bit(FLAG_USED_AS_IRQ, &desc->flags);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * If the consumer has not set up a label (such as when the
|
|
|
+ * IRQ is referenced from .to_irq()) we set up a label here
|
|
|
+ * so it is clear this is used as an interrupt.
|
|
|
+ */
|
|
|
+ if (!desc->label)
|
|
|
+ desc_set_label(desc, "interrupt");
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(gpiochip_lock_as_irq);
|
|
@@ -2699,10 +2708,17 @@ EXPORT_SYMBOL_GPL(gpiochip_lock_as_irq);
|
|
|
*/
|
|
|
void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset)
|
|
|
{
|
|
|
- if (offset >= chip->ngpio)
|
|
|
+ struct gpio_desc *desc;
|
|
|
+
|
|
|
+ desc = gpiochip_get_desc(chip, offset);
|
|
|
+ if (IS_ERR(desc))
|
|
|
return;
|
|
|
|
|
|
- clear_bit(FLAG_USED_AS_IRQ, &chip->gpiodev->descs[offset].flags);
|
|
|
+ clear_bit(FLAG_USED_AS_IRQ, &desc->flags);
|
|
|
+
|
|
|
+ /* If we only had this marking, erase it */
|
|
|
+ if (desc->label && !strcmp(desc->label, "interrupt"))
|
|
|
+ desc_set_label(desc, NULL);
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(gpiochip_unlock_as_irq);
|
|
|
|