diff options
Diffstat (limited to 'drivers/gpio/gpio-twl4030.c')
-rw-r--r-- | drivers/gpio/gpio-twl4030.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c index 94256fe7bf36..f030880bc9bb 100644 --- a/drivers/gpio/gpio-twl4030.c +++ b/drivers/gpio/gpio-twl4030.c | |||
@@ -51,6 +51,7 @@ | |||
51 | 51 | ||
52 | 52 | ||
53 | static struct gpio_chip twl_gpiochip; | 53 | static struct gpio_chip twl_gpiochip; |
54 | static int twl4030_gpio_base; | ||
54 | static int twl4030_gpio_irq_base; | 55 | static int twl4030_gpio_irq_base; |
55 | 56 | ||
56 | /* genirq interfaces are not available to modules */ | 57 | /* genirq interfaces are not available to modules */ |
@@ -428,8 +429,6 @@ no_irqs: | |||
428 | twl_gpiochip.dev = &pdev->dev; | 429 | twl_gpiochip.dev = &pdev->dev; |
429 | 430 | ||
430 | if (pdata) { | 431 | if (pdata) { |
431 | twl_gpiochip.base = pdata->gpio_base; | ||
432 | |||
433 | /* | 432 | /* |
434 | * NOTE: boards may waste power if they don't set pullups | 433 | * NOTE: boards may waste power if they don't set pullups |
435 | * and pulldowns correctly ... default for non-ULPI pins is | 434 | * and pulldowns correctly ... default for non-ULPI pins is |
@@ -461,15 +460,21 @@ no_irqs: | |||
461 | dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret); | 460 | dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret); |
462 | twl_gpiochip.ngpio = 0; | 461 | twl_gpiochip.ngpio = 0; |
463 | gpio_twl4030_remove(pdev); | 462 | gpio_twl4030_remove(pdev); |
464 | } else if (pdata && pdata->setup) { | 463 | goto out; |
464 | } | ||
465 | |||
466 | twl4030_gpio_base = twl_gpiochip.base; | ||
467 | |||
468 | if (pdata && pdata->setup) { | ||
465 | int status; | 469 | int status; |
466 | 470 | ||
467 | status = pdata->setup(&pdev->dev, | 471 | status = pdata->setup(&pdev->dev, |
468 | pdata->gpio_base, TWL4030_GPIO_MAX); | 472 | twl4030_gpio_base, TWL4030_GPIO_MAX); |
469 | if (status) | 473 | if (status) |
470 | dev_dbg(&pdev->dev, "setup --> %d\n", status); | 474 | dev_dbg(&pdev->dev, "setup --> %d\n", status); |
471 | } | 475 | } |
472 | 476 | ||
477 | out: | ||
473 | return ret; | 478 | return ret; |
474 | } | 479 | } |
475 | 480 | ||
@@ -481,7 +486,7 @@ static int gpio_twl4030_remove(struct platform_device *pdev) | |||
481 | 486 | ||
482 | if (pdata && pdata->teardown) { | 487 | if (pdata && pdata->teardown) { |
483 | status = pdata->teardown(&pdev->dev, | 488 | status = pdata->teardown(&pdev->dev, |
484 | pdata->gpio_base, TWL4030_GPIO_MAX); | 489 | twl4030_gpio_base, TWL4030_GPIO_MAX); |
485 | if (status) { | 490 | if (status) { |
486 | dev_dbg(&pdev->dev, "teardown --> %d\n", status); | 491 | dev_dbg(&pdev->dev, "teardown --> %d\n", status); |
487 | return status; | 492 | return status; |