Commit bb58a47a authored by Linus Walleij's avatar Linus Walleij

gpio: max732x: Use irqchip template

This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit calls to gpiochip_irqchip_add_nested() and
gpiochip_set_nested_irqchip(). The irqchip is instead
added while adding the gpiochip.
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Tested-by: default avatarSam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: default avatarSam Protsenko <semen.protsenko@linaro.org>
Cc: Sam Protsenko <semen.protsenko@linaro.org>
Link: https://lore.kernel.org/r/20200726221259.133536-1-linus.walleij@linaro.org
parent beb3fb41
...@@ -503,6 +503,8 @@ static int max732x_irq_setup(struct max732x_chip *chip, ...@@ -503,6 +503,8 @@ static int max732x_irq_setup(struct max732x_chip *chip,
if (((pdata && pdata->irq_base) || client->irq) if (((pdata && pdata->irq_base) || client->irq)
&& has_irq != INT_NONE) { && has_irq != INT_NONE) {
struct gpio_irq_chip *girq;
if (pdata) if (pdata)
irq_base = pdata->irq_base; irq_base = pdata->irq_base;
chip->irq_features = has_irq; chip->irq_features = has_irq;
...@@ -517,19 +519,17 @@ static int max732x_irq_setup(struct max732x_chip *chip, ...@@ -517,19 +519,17 @@ static int max732x_irq_setup(struct max732x_chip *chip,
client->irq); client->irq);
return ret; return ret;
} }
ret = gpiochip_irqchip_add_nested(&chip->gpio_chip,
&max732x_irq_chip, girq = &chip->gpio_chip.irq;
irq_base, girq->chip = &max732x_irq_chip;
handle_simple_irq, /* This will let us handle the parent IRQ in the driver */
IRQ_TYPE_NONE); girq->parent_handler = NULL;
if (ret) { girq->num_parents = 0;
dev_err(&client->dev, girq->parents = NULL;
"could not connect irqchip to gpiochip\n"); girq->default_type = IRQ_TYPE_NONE;
return ret; girq->handler = handle_simple_irq;
} girq->threaded = true;
gpiochip_set_nested_irqchip(&chip->gpio_chip, girq->first = irq_base; /* FIXME: get rid of this */
&max732x_irq_chip,
client->irq);
} }
return 0; return 0;
...@@ -695,11 +695,11 @@ static int max732x_probe(struct i2c_client *client, ...@@ -695,11 +695,11 @@ static int max732x_probe(struct i2c_client *client,
return ret; return ret;
} }
ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip); ret = max732x_irq_setup(chip, id);
if (ret) if (ret)
return ret; return ret;
ret = max732x_irq_setup(chip, id); ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip);
if (ret) if (ret)
return ret; return ret;
......
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