aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2017-11-07 13:15:57 -0500
committerLinus Walleij <linus.walleij@linaro.org>2017-11-08 08:16:06 -0500
commit60ed54cae8dc0f2d41cafbd477bbed6deb716615 (patch)
treebed33fde16dc09d122c7ad1a409199cf921fc2f6 /drivers/gpio/gpiolib.c
parent5b2b135a87fcfb2b27c3c192fd7c3b053f0c5fa2 (diff)
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: Thierry Reding <treding@nvidia.com> Acked-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 7347ea1c699a..389257f97e45 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1603,6 +1603,11 @@ void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,
1603 unsigned int parent_irq, 1603 unsigned int parent_irq,
1604 irq_flow_handler_t parent_handler) 1604 irq_flow_handler_t parent_handler)
1605{ 1605{
1606 if (gpiochip->irq.threaded) {
1607 chip_err(gpiochip, "tried to chain a threaded gpiochip\n");
1608 return;
1609 }
1610
1606 gpiochip_set_cascaded_irqchip(gpiochip, irqchip, parent_irq, 1611 gpiochip_set_cascaded_irqchip(gpiochip, irqchip, parent_irq,
1607 parent_handler); 1612 parent_handler);
1608} 1613}
@@ -1619,10 +1624,6 @@ void gpiochip_set_nested_irqchip(struct gpio_chip *gpiochip,
1619 struct irq_chip *irqchip, 1624 struct irq_chip *irqchip,
1620 unsigned int parent_irq) 1625 unsigned int parent_irq)
1621{ 1626{
1622 if (!gpiochip->irq.nested) {
1623 chip_err(gpiochip, "tried to nest a chained gpiochip\n");
1624 return;
1625 }
1626 gpiochip_set_cascaded_irqchip(gpiochip, irqchip, parent_irq, 1627 gpiochip_set_cascaded_irqchip(gpiochip, irqchip, parent_irq,
1627 NULL); 1628 NULL);
1628} 1629}
@@ -1655,7 +1656,7 @@ int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
1655 irq_set_lockdep_class(irq, chip->irq.lock_key); 1656 irq_set_lockdep_class(irq, chip->irq.lock_key);
1656 irq_set_chip_and_handler(irq, chip->irq.chip, chip->irq.handler); 1657 irq_set_chip_and_handler(irq, chip->irq.chip, chip->irq.handler);
1657 /* Chips that use nested thread handlers have them marked */ 1658 /* Chips that use nested thread handlers have them marked */
1658 if (chip->irq.nested) 1659 if (chip->irq.threaded)
1659 irq_set_nested_thread(irq, 1); 1660 irq_set_nested_thread(irq, 1);
1660 irq_set_noprobe(irq); 1661 irq_set_noprobe(irq);
1661 1662
@@ -1682,7 +1683,7 @@ void gpiochip_irq_unmap(struct irq_domain *d, unsigned int irq)
1682{ 1683{
1683 struct gpio_chip *chip = d->host_data; 1684 struct gpio_chip *chip = d->host_data;
1684 1685
1685 if (chip->irq.nested) 1686 if (chip->irq.threaded)
1686 irq_set_nested_thread(irq, 0); 1687 irq_set_nested_thread(irq, 0);
1687 irq_set_chip_and_handler(irq, NULL, NULL); 1688 irq_set_chip_and_handler(irq, NULL, NULL);
1688 irq_set_chip_data(irq, NULL); 1689 irq_set_chip_data(irq, NULL);
@@ -1804,10 +1805,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gpiochip)
1804 gpiochip->irq.parent_handler, 1805 gpiochip->irq.parent_handler,
1805 data); 1806 data);
1806 } 1807 }
1807
1808 gpiochip->irq.nested = false;
1809 } else {
1810 gpiochip->irq.nested = true;
1811 } 1808 }
1812 1809
1813 acpi_gpiochip_request_interrupts(gpiochip); 1810 acpi_gpiochip_request_interrupts(gpiochip);
@@ -1869,8 +1866,7 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip)
1869 * @handler: the irq handler to use (often a predefined irq core function) 1866 * @handler: the irq handler to use (often a predefined irq core function)
1870 * @type: the default type for IRQs on this irqchip, pass IRQ_TYPE_NONE 1867 * @type: the default type for IRQs on this irqchip, pass IRQ_TYPE_NONE
1871 * to have the core avoid setting up any default type in the hardware. 1868 * to have the core avoid setting up any default type in the hardware.
1872 * @nested: whether this is a nested irqchip calling handle_nested_irq() 1869 * @threaded: whether this irqchip uses a nested thread handler
1873 * in its IRQ handler
1874 * @lock_key: lockdep class 1870 * @lock_key: lockdep class
1875 * 1871 *
1876 * This function closely associates a certain irqchip with a certain 1872 * This function closely associates a certain irqchip with a certain
@@ -1892,7 +1888,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
1892 unsigned int first_irq, 1888 unsigned int first_irq,
1893 irq_flow_handler_t handler, 1889 irq_flow_handler_t handler,
1894 unsigned int type, 1890 unsigned int type,
1895 bool nested, 1891 bool threaded,
1896 struct lock_class_key *lock_key) 1892 struct lock_class_key *lock_key)
1897{ 1893{
1898 struct device_node *of_node; 1894 struct device_node *of_node;
@@ -1904,7 +1900,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
1904 pr_err("missing gpiochip .dev parent pointer\n"); 1900 pr_err("missing gpiochip .dev parent pointer\n");
1905 return -EINVAL; 1901 return -EINVAL;
1906 } 1902 }
1907 gpiochip->irq.nested = nested; 1903 gpiochip->irq.threaded = threaded;
1908 of_node = gpiochip->parent->of_node; 1904 of_node = gpiochip->parent->of_node;
1909#ifdef CONFIG_OF_GPIO 1905#ifdef CONFIG_OF_GPIO
1910 /* 1906 /*