History

Merge branch irq/gpio-immutable into irq/irqchip-next

* irq/gpio-immutable: : . : First try at preventing the GPIO subsystem from abusing irq_chip : data structures. The general idea is to have an irq_chip flag : to tell the GPIO subsystem that these structures are immutable, : and to convert drivers one by one. : . Documentation: Update the recommended pattern for GPIO irqchips gpio: Update TODO to mention immutable irq_chip structures pinctrl: amd: Make the irqchip immutable pinctrl: msmgpio: Make the irqchip immutable pinctrl: apple-gpio: Make the irqchip immutable gpio: pl061: Make the irqchip immutable gpio: tegra186: Make the irqchip immutable gpio: Add helpers to ease the transition towards immutable irq_chip gpio: Expose the gpiochip_irq_re[ql]res helpers gpio: Don't fiddle with irqchips marked as immutable

Marc Zyngier committed 4 years ago

Commit 4bde53a2 parents b2d229d 5644b6611 files · +293 −90Browse files

Showing the changes to include (2 of 11 files). Show all

Unified · Split

2 files
  1. include/linux/gpio/driver.h +16 −0
  2. include/linux/irq.h +2 −0
include/linux/gpio/driver.h+16−0
@@ -588,6 +588,22 @@ void gpiochip_relres_irq(struct gpio_chip *gc, unsigned int offset); · 587 unmodified lines
588588 void gpiochip_disable_irq(struct gpio_chip *gc, unsigned int offset);
589589 void gpiochip_enable_irq(struct gpio_chip *gc, unsigned int offset);
590590
591+/* irq_data versions of the above */
592+int gpiochip_irq_reqres(struct irq_data *data);
593+void gpiochip_irq_relres(struct irq_data *data);
594+
595+/* Paste this in your irq_chip structure */
596+#define GPIOCHIP_IRQ_RESOURCE_HELPERS \
597+ .irq_request_resources = gpiochip_irq_reqres, \
598+ .irq_release_resources = gpiochip_irq_relres
599+
600+static inline void gpio_irq_chip_set_chip(struct gpio_irq_chip *girq,
601+ const struct irq_chip *chip)
602+{
603+ /* Yes, dropping const is ugly, but it isn't like we have a choice */
604+ girq->chip = (struct irq_chip *)chip;
605+}
606+
591607 /* Line status inquiry for drivers */
592608 bool gpiochip_line_is_open_drain(struct gpio_chip *gc, unsigned int offset);
593609 bool gpiochip_line_is_open_source(struct gpio_chip *gc, unsigned int offset);
include/linux/irq.h+2−0
@@ -569,6 +569,7 @@ struct irq_chip { · 568 unmodified lines
569569 * IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND: Invokes __enable_irq()/__disable_irq() for wake irqs
570570 * in the suspend path if they are in disabled state
571571 * IRQCHIP_AFFINITY_PRE_STARTUP: Default affinity update before startup
572+ * IRQCHIP_IMMUTABLE: Don't ever change anything in this chip
572573 */
573574 enum {
574575 IRQCHIP_SET_TYPE_MASKED = (1 << 0),
@@ -582,6 +583,7 @@ enum { · 7 unmodified lines
582583 IRQCHIP_SUPPORTS_NMI = (1 << 8),
583584 IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND = (1 << 9),
584585 IRQCHIP_AFFINITY_PRE_STARTUP = (1 << 10),
586+ IRQCHIP_IMMUTABLE = (1 << 11),
585587 };
586588
587589 #include <linux/irqdesc.h>