summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2023-06-21 20:49:43 +0300
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2023-07-10 12:29:47 +0300
commiteec349dbe4fa2712d4933d674531778a93c50b28 (patch)
tree2a32454fa4861ae6899a454b309d16bc79d65e7f /drivers/gpio
parent081bfdb303abaf5c818de5a444dd899c7de3fab0 (diff)
downloadlinux-eec349dbe4fa2712d4933d674531778a93c50b28.tar.xz
gpiolib: Replace open coded gpiochip_irqchip_add_allocated_domain()
Replace open coded variant of gpiochip_irqchip_add_allocated_domain() in gpiochip_add_irqchip(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 0179902d3b74..62199ec96db2 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1645,6 +1645,9 @@ static int gpiochip_irqchip_add_allocated_domain(struct gpio_chip *gc,
if (!domain)
return -EINVAL;
+ if (gc->to_irq)
+ chip_warn(gc, "to_irq is redefined in %s and you shouldn't rely on it\n", __func__);
+
gc->to_irq = gpiochip_to_irq;
gc->irq.domain = domain;
gc->irq.domain_is_allocated_externally = allocated_externally;
@@ -1675,6 +1678,7 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
struct irq_domain *domain;
unsigned int type;
unsigned int i;
+ int ret;
if (!irqchip)
return 0;
@@ -1695,10 +1699,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
"%pfw: Ignoring %u default trigger\n", fwnode, type))
type = IRQ_TYPE_NONE;
- if (gc->to_irq)
- chip_warn(gc, "to_irq is redefined in %s and you shouldn't rely on it\n", __func__);
-
- gc->to_irq = gpiochip_to_irq;
gc->irq.default_type = type;
gc->irq.lock_key = lock_key;
gc->irq.request_key = request_key;
@@ -1711,7 +1711,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
}
if (IS_ERR(domain))
return PTR_ERR(domain);
- gc->irq.domain = domain;
if (gc->irq.parent_handler) {
for (i = 0; i < gc->irq.num_parents; i++) {
@@ -1735,14 +1734,9 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
gpiochip_set_irq_hooks(gc);
- /*
- * Using barrier() here to prevent compiler from reordering
- * gc->irq.initialized before initialization of above
- * GPIO chip irq members.
- */
- barrier();
-
- gc->irq.initialized = true;
+ ret = gpiochip_irqchip_add_allocated_domain(gc, domain, false);
+ if (ret)
+ return ret;
acpi_gpiochip_request_interrupts(gc);