Skip to content

Commit 22f61d4

Browse files
linuswandy-shev
authored andcommitted
gpio: wcove: 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. Cc: Bin Gao <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Hans de Goede <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Tested-by: Hans de Goede <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent 945e72d commit 22f61d4

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

drivers/gpio/gpio-wcove.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ static int wcove_gpio_probe(struct platform_device *pdev)
400400
struct wcove_gpio *wg;
401401
int virq, ret, irq;
402402
struct device *dev;
403+
struct gpio_irq_chip *girq;
403404

404405
/*
405406
* This gpio platform device is created by a mfd device (see
@@ -442,19 +443,6 @@ static int wcove_gpio_probe(struct platform_device *pdev)
442443
wg->dev = dev;
443444
wg->regmap = pmic->regmap;
444445

445-
ret = devm_gpiochip_add_data(dev, &wg->chip, wg);
446-
if (ret) {
447-
dev_err(dev, "Failed to add gpiochip: %d\n", ret);
448-
return ret;
449-
}
450-
451-
ret = gpiochip_irqchip_add_nested(&wg->chip, &wcove_irqchip, 0,
452-
handle_simple_irq, IRQ_TYPE_NONE);
453-
if (ret) {
454-
dev_err(dev, "Failed to add irqchip: %d\n", ret);
455-
return ret;
456-
}
457-
458446
virq = regmap_irq_get_virq(wg->regmap_irq_chip, irq);
459447
if (virq < 0) {
460448
dev_err(dev, "Failed to get virq by irq %d\n", irq);
@@ -468,7 +456,21 @@ static int wcove_gpio_probe(struct platform_device *pdev)
468456
return ret;
469457
}
470458

471-
gpiochip_set_nested_irqchip(&wg->chip, &wcove_irqchip, virq);
459+
girq = &wg->chip.irq;
460+
girq->chip = &wcove_irqchip;
461+
/* This will let us handle the parent IRQ in the driver */
462+
girq->parent_handler = NULL;
463+
girq->num_parents = 0;
464+
girq->parents = NULL;
465+
girq->default_type = IRQ_TYPE_NONE;
466+
girq->handler = handle_simple_irq;
467+
girq->threaded = true;
468+
469+
ret = devm_gpiochip_add_data(dev, &wg->chip, wg);
470+
if (ret) {
471+
dev_err(dev, "Failed to add gpiochip: %d\n", ret);
472+
return ret;
473+
}
472474

473475
/* Enable GPIO0 interrupts */
474476
ret = regmap_update_bits(wg->regmap, IRQ_MASK_BASE, GPIO_IRQ0_MASK,

0 commit comments

Comments
 (0)