gpio: dln2: 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(). The irqchip is instead added while adding the gpiochip. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com> Cc: Daniel Baluta <daniel.baluta@gmail.com> Cc: Octavian Purdila <octavian.purdila@nxp.com> Link: https://lore.kernel.org/r/20200722073426.38890-1-linus.walleij@linaro.org
This commit is contained in:
Родитель
ce8672c20b
Коммит
ecb55df8f3
|
@ -440,6 +440,7 @@ static int dln2_gpio_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct dln2_gpio *dln2;
|
struct dln2_gpio *dln2;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
|
struct gpio_irq_chip *girq;
|
||||||
int pins;
|
int pins;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -476,6 +477,15 @@ static int dln2_gpio_probe(struct platform_device *pdev)
|
||||||
dln2->gpio.direction_output = dln2_gpio_direction_output;
|
dln2->gpio.direction_output = dln2_gpio_direction_output;
|
||||||
dln2->gpio.set_config = dln2_gpio_set_config;
|
dln2->gpio.set_config = dln2_gpio_set_config;
|
||||||
|
|
||||||
|
girq = &dln2->gpio.irq;
|
||||||
|
girq->chip = &dln2_gpio_irqchip;
|
||||||
|
/* The event comes from the outside so no parent handler */
|
||||||
|
girq->parent_handler = NULL;
|
||||||
|
girq->num_parents = 0;
|
||||||
|
girq->parents = NULL;
|
||||||
|
girq->default_type = IRQ_TYPE_NONE;
|
||||||
|
girq->handler = handle_simple_irq;
|
||||||
|
|
||||||
platform_set_drvdata(pdev, dln2);
|
platform_set_drvdata(pdev, dln2);
|
||||||
|
|
||||||
ret = devm_gpiochip_add_data(dev, &dln2->gpio, dln2);
|
ret = devm_gpiochip_add_data(dev, &dln2->gpio, dln2);
|
||||||
|
@ -484,13 +494,6 @@ static int dln2_gpio_probe(struct platform_device *pdev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gpiochip_irqchip_add(&dln2->gpio, &dln2_gpio_irqchip, 0,
|
|
||||||
handle_simple_irq, IRQ_TYPE_NONE);
|
|
||||||
if (ret < 0) {
|
|
||||||
dev_err(dev, "failed to add irq chip: %d\n", ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = dln2_register_event_cb(pdev, DLN2_GPIO_CONDITION_MET_EV,
|
ret = dln2_register_event_cb(pdev, DLN2_GPIO_CONDITION_MET_EV,
|
||||||
dln2_gpio_event);
|
dln2_gpio_event);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче