From: "Daniel M. Weeks" <dan@danweeks.net>
To: Grant Likely <grant.likely@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] gpio-mcp23s08: i2c: auto-select base if no DT match or platform data
Date: Fri, 19 Jul 2013 00:19:58 -0400 [thread overview]
Message-ID: <20130719041952.GA29001@dev.danweeks.net> (raw)
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
next reply other threads:[~2013-07-19 4:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-19 4:19 Daniel M. Weeks [this message]
2013-07-20 22:24 ` [PATCH] gpio-mcp23s08: i2c: auto-select base if no DT match or platform data Linus Walleij
2013-07-29 9:10 ` Lars Poeschel
2013-08-16 13:09 ` [PATCH] " Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130719041952.GA29001@dev.danweeks.net \
--to=dan@danweeks.net \
--cc=grant.likely@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).