Commit a080ecb1 authored by Linus Walleij's avatar Linus Walleij Committed by Kalle Valo

bcma: gpio: Use irqchip template

This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit call to gpiochip_irqchip_add().

The irqchip is instead added while adding the gpiochip.

Cc: Rafał Miłecki <rafal@milecki.pl>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200722111725.210923-1-linus.walleij@linaro.org
parent 92d26d1a
...@@ -122,6 +122,7 @@ static irqreturn_t bcma_gpio_irq_handler(int irq, void *dev_id) ...@@ -122,6 +122,7 @@ static irqreturn_t bcma_gpio_irq_handler(int irq, void *dev_id)
static int bcma_gpio_irq_init(struct bcma_drv_cc *cc) static int bcma_gpio_irq_init(struct bcma_drv_cc *cc)
{ {
struct gpio_chip *chip = &cc->gpio; struct gpio_chip *chip = &cc->gpio;
struct gpio_irq_chip *girq = &chip->irq;
int hwirq, err; int hwirq, err;
if (cc->core->bus->hosttype != BCMA_HOSTTYPE_SOC) if (cc->core->bus->hosttype != BCMA_HOSTTYPE_SOC)
...@@ -136,15 +137,13 @@ static int bcma_gpio_irq_init(struct bcma_drv_cc *cc) ...@@ -136,15 +137,13 @@ static int bcma_gpio_irq_init(struct bcma_drv_cc *cc)
bcma_chipco_gpio_intmask(cc, ~0, 0); bcma_chipco_gpio_intmask(cc, ~0, 0);
bcma_cc_set32(cc, BCMA_CC_IRQMASK, BCMA_CC_IRQ_GPIO); bcma_cc_set32(cc, BCMA_CC_IRQMASK, BCMA_CC_IRQ_GPIO);
err = gpiochip_irqchip_add(chip, girq->chip = &bcma_gpio_irq_chip;
&bcma_gpio_irq_chip, /* This will let us handle the parent IRQ in the driver */
0, girq->parent_handler = NULL;
handle_simple_irq, girq->num_parents = 0;
IRQ_TYPE_NONE); girq->parents = NULL;
if (err) { girq->default_type = IRQ_TYPE_NONE;
free_irq(hwirq, cc); girq->handler = handle_simple_irq;
return err;
}
return 0; return 0;
} }
...@@ -212,13 +211,13 @@ int bcma_gpio_init(struct bcma_drv_cc *cc) ...@@ -212,13 +211,13 @@ int bcma_gpio_init(struct bcma_drv_cc *cc)
else else
chip->base = -1; chip->base = -1;
err = gpiochip_add_data(chip, cc); err = bcma_gpio_irq_init(cc);
if (err) if (err)
return err; return err;
err = bcma_gpio_irq_init(cc); err = gpiochip_add_data(chip, cc);
if (err) { if (err) {
gpiochip_remove(chip); bcma_gpio_irq_exit(cc);
return err; return err;
} }
......
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