aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel M. Weeks <dan@danweeks.net>2013-07-19 00:19:58 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-08-16 09:07:46 -0400
commit8a564065825cb92d412f107812ef50fe9ef43668 (patch)
tree9190a65f02945146c80fe78cb280e33ef19d814b
parent8b628c659ce1e2a8714ebcfe55f80457a4ebe734 (diff)
gpio-mcp23s08: i2c: auto-select base if no DT match or platform data
The call to gpiochip_add made by this driver is capable of auto-selecting a base if one is not provided. However, it was not called unless there was already a DT entry or platform data. This patch calls it even if the base is not already known so that gpiochip_add can attempt to find a usable base. Signed-off-by: Daniel M. Weeks <dan@danweeks.net> Acked-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/gpio/gpio-mcp23s08.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index 6a4470b84488..87ed6bf6528b 100644
--- a/drivers/gpio/gpio-mcp23s08.c
+++ b/drivers/gpio/gpio-mcp23s08.c
@@ -520,14 +520,13 @@ static int mcp230xx_probe(struct i2c_client *client,
520 520
521 match = of_match_device(of_match_ptr(mcp23s08_i2c_of_match), 521 match = of_match_device(of_match_ptr(mcp23s08_i2c_of_match),
522 &client->dev); 522 &client->dev);
523 if (match) { 523 pdata = client->dev.platform_data;
524 if (match || !pdata) {
524 base = -1; 525 base = -1;
525 pullups = 0; 526 pullups = 0;
526 } else { 527 } else {
527 pdata = client->dev.platform_data; 528 if (!gpio_is_valid(pdata->base)) {
528 if (!pdata || !gpio_is_valid(pdata->base)) { 529 dev_dbg(&client->dev, "invalid platform data\n");
529 dev_dbg(&client->dev,
530 "invalid or missing platform data\n");
531 return -EINVAL; 530 return -EINVAL;
532 } 531 }
533 base = pdata->base; 532 base = pdata->base;