Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: xlp: Pass irqchip when adding gpiochip

We need to convert all old gpio irqchips to pass the irqchip
setup along when adding the gpio_chip. For more info see
drivers/gpio/TODO.

For chained irqchips this is a pretty straight-forward
conversion.

Cc: Jayachandran C <jnair@caviumnetworks.com>
Cc: Kamlakant Patel <kamlakant.patel@broadcom.com>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20190809135119.6946-1-linus.walleij@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+15 -14
+15 -14
drivers/gpio/gpio-xlp.c
··· 290 290 static int xlp_gpio_probe(struct platform_device *pdev) 291 291 { 292 292 struct gpio_chip *gc; 293 + struct gpio_irq_chip *girq; 293 294 struct xlp_gpio_priv *priv; 294 295 void __iomem *gpio_base; 295 296 int irq_base, irq, err; ··· 396 395 irq_base = 0; 397 396 } 398 397 398 + girq = &gc->irq; 399 + girq->chip = &xlp_gpio_irq_chip; 400 + girq->parent_handler = xlp_gpio_generic_handler; 401 + girq->num_parents = 1; 402 + girq->parents = devm_kcalloc(&pdev->dev, 1, 403 + sizeof(*girq->parents), 404 + GFP_KERNEL); 405 + if (!girq->parents) 406 + return -ENOMEM; 407 + girq->parents[0] = irq; 408 + girq->first = irq_base; 409 + girq->default_type = IRQ_TYPE_NONE; 410 + girq->handler = handle_level_irq; 411 + 399 412 err = gpiochip_add_data(gc, priv); 400 413 if (err < 0) 401 414 return err; 402 415 403 - err = gpiochip_irqchip_add(gc, &xlp_gpio_irq_chip, irq_base, 404 - handle_level_irq, IRQ_TYPE_NONE); 405 - if (err) { 406 - dev_err(&pdev->dev, "Could not connect irqchip to gpiochip!\n"); 407 - goto out_gpio_remove; 408 - } 409 - 410 - gpiochip_set_chained_irqchip(gc, &xlp_gpio_irq_chip, irq, 411 - xlp_gpio_generic_handler); 412 - 413 416 dev_info(&pdev->dev, "registered %d GPIOs\n", gc->ngpio); 414 417 415 418 return 0; 416 - 417 - out_gpio_remove: 418 - gpiochip_remove(gc); 419 - return err; 420 419 } 421 420 422 421 #ifdef CONFIG_ACPI