lkml.org 
[lkml]   [2013]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] 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>
---
drivers/gpio/gpio-mcp23s08.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index 6a4470b..87ed6bf 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,

match = of_match_device(of_match_ptr(mcp23s08_i2c_of_match),
&client->dev);
- if (match) {
+ pdata = client->dev.platform_data;
+ if (match || !pdata) {
base = -1;
pullups = 0;
} else {
- pdata = client->dev.platform_data;
- if (!pdata || !gpio_is_valid(pdata->base)) {
- dev_dbg(&client->dev,
- "invalid or missing platform data\n");
+ if (!gpio_is_valid(pdata->base)) {
+ dev_dbg(&client->dev, "invalid platform data\n");
return -EINVAL;
}
base = pdata->base;
--
Daniel M. Weeks

\
 
 \ /
  Last update: 2013-07-19 07:02    [W:0.093 / U:0.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site