Commit eec349db authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Bartosz Golaszewski

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent 081bfdb3
...@@ -1645,6 +1645,9 @@ static int gpiochip_irqchip_add_allocated_domain(struct gpio_chip *gc, ...@@ -1645,6 +1645,9 @@ static int gpiochip_irqchip_add_allocated_domain(struct gpio_chip *gc,
if (!domain) if (!domain)
return -EINVAL; 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->to_irq = gpiochip_to_irq;
gc->irq.domain = domain; gc->irq.domain = domain;
gc->irq.domain_is_allocated_externally = allocated_externally; gc->irq.domain_is_allocated_externally = allocated_externally;
...@@ -1675,6 +1678,7 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc, ...@@ -1675,6 +1678,7 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
struct irq_domain *domain; struct irq_domain *domain;
unsigned int type; unsigned int type;
unsigned int i; unsigned int i;
int ret;
if (!irqchip) if (!irqchip)
return 0; return 0;
...@@ -1695,10 +1699,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc, ...@@ -1695,10 +1699,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
"%pfw: Ignoring %u default trigger\n", fwnode, type)) "%pfw: Ignoring %u default trigger\n", fwnode, type))
type = IRQ_TYPE_NONE; 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.default_type = type;
gc->irq.lock_key = lock_key; gc->irq.lock_key = lock_key;
gc->irq.request_key = request_key; gc->irq.request_key = request_key;
...@@ -1711,7 +1711,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc, ...@@ -1711,7 +1711,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
} }
if (IS_ERR(domain)) if (IS_ERR(domain))
return PTR_ERR(domain); return PTR_ERR(domain);
gc->irq.domain = domain;
if (gc->irq.parent_handler) { if (gc->irq.parent_handler) {
for (i = 0; i < gc->irq.num_parents; i++) { for (i = 0; i < gc->irq.num_parents; i++) {
...@@ -1735,14 +1734,9 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc, ...@@ -1735,14 +1734,9 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
gpiochip_set_irq_hooks(gc); gpiochip_set_irq_hooks(gc);
/* ret = gpiochip_irqchip_add_allocated_domain(gc, domain, false);
* Using barrier() here to prevent compiler from reordering if (ret)
* gc->irq.initialized before initialization of above return ret;
* GPIO chip irq members.
*/
barrier();
gc->irq.initialized = true;
acpi_gpiochip_request_interrupts(gc); acpi_gpiochip_request_interrupts(gc);
......
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