Skip to content

Commit 57597e1

Browse files
committed
pinctrl: mcp23s08: 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. Signed-off-by: Linus Walleij <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Jan Kundrát <[email protected]> Cc: Phil Reid <[email protected]> Cc: Lars Poeschel <[email protected]> Cc: Jason Kridner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0a04d76 commit 57597e1

File tree

1 file changed

+14
-30
lines changed

1 file changed

+14
-30
lines changed

drivers/pinctrl/pinctrl-mcp23s08.c

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -522,29 +522,6 @@ static int mcp23s08_irq_setup(struct mcp23s08 *mcp)
522522
return 0;
523523
}
524524

525-
static int mcp23s08_irqchip_setup(struct mcp23s08 *mcp)
526-
{
527-
struct gpio_chip *chip = &mcp->chip;
528-
int err;
529-
530-
err = gpiochip_irqchip_add_nested(chip,
531-
&mcp->irq_chip,
532-
0,
533-
handle_simple_irq,
534-
IRQ_TYPE_NONE);
535-
if (err) {
536-
dev_err(chip->parent,
537-
"could not connect irqchip to gpiochip: %d\n", err);
538-
return err;
539-
}
540-
541-
gpiochip_set_nested_irqchip(chip,
542-
&mcp->irq_chip,
543-
mcp->irq);
544-
545-
return 0;
546-
}
547-
548525
/*----------------------------------------------------------------------*/
549526

550527
int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
@@ -589,10 +566,6 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
589566
if (ret < 0)
590567
goto fail;
591568

592-
ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp);
593-
if (ret < 0)
594-
goto fail;
595-
596569
mcp->irq_controller =
597570
device_property_read_bool(dev, "interrupt-controller");
598571
if (mcp->irq && mcp->irq_controller) {
@@ -629,11 +602,22 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
629602
}
630603

631604
if (mcp->irq && mcp->irq_controller) {
632-
ret = mcp23s08_irqchip_setup(mcp);
633-
if (ret)
634-
goto fail;
605+
struct gpio_irq_chip *girq = &mcp->chip.irq;
606+
607+
girq->chip = &mcp->irq_chip;
608+
/* This will let us handle the parent IRQ in the driver */
609+
girq->parent_handler = NULL;
610+
girq->num_parents = 0;
611+
girq->parents = NULL;
612+
girq->default_type = IRQ_TYPE_NONE;
613+
girq->handler = handle_simple_irq;
614+
girq->threaded = true;
635615
}
636616

617+
ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp);
618+
if (ret < 0)
619+
goto fail;
620+
637621
mcp->pinctrl_desc.pctlops = &mcp_pinctrl_ops;
638622
mcp->pinctrl_desc.confops = &mcp_pinconf_ops;
639623
mcp->pinctrl_desc.npins = mcp->chip.ngpio;

0 commit comments

Comments
 (0)