Skip to content

Commit 945e72d

Browse files
linuswandy-shev
authored andcommitted
gpio: crystalcove: 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: Andy Shevchenko <[email protected]> Cc: Kuppuswamy Sathyanarayanan <[email protected]> Cc: Hans de Goede <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]> Tested-by: Hans de Goede <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent 3abbdbe commit 945e72d

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

drivers/gpio/gpio-crystalcove.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ static int crystalcove_gpio_probe(struct platform_device *pdev)
330330
int retval;
331331
struct device *dev = pdev->dev.parent;
332332
struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
333+
struct gpio_irq_chip *girq;
333334

334335
if (irq < 0)
335336
return irq;
@@ -353,14 +354,15 @@ static int crystalcove_gpio_probe(struct platform_device *pdev)
353354
cg->chip.dbg_show = crystalcove_gpio_dbg_show;
354355
cg->regmap = pmic->regmap;
355356

356-
retval = devm_gpiochip_add_data(&pdev->dev, &cg->chip, cg);
357-
if (retval) {
358-
dev_warn(&pdev->dev, "add gpio chip error: %d\n", retval);
359-
return retval;
360-
}
361-
362-
gpiochip_irqchip_add_nested(&cg->chip, &crystalcove_irqchip, 0,
363-
handle_simple_irq, IRQ_TYPE_NONE);
357+
girq = &cg->chip.irq;
358+
girq->chip = &crystalcove_irqchip;
359+
/* This will let us handle the parent IRQ in the driver */
360+
girq->parent_handler = NULL;
361+
girq->num_parents = 0;
362+
girq->parents = NULL;
363+
girq->default_type = IRQ_TYPE_NONE;
364+
girq->handler = handle_simple_irq;
365+
girq->threaded = true;
364366

365367
retval = request_threaded_irq(irq, NULL, crystalcove_gpio_irq_handler,
366368
IRQF_ONESHOT, KBUILD_MODNAME, cg);
@@ -370,7 +372,11 @@ static int crystalcove_gpio_probe(struct platform_device *pdev)
370372
return retval;
371373
}
372374

373-
gpiochip_set_nested_irqchip(&cg->chip, &crystalcove_irqchip, irq);
375+
retval = devm_gpiochip_add_data(&pdev->dev, &cg->chip, cg);
376+
if (retval) {
377+
dev_warn(&pdev->dev, "add gpio chip error: %d\n", retval);
378+
return retval;
379+
}
374380

375381
return 0;
376382
}

0 commit comments

Comments
 (0)