* [PATCH] gpio-mcp23s08: i2c: auto-select base if no DT match or platform data
@ 2013-07-19 4:19 Daniel M. Weeks
2013-07-20 22:24 ` Linus Walleij
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Daniel M. Weeks @ 2013-07-19 4:19 UTC (permalink / raw)
To: Grant Likely, Linus Walleij; +Cc: linux-kernel
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
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] gpio-mcp23s08: i2c: auto-select base if no DT match or platform data
2013-07-19 4:19 [PATCH] gpio-mcp23s08: i2c: auto-select base if no DT match or platform data Daniel M. Weeks
@ 2013-07-20 22:24 ` Linus Walleij
2013-07-29 9:10 ` Lars Poeschel
2013-08-16 13:09 ` [PATCH] " Linus Walleij
2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2013-07-20 22:24 UTC (permalink / raw)
To: Daniel M. Weeks, Peter Korsgaard, Lars Poeschel
Cc: Grant Likely, linux-kernel@vger.kernel.org
On Fri, Jul 19, 2013 at 6:19 AM, Daniel M. Weeks <dan@danweeks.net> wrote:
> 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>
Peter, Lars: you also contribute to this driver so can you folks have
a look at each others patches, e.g it'd be nice to have an ACK on this.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gpio-mcp23s08: i2c: auto-select base if no DT match or platform data
2013-07-19 4:19 [PATCH] gpio-mcp23s08: i2c: auto-select base if no DT match or platform data Daniel M. Weeks
2013-07-20 22:24 ` Linus Walleij
@ 2013-07-29 9:10 ` Lars Poeschel
2013-08-16 13:09 ` [PATCH] " Linus Walleij
2 siblings, 0 replies; 4+ messages in thread
From: Lars Poeschel @ 2013-07-29 9:10 UTC (permalink / raw)
To: Daniel M. Weeks; +Cc: Grant Likely, Linus Walleij, linux-kernel
On Friday 19 July 2013 at 06:19:58, Daniel M. Weeks wrote:
> 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.
Nitpick:
You describe what your patch changes in the commit message. This is good,
but I can see the changes looking at the code. Can you please add a few
lines describing WHY your patch is needed ? (That'd be to be able to
instantiate a device from userspace with sysfs, right ?)
The code is ok, so with a modified commit message feel free to add my
Acked-by: Lars Poeschel <poeschel@lemonage.de>
> 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;
Thanks,
Lars
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] gpio-mcp23s08: i2c: auto-select base if no DT match or platform data
2013-07-19 4:19 [PATCH] gpio-mcp23s08: i2c: auto-select base if no DT match or platform data Daniel M. Weeks
2013-07-20 22:24 ` Linus Walleij
2013-07-29 9:10 ` Lars Poeschel
@ 2013-08-16 13:09 ` Linus Walleij
2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2013-08-16 13:09 UTC (permalink / raw)
To: Daniel M. Weeks; +Cc: Grant Likely, linux-kernel@vger.kernel.org
On Fri, Jul 19, 2013 at 6:19 AM, Daniel M. Weeks <dan@danweeks.net> wrote:
> 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>
Patch applied with Lars' ACK.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-16 13:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-19 4:19 [PATCH] gpio-mcp23s08: i2c: auto-select base if no DT match or platform data Daniel M. Weeks
2013-07-20 22:24 ` Linus Walleij
2013-07-29 9:10 ` Lars Poeschel
2013-08-16 13:09 ` [PATCH] " Linus Walleij
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).