* 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
Showing the changes to include (2 of 11 files). Show all
Unified · Split
| @@ -588,6 +588,22 @@ void gpiochip_relres_irq(struct gpio_chip *gc, unsigned int offset); · 587 unmodified lines | ||
| 588 | 588 | void gpiochip_disable_irq(struct gpio_chip *gc, unsigned int offset); |
| 589 | 589 | void gpiochip_enable_irq(struct gpio_chip *gc, unsigned int offset); |
| 590 | 590 | |
| 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 | + | |
| 591 | 607 | /* Line status inquiry for drivers */ |
| 592 | 608 | bool gpiochip_line_is_open_drain(struct gpio_chip *gc, unsigned int offset); |
| 593 | 609 | bool gpiochip_line_is_open_source(struct gpio_chip *gc, unsigned int offset); |
| @@ -569,6 +569,7 @@ struct irq_chip { · 568 unmodified lines | ||
| 569 | 569 | * IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND: Invokes __enable_irq()/__disable_irq() for wake irqs |
| 570 | 570 | * in the suspend path if they are in disabled state |
| 571 | 571 | * IRQCHIP_AFFINITY_PRE_STARTUP: Default affinity update before startup |
| 572 | + * IRQCHIP_IMMUTABLE: Don't ever change anything in this chip | |
| 572 | 573 | */ |
| 573 | 574 | enum { |
| 574 | 575 | IRQCHIP_SET_TYPE_MASKED = (1 << 0), |
| @@ -582,6 +583,7 @@ enum { · 7 unmodified lines | ||
| 582 | 583 | IRQCHIP_SUPPORTS_NMI = (1 << 8), |
| 583 | 584 | IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND = (1 << 9), |
| 584 | 585 | IRQCHIP_AFFINITY_PRE_STARTUP = (1 << 10), |
| 586 | + IRQCHIP_IMMUTABLE = (1 << 11), | |
| 585 | 587 | }; |
| 586 | 588 | |
| 587 | 589 | #include <linux/irqdesc.h> |