Skip to content

Commit 866e863

Browse files
committed
gpio: pcie-idio-24: Use irqchip template
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit call to gpiochip_irqchip_add(). The irqchip is instead added while adding the gpiochip. Signed-off-by: Linus Walleij <[email protected]> Acked-by: William Breathitt Gray <[email protected]> Cc: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 82e4613 commit 866e863

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

drivers/gpio/gpio-pcie-idio-24.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id)
457457
int err;
458458
const size_t pci_bar_index = 2;
459459
const char *const name = pci_name(pdev);
460+
struct gpio_irq_chip *girq;
460461

461462
idio24gpio = devm_kzalloc(dev, sizeof(*idio24gpio), GFP_KERNEL);
462463
if (!idio24gpio)
@@ -490,6 +491,15 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id)
490491
idio24gpio->chip.set = idio_24_gpio_set;
491492
idio24gpio->chip.set_multiple = idio_24_gpio_set_multiple;
492493

494+
girq = &idio24gpio->chip.irq;
495+
girq->chip = &idio_24_irqchip;
496+
/* This will let us handle the parent IRQ in the driver */
497+
girq->parent_handler = NULL;
498+
girq->num_parents = 0;
499+
girq->parents = NULL;
500+
girq->default_type = IRQ_TYPE_NONE;
501+
girq->handler = handle_edge_irq;
502+
493503
raw_spin_lock_init(&idio24gpio->lock);
494504

495505
/* Software board reset */
@@ -501,13 +511,6 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id)
501511
return err;
502512
}
503513

504-
err = gpiochip_irqchip_add(&idio24gpio->chip, &idio_24_irqchip, 0,
505-
handle_edge_irq, IRQ_TYPE_NONE);
506-
if (err) {
507-
dev_err(dev, "Could not add irqchip (%d)\n", err);
508-
return err;
509-
}
510-
511514
err = devm_request_irq(dev, pdev->irq, idio_24_irq_handler, IRQF_SHARED,
512515
name, idio24gpio);
513516
if (err) {

0 commit comments

Comments
 (0)