Skip to content

Commit ecb55df

Browse files
committed
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 <[email protected]> Tested-by: Andy Shevchenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> Cc: Daniel Baluta <[email protected]> Cc: Octavian Purdila <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ce8672c commit ecb55df

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

drivers/gpio/gpio-dln2.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ static int dln2_gpio_probe(struct platform_device *pdev)
440440
{
441441
struct dln2_gpio *dln2;
442442
struct device *dev = &pdev->dev;
443+
struct gpio_irq_chip *girq;
443444
int pins;
444445
int ret;
445446

@@ -476,6 +477,15 @@ static int dln2_gpio_probe(struct platform_device *pdev)
476477
dln2->gpio.direction_output = dln2_gpio_direction_output;
477478
dln2->gpio.set_config = dln2_gpio_set_config;
478479

480+
girq = &dln2->gpio.irq;
481+
girq->chip = &dln2_gpio_irqchip;
482+
/* The event comes from the outside so no parent handler */
483+
girq->parent_handler = NULL;
484+
girq->num_parents = 0;
485+
girq->parents = NULL;
486+
girq->default_type = IRQ_TYPE_NONE;
487+
girq->handler = handle_simple_irq;
488+
479489
platform_set_drvdata(pdev, dln2);
480490

481491
ret = devm_gpiochip_add_data(dev, &dln2->gpio, dln2);
@@ -484,13 +494,6 @@ static int dln2_gpio_probe(struct platform_device *pdev)
484494
return ret;
485495
}
486496

487-
ret = gpiochip_irqchip_add(&dln2->gpio, &dln2_gpio_irqchip, 0,
488-
handle_simple_irq, IRQ_TYPE_NONE);
489-
if (ret < 0) {
490-
dev_err(dev, "failed to add irq chip: %d\n", ret);
491-
return ret;
492-
}
493-
494497
ret = dln2_register_event_cb(pdev, DLN2_GPIO_CONDITION_MET_EV,
495498
dln2_gpio_event);
496499
if (ret) {

0 commit comments

Comments
 (0)