aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-twl4030.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index 697396c74627..49e5c6eb403a 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -395,23 +395,26 @@ static int gpio_twl4030_remove(struct platform_device *pdev);
395static int __devinit gpio_twl4030_probe(struct platform_device *pdev) 395static int __devinit gpio_twl4030_probe(struct platform_device *pdev)
396{ 396{
397 struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data; 397 struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data;
398 int ret; 398 int ret, irq_base;
399 399
400 /* maybe setup IRQs */ 400 /* maybe setup IRQs */
401 if (pdata->irq_base) { 401 if (is_module()) {
402 if (is_module()) { 402 dev_err(&pdev->dev, "can't dispatch IRQs from modules\n");
403 dev_err(&pdev->dev, 403 goto no_irqs;
404 "can't dispatch IRQs from modules\n"); 404 }
405 goto no_irqs; 405
406 } 406 irq_base = irq_alloc_descs(-1, 0, TWL4030_GPIO_MAX, 0);
407 ret = twl4030_sih_setup(&pdev->dev, TWL4030_MODULE_GPIO, 407 if (irq_base < 0) {
408 pdata->irq_base); 408 dev_err(&pdev->dev, "Failed to alloc irq_descs\n");
409 if (ret < 0) 409 return irq_base;
410 return ret;
411 WARN_ON(ret != pdata->irq_base);
412 twl4030_gpio_irq_base = ret;
413 } 410 }
414 411
412 ret = twl4030_sih_setup(&pdev->dev, TWL4030_MODULE_GPIO, irq_base);
413 if (ret < 0)
414 return ret;
415
416 twl4030_gpio_irq_base = irq_base;
417
415no_irqs: 418no_irqs:
416 /* 419 /*
417 * NOTE: boards may waste power if they don't set pullups 420 * NOTE: boards may waste power if they don't set pullups
@@ -443,9 +446,7 @@ no_irqs:
443 446
444 ret = gpiochip_add(&twl_gpiochip); 447 ret = gpiochip_add(&twl_gpiochip);
445 if (ret < 0) { 448 if (ret < 0) {
446 dev_err(&pdev->dev, 449 dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret);
447 "could not register gpiochip, %d\n",
448 ret);
449 twl_gpiochip.ngpio = 0; 450 twl_gpiochip.ngpio = 0;
450 gpio_twl4030_remove(pdev); 451 gpio_twl4030_remove(pdev);
451 } else if (pdata->setup) { 452 } else if (pdata->setup) {