From: Stefano Manni <stefano.manni@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: linus.walleij@linaro.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] gpio: pisosr: read ngpios as U32
Date: Wed, 08 Oct 2025 23:28:31 +0200 [thread overview]
Message-ID: <JZ0U3T.53FSIQ97H39F1@gmail.com> (raw)
In-Reply-To: <CAMRc=MdfjuSSsD=LWDpUroyf+fxC7jQrJDtZJtmj_YiQYQjAuw@mail.gmail.com>
On lun, ago 11 2025 at 09:56:51 +02:00:00, Bartosz Golaszewski
<brgl@bgdev.pl> wrote:
> On Wed, Aug 6, 2025 at 9:17 AM Stefano Manni
> <stefano.manni@gmail.com> wrote:
>>
>> If of_property_read_u16() is used instead the value read
>> is always zero.
>>
>
> Please state more clearly what the problem is. This sentence is quite
> garbled,
the value returned by of_property_read_u16() is always zero, if
of_property_read_u32()
is used instead , then the returned value is the right one contained in
the dts.
>
>> Signed-off-by: Stefano Manni <stefano.manni@gmail.com>
>> ---
>> drivers/gpio/gpio-pisosr.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpio/gpio-pisosr.c b/drivers/gpio/gpio-pisosr.c
>> index a69b74866a13..2dc1b1e021d2 100644
>> --- a/drivers/gpio/gpio-pisosr.c
>> +++ b/drivers/gpio/gpio-pisosr.c
>> @@ -117,6 +117,7 @@ static int pisosr_gpio_probe(struct spi_device
>> *spi)
>> {
>> struct device *dev = &spi->dev;
>> struct pisosr_gpio *gpio;
>> + unsigned int ngpio;
>> int ret;
>>
>> gpio = devm_kzalloc(dev, sizeof(*gpio), GFP_KERNEL);
>> @@ -125,8 +126,11 @@ static int pisosr_gpio_probe(struct spi_device
>> *spi)
>>
>> gpio->chip = template_chip;
>> gpio->chip.parent = dev;
>> - of_property_read_u16(dev->of_node, "ngpios",
>> &gpio->chip.ngpio);
>>
>> + if (of_property_read_u32(dev->of_node, "ngpios", &ngpio))
>> + ngpio = DEFAULT_NGPIO;
>> +
>
> If you're touching this, can you switch to using generic device
> properties instead?
>
what do you mean with "generic device properties"?
Best,
Stefano
>>
next prev parent reply other threads:[~2025-10-08 21:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-06 9:15 [PATCH v2] gpio: pisosr: read ngpios as U32 Stefano Manni
2025-08-11 7:56 ` Bartosz Golaszewski
2025-10-08 21:28 ` Stefano Manni [this message]
2025-10-09 10:06 ` Bartosz Golaszewski
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=JZ0U3T.53FSIQ97H39F1@gmail.com \
--to=stefano.manni@gmail.com \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.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 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.