Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200722111725.210923-1-linus.walleij@linaro.org

authored by

Linus Walleij and committed by
Kalle Valo
a080ecb1 92d26d1a

+11 -12
+11 -12
drivers/bcma/driver_gpio.c
··· 122 122 static int bcma_gpio_irq_init(struct bcma_drv_cc *cc) 123 123 { 124 124 struct gpio_chip *chip = &cc->gpio; 125 + struct gpio_irq_chip *girq = &chip->irq; 125 126 int hwirq, err; 126 127 127 128 if (cc->core->bus->hosttype != BCMA_HOSTTYPE_SOC) ··· 137 136 bcma_chipco_gpio_intmask(cc, ~0, 0); 138 137 bcma_cc_set32(cc, BCMA_CC_IRQMASK, BCMA_CC_IRQ_GPIO); 139 138 140 - err = gpiochip_irqchip_add(chip, 141 - &bcma_gpio_irq_chip, 142 - 0, 143 - handle_simple_irq, 144 - IRQ_TYPE_NONE); 145 - if (err) { 146 - free_irq(hwirq, cc); 147 - return err; 148 - } 139 + girq->chip = &bcma_gpio_irq_chip; 140 + /* This will let us handle the parent IRQ in the driver */ 141 + girq->parent_handler = NULL; 142 + girq->num_parents = 0; 143 + girq->parents = NULL; 144 + girq->default_type = IRQ_TYPE_NONE; 145 + girq->handler = handle_simple_irq; 149 146 150 147 return 0; 151 148 } ··· 211 212 else 212 213 chip->base = -1; 213 214 214 - err = gpiochip_add_data(chip, cc); 215 + err = bcma_gpio_irq_init(cc); 215 216 if (err) 216 217 return err; 217 218 218 - err = bcma_gpio_irq_init(cc); 219 + err = gpiochip_add_data(chip, cc); 219 220 if (err) { 220 - gpiochip_remove(chip); 221 + bcma_gpio_irq_exit(cc); 221 222 return err; 222 223 } 223 224