From: Peter Korsgaard <peter@korsgaard.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Michael Welling <mwelling@ieee.org>,
"Daniel M. Weeks" <dan@danweeks.net>,
Lars Poeschel <poeschel@lemonage.de>,
Peter Korsgaard <jacmet@sunsite.dk>,
Alexandre Courbot <gnurou@gmail.com>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH] gpio: mcp23s08: Bug fix of SPI device tree registration.
Date: Wed, 23 Apr 2014 15:13:32 +0200 [thread overview]
Message-ID: <87fvl42npf.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <CACRpkdYCjjJ8U6JT+1mFXagG5fSKKoqDo043rB-Vw6mNhWwm+g@mail.gmail.com> (Linus Walleij's message of "Wed, 23 Apr 2014 14:01:40 +0200")
>>>>> "Linus" == Linus Walleij <linus.walleij@linaro.org> writes:
> Daniel, Lars, Peter: can either of you have a look at this patch
> and ACK/NACK it?
Sorry, it seems like I wasn't CC'ed on this patch (or the one adding the
DT bindings). The patch looks good to me:
Acked-by: Peter Korsgaard <peter@korsgaard.com>
> On Thu, Apr 17, 2014 at 3:00 AM, Michael Welling <mwelling@ieee.org> wrote:
>> The chips variable needs to be incremented for each chip that is found in the
>> spi_present_mask when register via device tree. Without this and the checking
s/register/registrering/
>> a negative index is passed to the data->chip array in a subsequent loop.
>>
>> Signed-off-by: Michael Welling <mwelling@ieee.org>
>> ---
>> drivers/gpio/gpio-mcp23s08.c | 12 +++++++-----
>> 1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
>> index 99a6831..3d53fd6 100644
>> --- a/drivers/gpio/gpio-mcp23s08.c
>> +++ b/drivers/gpio/gpio-mcp23s08.c
>> @@ -894,9 +894,11 @@ static int mcp23s08_probe(struct spi_device *spi)
>> dev_err(&spi->dev, "invalid spi-present-mask\n");
>> return -ENODEV;
>> }
>> -
>> - for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++)
>> + for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) {
>> + if ((spi_present_mask & (1 << addr)))
>> + chips++;
>> pullups[addr] = 0;
>> + }
>> } else {
>> type = spi_get_device_id(spi)->driver_data;
>> pdata = dev_get_platdata(&spi->dev);
>> @@ -919,12 +921,12 @@ static int mcp23s08_probe(struct spi_device *spi)
>> pullups[addr] = pdata->chip[addr].pullups;
>> }
>>
>> - if (!chips)
>> - return -ENODEV;
>> -
>> base = pdata->base;
>> }
>>
>> + if (!chips)
>> + return -ENODEV;
>> +
>> data = kzalloc(sizeof(*data) + chips * sizeof(struct mcp23s08),
>> GFP_KERNEL);
>> if (!data)
>> --
>> 1.7.9.5
>>
--
Bye, Peter Korsgaard
next prev parent reply other threads:[~2014-04-23 13:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-17 1:00 [PATCH] gpio: mcp23s08: Bug fix of SPI device tree registration Michael Welling
2014-04-23 12:01 ` Linus Walleij
2014-04-23 13:13 ` Peter Korsgaard [this message]
2014-04-23 23:12 ` Michael Welling
2014-04-24 13:04 ` 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=87fvl42npf.fsf@dell.be.48ers.dk \
--to=peter@korsgaard.com \
--cc=dan@danweeks.net \
--cc=gnurou@gmail.com \
--cc=jacmet@sunsite.dk \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=mwelling@ieee.org \
--cc=poeschel@lemonage.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.