Commit 60ed54ca authored by Thierry Reding's avatar Thierry Reding Committed by Linus Walleij

gpio: Disambiguate struct gpio_irq_chip.nested

The nested field in struct gpio_irq_chip currently has two meanings. On
one hand it marks an IRQ chip as being nested (as opposed to chained),
while on the other hand it also means that an IRQ chip uses nested
thread handlers.

However, nested IRQ chips can already be identified by the fact that
they don't pass a parent handler (the driver would instead already have
installed a nested handler using request_irq()).

Therefore, the only use for the nested attribute is to inform gpiolib
that an IRQ chip uses nested thread handlers (as opposed to regular,
non-threaded handlers). To clarify its purpose, rename the field to
"threaded".
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Acked-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 5b2b135a
...@@ -1603,6 +1603,11 @@ void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip, ...@@ -1603,6 +1603,11 @@ void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,
unsigned int parent_irq, unsigned int parent_irq,
irq_flow_handler_t parent_handler) irq_flow_handler_t parent_handler)
{ {
if (gpiochip->irq.threaded) {
chip_err(gpiochip, "tried to chain a threaded gpiochip\n");
return;
}
gpiochip_set_cascaded_irqchip(gpiochip, irqchip, parent_irq, gpiochip_set_cascaded_irqchip(gpiochip, irqchip, parent_irq,
parent_handler); parent_handler);
} }
...@@ -1619,10 +1624,6 @@ void gpiochip_set_nested_irqchip(struct gpio_chip *gpiochip, ...@@ -1619,10 +1624,6 @@ void gpiochip_set_nested_irqchip(struct gpio_chip *gpiochip,
struct irq_chip *irqchip, struct irq_chip *irqchip,
unsigned int parent_irq) unsigned int parent_irq)
{ {
if (!gpiochip->irq.nested) {
chip_err(gpiochip, "tried to nest a chained gpiochip\n");
return;
}
gpiochip_set_cascaded_irqchip(gpiochip, irqchip, parent_irq, gpiochip_set_cascaded_irqchip(gpiochip, irqchip, parent_irq,
NULL); NULL);
} }
...@@ -1655,7 +1656,7 @@ int gpiochip_irq_map(struct irq_domain *d, unsigned int irq, ...@@ -1655,7 +1656,7 @@ int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
irq_set_lockdep_class(irq, chip->irq.lock_key); irq_set_lockdep_class(irq, chip->irq.lock_key);
irq_set_chip_and_handler(irq, chip->irq.chip, 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.threaded)
irq_set_nested_thread(irq, 1); irq_set_nested_thread(irq, 1);
irq_set_noprobe(irq); irq_set_noprobe(irq);
...@@ -1682,7 +1683,7 @@ void gpiochip_irq_unmap(struct irq_domain *d, unsigned int irq) ...@@ -1682,7 +1683,7 @@ void gpiochip_irq_unmap(struct irq_domain *d, unsigned int irq)
{ {
struct gpio_chip *chip = d->host_data; struct gpio_chip *chip = d->host_data;
if (chip->irq.nested) if (chip->irq.threaded)
irq_set_nested_thread(irq, 0); irq_set_nested_thread(irq, 0);
irq_set_chip_and_handler(irq, NULL, NULL); irq_set_chip_and_handler(irq, NULL, NULL);
irq_set_chip_data(irq, NULL); irq_set_chip_data(irq, NULL);
...@@ -1804,10 +1805,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gpiochip) ...@@ -1804,10 +1805,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gpiochip)
gpiochip->irq.parent_handler, gpiochip->irq.parent_handler,
data); data);
} }
gpiochip->irq.nested = false;
} else {
gpiochip->irq.nested = true;
} }
acpi_gpiochip_request_interrupts(gpiochip); acpi_gpiochip_request_interrupts(gpiochip);
...@@ -1869,8 +1866,7 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip) ...@@ -1869,8 +1866,7 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip)
* @handler: the irq handler to use (often a predefined irq core function) * @handler: the irq handler to use (often a predefined irq core function)
* @type: the default type for IRQs on this irqchip, pass IRQ_TYPE_NONE * @type: the default type for IRQs on this irqchip, pass IRQ_TYPE_NONE
* to have the core avoid setting up any default type in the hardware. * to have the core avoid setting up any default type in the hardware.
* @nested: whether this is a nested irqchip calling handle_nested_irq() * @threaded: whether this irqchip uses a nested thread handler
* in its IRQ handler
* @lock_key: lockdep class * @lock_key: lockdep class
* *
* This function closely associates a certain irqchip with a certain * This function closely associates a certain irqchip with a certain
...@@ -1892,7 +1888,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip, ...@@ -1892,7 +1888,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
unsigned int first_irq, unsigned int first_irq,
irq_flow_handler_t handler, irq_flow_handler_t handler,
unsigned int type, unsigned int type,
bool nested, bool threaded,
struct lock_class_key *lock_key) struct lock_class_key *lock_key)
{ {
struct device_node *of_node; struct device_node *of_node;
...@@ -1904,7 +1900,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip, ...@@ -1904,7 +1900,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
pr_err("missing gpiochip .dev parent pointer\n"); pr_err("missing gpiochip .dev parent pointer\n");
return -EINVAL; return -EINVAL;
} }
gpiochip->irq.nested = nested; gpiochip->irq.threaded = threaded;
of_node = gpiochip->parent->of_node; of_node = gpiochip->parent->of_node;
#ifdef CONFIG_OF_GPIO #ifdef CONFIG_OF_GPIO
/* /*
......
...@@ -108,11 +108,11 @@ struct gpio_irq_chip { ...@@ -108,11 +108,11 @@ struct gpio_irq_chip {
unsigned int *map; unsigned int *map;
/** /**
* @nested: * @threaded:
* *
* True if set the interrupt handling is nested. * True if set the interrupt handling uses nested threads.
*/ */
bool nested; bool threaded;
/** /**
* @need_valid_mask: * @need_valid_mask:
...@@ -385,7 +385,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip, ...@@ -385,7 +385,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
unsigned int first_irq, unsigned int first_irq,
irq_flow_handler_t handler, irq_flow_handler_t handler,
unsigned int type, unsigned int type,
bool nested, bool threaded,
struct lock_class_key *lock_key); struct lock_class_key *lock_key);
#ifdef CONFIG_LOCKDEP #ifdef CONFIG_LOCKDEP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment