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 <andriy.shevchenko@linux.intel.com>
Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
Linus Walleij 2020-07-21 16:01:53 +02:00 committed by Andy Shevchenko
parent 3abbdbe3dc
commit 945e72db36

View File

@ -330,6 +330,7 @@ static int crystalcove_gpio_probe(struct platform_device *pdev)
int retval; int retval;
struct device *dev = pdev->dev.parent; struct device *dev = pdev->dev.parent;
struct intel_soc_pmic *pmic = dev_get_drvdata(dev); struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
struct gpio_irq_chip *girq;
if (irq < 0) if (irq < 0)
return irq; return irq;
@ -353,14 +354,15 @@ static int crystalcove_gpio_probe(struct platform_device *pdev)
cg->chip.dbg_show = crystalcove_gpio_dbg_show; cg->chip.dbg_show = crystalcove_gpio_dbg_show;
cg->regmap = pmic->regmap; cg->regmap = pmic->regmap;
retval = devm_gpiochip_add_data(&pdev->dev, &cg->chip, cg); girq = &cg->chip.irq;
if (retval) { girq->chip = &crystalcove_irqchip;
dev_warn(&pdev->dev, "add gpio chip error: %d\n", retval); /* This will let us handle the parent IRQ in the driver */
return retval; girq->parent_handler = NULL;
} girq->num_parents = 0;
girq->parents = NULL;
gpiochip_irqchip_add_nested(&cg->chip, &crystalcove_irqchip, 0, girq->default_type = IRQ_TYPE_NONE;
handle_simple_irq, IRQ_TYPE_NONE); girq->handler = handle_simple_irq;
girq->threaded = true;
retval = request_threaded_irq(irq, NULL, crystalcove_gpio_irq_handler, retval = request_threaded_irq(irq, NULL, crystalcove_gpio_irq_handler,
IRQF_ONESHOT, KBUILD_MODNAME, cg); IRQF_ONESHOT, KBUILD_MODNAME, cg);
@ -370,7 +372,11 @@ static int crystalcove_gpio_probe(struct platform_device *pdev)
return retval; return retval;
} }
gpiochip_set_nested_irqchip(&cg->chip, &crystalcove_irqchip, irq); retval = devm_gpiochip_add_data(&pdev->dev, &cg->chip, cg);
if (retval) {
dev_warn(&pdev->dev, "add gpio chip error: %d\n", retval);
return retval;
}
return 0; return 0;
} }