Skip to content

Commit e81376e

Browse files
committed
pinctrl: amd: 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]> Cc: Shyam Sundar S K <[email protected]> Cc: Sandeep Singh <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 047cd9a commit e81376e

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

drivers/pinctrl/pinctrl-amd.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,7 @@ static int amd_gpio_probe(struct platform_device *pdev)
846846
int irq_base;
847847
struct resource *res;
848848
struct amd_gpio *gpio_dev;
849+
struct gpio_irq_chip *girq;
849850

850851
gpio_dev = devm_kzalloc(&pdev->dev,
851852
sizeof(struct amd_gpio), GFP_KERNEL);
@@ -907,6 +908,15 @@ static int amd_gpio_probe(struct platform_device *pdev)
907908
return PTR_ERR(gpio_dev->pctrl);
908909
}
909910

911+
girq = &gpio_dev->gc.irq;
912+
girq->chip = &amd_gpio_irqchip;
913+
/* This will let us handle the parent IRQ in the driver */
914+
girq->parent_handler = NULL;
915+
girq->num_parents = 0;
916+
girq->parents = NULL;
917+
girq->default_type = IRQ_TYPE_NONE;
918+
girq->handler = handle_simple_irq;
919+
910920
ret = gpiochip_add_data(&gpio_dev->gc, gpio_dev);
911921
if (ret)
912922
return ret;
@@ -918,17 +928,6 @@ static int amd_gpio_probe(struct platform_device *pdev)
918928
goto out2;
919929
}
920930

921-
ret = gpiochip_irqchip_add(&gpio_dev->gc,
922-
&amd_gpio_irqchip,
923-
0,
924-
handle_simple_irq,
925-
IRQ_TYPE_NONE);
926-
if (ret) {
927-
dev_err(&pdev->dev, "could not add irqchip\n");
928-
ret = -ENODEV;
929-
goto out2;
930-
}
931-
932931
ret = devm_request_irq(&pdev->dev, irq_base, amd_gpio_irq_handler,
933932
IRQF_SHARED, KBUILD_MODNAME, gpio_dev);
934933
if (ret)

0 commit comments

Comments
 (0)