diff options
author | Thierry Reding <treding@nvidia.com> | 2017-11-07 13:15:46 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-11-08 07:59:24 -0500 |
commit | da80ff81a8f54611b834d73149f8ac0d59151c87 (patch) | |
tree | 2c902035b3cf4945a17715440691fcaf6faacdb6 | |
parent | c44eafd79be666e7c81d22e215c945b27f2785f7 (diff) |
gpio: Move irqchip into struct gpio_irq_chip
In order to consolidate the multiple ways to associate an IRQ chip with
a GPIO chip, move more fields into the new struct gpio_irq_chip.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/gpio/gpiolib.c | 14 | ||||
-rw-r--r-- | include/linux/gpio/driver.h | 14 |
2 files changed, 19 insertions, 9 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 3827f0767101..d3d0b3134ba3 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -1646,7 +1646,7 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq, | |||
1646 | * category than their parents, so it won't report false recursion. | 1646 | * category than their parents, so it won't report false recursion. |
1647 | */ | 1647 | */ |
1648 | irq_set_lockdep_class(irq, chip->lock_key); | 1648 | irq_set_lockdep_class(irq, chip->lock_key); |
1649 | irq_set_chip_and_handler(irq, chip->irqchip, chip->irq_handler); | 1649 | irq_set_chip_and_handler(irq, chip->irq.chip, chip->irq_handler); |
1650 | /* Chips that use nested thread handlers have them marked */ | 1650 | /* Chips that use nested thread handlers have them marked */ |
1651 | if (chip->irq_nested) | 1651 | if (chip->irq_nested) |
1652 | irq_set_nested_thread(irq, 1); | 1652 | irq_set_nested_thread(irq, 1); |
@@ -1739,10 +1739,10 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip) | |||
1739 | irq_domain_remove(gpiochip->irqdomain); | 1739 | irq_domain_remove(gpiochip->irqdomain); |
1740 | } | 1740 | } |
1741 | 1741 | ||
1742 | if (gpiochip->irqchip) { | 1742 | if (gpiochip->irq.chip) { |
1743 | gpiochip->irqchip->irq_request_resources = NULL; | 1743 | gpiochip->irq.chip->irq_request_resources = NULL; |
1744 | gpiochip->irqchip->irq_release_resources = NULL; | 1744 | gpiochip->irq.chip->irq_release_resources = NULL; |
1745 | gpiochip->irqchip = NULL; | 1745 | gpiochip->irq.chip = NULL; |
1746 | } | 1746 | } |
1747 | 1747 | ||
1748 | gpiochip_irqchip_free_valid_mask(gpiochip); | 1748 | gpiochip_irqchip_free_valid_mask(gpiochip); |
@@ -1817,7 +1817,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip, | |||
1817 | type = IRQ_TYPE_NONE; | 1817 | type = IRQ_TYPE_NONE; |
1818 | } | 1818 | } |
1819 | 1819 | ||
1820 | gpiochip->irqchip = irqchip; | 1820 | gpiochip->irq.chip = irqchip; |
1821 | gpiochip->irq_handler = handler; | 1821 | gpiochip->irq_handler = handler; |
1822 | gpiochip->irq_default_type = type; | 1822 | gpiochip->irq_default_type = type; |
1823 | gpiochip->to_irq = gpiochip_to_irq; | 1823 | gpiochip->to_irq = gpiochip_to_irq; |
@@ -1826,7 +1826,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip, | |||
1826 | gpiochip->ngpio, first_irq, | 1826 | gpiochip->ngpio, first_irq, |
1827 | &gpiochip_domain_ops, gpiochip); | 1827 | &gpiochip_domain_ops, gpiochip); |
1828 | if (!gpiochip->irqdomain) { | 1828 | if (!gpiochip->irqdomain) { |
1829 | gpiochip->irqchip = NULL; | 1829 | gpiochip->irq.chip = NULL; |
1830 | return -EINVAL; | 1830 | return -EINVAL; |
1831 | } | 1831 | } |
1832 | 1832 | ||
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index 36a065521fa0..a79b3b18fadd 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h | |||
@@ -25,6 +25,13 @@ struct module; | |||
25 | */ | 25 | */ |
26 | struct gpio_irq_chip { | 26 | struct gpio_irq_chip { |
27 | /** | 27 | /** |
28 | * @chip: | ||
29 | * | ||
30 | * GPIO IRQ chip implementation, provided by GPIO driver. | ||
31 | */ | ||
32 | struct irq_chip *chip; | ||
33 | |||
34 | /** | ||
28 | * @domain_ops: | 35 | * @domain_ops: |
29 | * | 36 | * |
30 | * Table of interrupt domain operations for this IRQ chip. | 37 | * Table of interrupt domain operations for this IRQ chip. |
@@ -47,6 +54,11 @@ struct gpio_irq_chip { | |||
47 | */ | 54 | */ |
48 | void *parent_handler_data; | 55 | void *parent_handler_data; |
49 | }; | 56 | }; |
57 | |||
58 | static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip) | ||
59 | { | ||
60 | return container_of(chip, struct gpio_irq_chip, chip); | ||
61 | } | ||
50 | #endif | 62 | #endif |
51 | 63 | ||
52 | /** | 64 | /** |
@@ -112,7 +124,6 @@ struct gpio_irq_chip { | |||
112 | * safely. | 124 | * safely. |
113 | * @bgpio_dir: shadowed direction register for generic GPIO to clear/set | 125 | * @bgpio_dir: shadowed direction register for generic GPIO to clear/set |
114 | * direction safely. | 126 | * direction safely. |
115 | * @irqchip: GPIO IRQ chip impl, provided by GPIO driver | ||
116 | * @irqdomain: Interrupt translation domain; responsible for mapping | 127 | * @irqdomain: Interrupt translation domain; responsible for mapping |
117 | * between GPIO hwirq number and linux irq number | 128 | * between GPIO hwirq number and linux irq number |
118 | * @irq_handler: the irq handler to use (often a predefined irq core function) | 129 | * @irq_handler: the irq handler to use (often a predefined irq core function) |
@@ -197,7 +208,6 @@ struct gpio_chip { | |||
197 | * With CONFIG_GPIOLIB_IRQCHIP we get an irqchip inside the gpiolib | 208 | * With CONFIG_GPIOLIB_IRQCHIP we get an irqchip inside the gpiolib |
198 | * to handle IRQs for most practical cases. | 209 | * to handle IRQs for most practical cases. |
199 | */ | 210 | */ |
200 | struct irq_chip *irqchip; | ||
201 | struct irq_domain *irqdomain; | 211 | struct irq_domain *irqdomain; |
202 | irq_flow_handler_t irq_handler; | 212 | irq_flow_handler_t irq_handler; |
203 | unsigned int irq_default_type; | 213 | unsigned int irq_default_type; |