mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-16 13:34:30 +00:00
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>
This commit is contained in:
parent
c44eafd79b
commit
da80ff81a8
@ -1646,7 +1646,7 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
|
|||||||
* category than their parents, so it won't report false recursion.
|
* category than their parents, so it won't report false recursion.
|
||||||
*/
|
*/
|
||||||
irq_set_lockdep_class(irq, chip->lock_key);
|
irq_set_lockdep_class(irq, chip->lock_key);
|
||||||
irq_set_chip_and_handler(irq, chip->irqchip, chip->irq_handler);
|
irq_set_chip_and_handler(irq, chip->irq.chip, chip->irq_handler);
|
||||||
/* Chips that use nested thread handlers have them marked */
|
/* Chips that use nested thread handlers have them marked */
|
||||||
if (chip->irq_nested)
|
if (chip->irq_nested)
|
||||||
irq_set_nested_thread(irq, 1);
|
irq_set_nested_thread(irq, 1);
|
||||||
@ -1739,10 +1739,10 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip)
|
|||||||
irq_domain_remove(gpiochip->irqdomain);
|
irq_domain_remove(gpiochip->irqdomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpiochip->irqchip) {
|
if (gpiochip->irq.chip) {
|
||||||
gpiochip->irqchip->irq_request_resources = NULL;
|
gpiochip->irq.chip->irq_request_resources = NULL;
|
||||||
gpiochip->irqchip->irq_release_resources = NULL;
|
gpiochip->irq.chip->irq_release_resources = NULL;
|
||||||
gpiochip->irqchip = NULL;
|
gpiochip->irq.chip = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpiochip_irqchip_free_valid_mask(gpiochip);
|
gpiochip_irqchip_free_valid_mask(gpiochip);
|
||||||
@ -1817,7 +1817,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
|
|||||||
type = IRQ_TYPE_NONE;
|
type = IRQ_TYPE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpiochip->irqchip = irqchip;
|
gpiochip->irq.chip = irqchip;
|
||||||
gpiochip->irq_handler = handler;
|
gpiochip->irq_handler = handler;
|
||||||
gpiochip->irq_default_type = type;
|
gpiochip->irq_default_type = type;
|
||||||
gpiochip->to_irq = gpiochip_to_irq;
|
gpiochip->to_irq = gpiochip_to_irq;
|
||||||
@ -1826,7 +1826,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
|
|||||||
gpiochip->ngpio, first_irq,
|
gpiochip->ngpio, first_irq,
|
||||||
&gpiochip_domain_ops, gpiochip);
|
&gpiochip_domain_ops, gpiochip);
|
||||||
if (!gpiochip->irqdomain) {
|
if (!gpiochip->irqdomain) {
|
||||||
gpiochip->irqchip = NULL;
|
gpiochip->irq.chip = NULL;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,13 @@ struct module;
|
|||||||
* struct gpio_irq_chip - GPIO interrupt controller
|
* struct gpio_irq_chip - GPIO interrupt controller
|
||||||
*/
|
*/
|
||||||
struct gpio_irq_chip {
|
struct gpio_irq_chip {
|
||||||
|
/**
|
||||||
|
* @chip:
|
||||||
|
*
|
||||||
|
* GPIO IRQ chip implementation, provided by GPIO driver.
|
||||||
|
*/
|
||||||
|
struct irq_chip *chip;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @domain_ops:
|
* @domain_ops:
|
||||||
*
|
*
|
||||||
@ -47,6 +54,11 @@ struct gpio_irq_chip {
|
|||||||
*/
|
*/
|
||||||
void *parent_handler_data;
|
void *parent_handler_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip)
|
||||||
|
{
|
||||||
|
return container_of(chip, struct gpio_irq_chip, chip);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,7 +124,6 @@ struct gpio_irq_chip {
|
|||||||
* safely.
|
* safely.
|
||||||
* @bgpio_dir: shadowed direction register for generic GPIO to clear/set
|
* @bgpio_dir: shadowed direction register for generic GPIO to clear/set
|
||||||
* direction safely.
|
* direction safely.
|
||||||
* @irqchip: GPIO IRQ chip impl, provided by GPIO driver
|
|
||||||
* @irqdomain: Interrupt translation domain; responsible for mapping
|
* @irqdomain: Interrupt translation domain; responsible for mapping
|
||||||
* between GPIO hwirq number and linux irq number
|
* between GPIO hwirq number and linux irq number
|
||||||
* @irq_handler: the irq handler to use (often a predefined irq core function)
|
* @irq_handler: the irq handler to use (often a predefined irq core function)
|
||||||
@ -197,7 +208,6 @@ struct gpio_chip {
|
|||||||
* With CONFIG_GPIOLIB_IRQCHIP we get an irqchip inside the gpiolib
|
* With CONFIG_GPIOLIB_IRQCHIP we get an irqchip inside the gpiolib
|
||||||
* to handle IRQs for most practical cases.
|
* to handle IRQs for most practical cases.
|
||||||
*/
|
*/
|
||||||
struct irq_chip *irqchip;
|
|
||||||
struct irq_domain *irqdomain;
|
struct irq_domain *irqdomain;
|
||||||
irq_flow_handler_t irq_handler;
|
irq_flow_handler_t irq_handler;
|
||||||
unsigned int irq_default_type;
|
unsigned int irq_default_type;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user