aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2019-08-12 04:13:51 -0400
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-08-12 13:39:27 -0400
commit7b1e889436a156c2c88953fbc5602a64a75889bd (patch)
tree5307963baa16419902334b1eaab3b71f3051d2f4
parent8069e69a9792402b52eff61e5bb874fa94798fc9 (diff)
gpio: lynxpoint: 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: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Mika Westerberg <mika.westerberg@linux.intel.com> Cc: David Cohen <david.a.cohen@linux.intel.com> Cc: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-rw-r--r--drivers/gpio/gpio-lynxpoint.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
index 31b4a091ab60..6bb9741ad036 100644
--- a/drivers/gpio/gpio-lynxpoint.c
+++ b/drivers/gpio/gpio-lynxpoint.c
@@ -358,25 +358,30 @@ static int lp_gpio_probe(struct platform_device *pdev)
358 gc->can_sleep = false; 358 gc->can_sleep = false;
359 gc->parent = dev; 359 gc->parent = dev;
360 360
361 ret = devm_gpiochip_add_data(dev, gc, lg);
362 if (ret) {
363 dev_err(dev, "failed adding lp-gpio chip\n");
364 return ret;
365 }
366
367 /* set up interrupts */ 361 /* set up interrupts */
368 if (irq_rc && irq_rc->start) { 362 if (irq_rc && irq_rc->start) {
363 struct gpio_irq_chip *girq;
364
365 girq = &gc->irq;
366 girq->chip = &lp_irqchip;
367 girq->parent_handler = lp_gpio_irq_handler;
368 girq->num_parents = 1;
369 girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents,
370 sizeof(*girq->parents),
371 GFP_KERNEL);
372 if (!girq->parents)
373 return -ENOMEM;
374 girq->parents[0] = (unsigned)irq_rc->start;
375 girq->default_type = IRQ_TYPE_NONE;
376 girq->handler = handle_simple_irq;
377
369 lp_gpio_irq_init_hw(lg); 378 lp_gpio_irq_init_hw(lg);
370 ret = gpiochip_irqchip_add(gc, &lp_irqchip, 0, 379 }
371 handle_simple_irq, IRQ_TYPE_NONE);
372 if (ret) {
373 dev_err(dev, "failed to add irqchip\n");
374 return ret;
375 }
376 380
377 gpiochip_set_chained_irqchip(gc, &lp_irqchip, 381 ret = devm_gpiochip_add_data(dev, gc, lg);
378 (unsigned)irq_rc->start, 382 if (ret) {
379 lp_gpio_irq_handler); 383 dev_err(dev, "failed adding lp-gpio chip\n");
384 return ret;
380 } 385 }
381 386
382 pm_runtime_enable(dev); 387 pm_runtime_enable(dev);