Skip to content

Commit a080ecb

Browse files
linuswKalle Valo
authored andcommitted
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 <[email protected]> Cc: Florian Fainelli <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 92d26d1 commit a080ecb

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

drivers/bcma/driver_gpio.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ static irqreturn_t bcma_gpio_irq_handler(int irq, void *dev_id)
122122
static int bcma_gpio_irq_init(struct bcma_drv_cc *cc)
123123
{
124124
struct gpio_chip *chip = &cc->gpio;
125+
struct gpio_irq_chip *girq = &chip->irq;
125126
int hwirq, err;
126127

127128
if (cc->core->bus->hosttype != BCMA_HOSTTYPE_SOC)
@@ -136,15 +137,13 @@ static int bcma_gpio_irq_init(struct bcma_drv_cc *cc)
136137
bcma_chipco_gpio_intmask(cc, ~0, 0);
137138
bcma_cc_set32(cc, BCMA_CC_IRQMASK, BCMA_CC_IRQ_GPIO);
138139

139-
err = gpiochip_irqchip_add(chip,
140-
&bcma_gpio_irq_chip,
141-
0,
142-
handle_simple_irq,
143-
IRQ_TYPE_NONE);
144-
if (err) {
145-
free_irq(hwirq, cc);
146-
return err;
147-
}
140+
girq->chip = &bcma_gpio_irq_chip;
141+
/* This will let us handle the parent IRQ in the driver */
142+
girq->parent_handler = NULL;
143+
girq->num_parents = 0;
144+
girq->parents = NULL;
145+
girq->default_type = IRQ_TYPE_NONE;
146+
girq->handler = handle_simple_irq;
148147

149148
return 0;
150149
}
@@ -212,13 +211,13 @@ int bcma_gpio_init(struct bcma_drv_cc *cc)
212211
else
213212
chip->base = -1;
214213

215-
err = gpiochip_add_data(chip, cc);
214+
err = bcma_gpio_irq_init(cc);
216215
if (err)
217216
return err;
218217

219-
err = bcma_gpio_irq_init(cc);
218+
err = gpiochip_add_data(chip, cc);
220219
if (err) {
221-
gpiochip_remove(chip);
220+
bcma_gpio_irq_exit(cc);
222221
return err;
223222
}
224223

0 commit comments

Comments
 (0)