Skip to contentSkip to conversation

gpio: pisosr: Read "ngpios" as u32

PATCH Applied Rob Herring (Arm) 3 participants 4 messages Jun 12 – Jun 16 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: pisosr: Read "ngpios" as u32

The generic "ngpios" property is encoded as a normal uint32 cell. The pisosr driver stores it in the gpio_chip field, but reading it with a u16 helper does not match the DT property encoding.

Read "ngpios" as u32 and keep the existing assignment to the chip field.

Assisted-by Codex:gpt-5-5
---
 drivers/gpio/gpio-pisosr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-pisosr.c +3 -1
index 7ec6a46ed600..2732ea8c16b7 100644
@@ -112,6 +112,7 @@ static int pisosr_gpio_probe(struct spi_device *spi)
 {
 	struct device *dev = &spi->dev;
 	struct pisosr_gpio *gpio;
+	u32 ngpios;
 	int ret;
 
 	gpio = devm_kzalloc(dev, sizeof(*gpio), GFP_KERNEL);
@@ -120,7 +121,8 @@ 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", &ngpios))
+		gpio->chip.ngpio = ngpios;
 
 	gpio->spi = spi;
 
Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 9 lines · Rob Herring (Arm)

The generic "ngpios" property is encoded as a normal uint32 cell. The pisosr driver stores it in the gpio_chip field, but reading it with a u16 helper does not match the DT property encoding.

Read "ngpios" as u32 and keep the existing assignment to the chip field.

Assisted-by Codex:gpt-5-5

Patch applied.

Yours,
Linus Walleij

maintainer
#2 lore raw
Quoted 6 lines · Linus Walleij
Quoted 4 lines · Rob Herring (Arm)

The generic "ngpios" property is encoded as a normal uint32 cell. The pisosr driver stores it in the gpio_chip field, but reading it with a u16 helper does not match the DT property encoding.

Quoted 7 lines
Quoted 5 lines

Read "ngpios" as u32 and keep the existing assignment to the chip field.

Assisted-by Codex:gpt-5-5

Patch applied.

Oh no I don't. That's GPIO. Bartosz will look into it, I dropped it from my tree.

Yours,
Linus Walleij

#3 lore raw
In reply to Rob Herring (Arm)
Quoted 8 lines · Rob Herring (Arm)

The generic "ngpios" property is encoded as a normal uint32 cell. The pisosr driver stores it in the gpio_chip field, but reading it with a u16 helper does not match the DT property encoding.

Read "ngpios" as u32 and keep the existing assignment to the chip field.

[...]

Applied, thanks!

[1/1] gpio: pisosr: Read "ngpios" as u32

      https://git.kernel.org/brgl/c/4910aa198d25e5d1067236560ba34ab12bccc677

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>