mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefano Manni <stefano.manni@gmail.com>
To: linus.walleij@linaro.org, brgl@bgdev.pl
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Stefano Manni <stefano.manni@eletechsrl.it>,
	Stefano Manni <stefano.manni@gmail.com>
Subject: [PATCH] gpio: pisosr: read ngpios as U32
Date: Tue,  5 Aug 2025 16:28:56 +0200	[thread overview]
Message-ID: <20250805142856.18360-1-stefano.manni@gmail.com> (raw)

From: Stefano Manni <stefano.manni@eletechsrl.it>

If of_property_read_u16() is used instead the value read
is always zero.

Signed-off-by: Stefano Manni <stefano.manni@eletechsrl.it>
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;
+
+	gpio->chip.ngpio = ngpio;
 	gpio->spi = spi;
 
 	gpio->buffer_size = DIV_ROUND_UP(gpio->chip.ngpio, 8);
-- 
2.48.1


             reply	other threads:[~2025-08-05 12:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-05 14:28 Stefano Manni [this message]
2025-08-06  9:17 ` Stefano Manni
2026-06-12 21:52 [PATCH] gpio: pisosr: Read "ngpios" as u32 Rob Herring (Arm)
2026-06-12 22:23 ` Linus Walleij
2026-06-15 12:37   ` Linus Walleij
2026-06-16  7:19 ` 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=20250805142856.18360-1-stefano.manni@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 \
    --cc=stefano.manni@eletechsrl.it \
    /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

all inboxes | Powered by JetHome®