Skip to contentSkip to conversation

gpio: altera_pio: fix get_value

PATCH New Julien Béraud 2 participants 5 messages Jan 7, 2019 – Feb 20, 2019 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 gpio: altera_pio: fix get_value

gpio_get_value should return 0 or 1, not the value of bit & (1 << pin)

---
 drivers/gpio/altera_pio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/altera_pio.c +1 -1
index 59e30979f0..324f9c29a8 100644
@@ -56,7 +56,7 @@ static int altera_pio_get_value(struct udevice *dev, unsigned pin)
 	struct altera_pio_platdata *plat = dev_get_platdata(dev);
 	struct altera_pio_regs *const regs = plat->regs;
 
-	return readl(&regs->data) & (1 << pin);
+	return !!(readl(&regs->data) & (1 << pin));
 }
 
 
Signature · 1 line
2.20.1
#1 lore raw

PATCH v3 1/1 gpio: altera_pio: fix get_value

Quoted 4 lines · Julien Béraud

gpio_get_value should return 0 or 1, not the value of bit & (1 << pin)

btw. you should keep a changelog with each new Vx of a patch. Here it's fine, just add one next time you submit patches.

Quoted 18 lines
---
 drivers/gpio/altera_pio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/altera_pio.c +1 -1
index 59e30979f0..324f9c29a8 100644
@@ -56,7 +56,7 @@ static int altera_pio_get_value(struct udevice *dev, unsigned pin)
 	struct altera_pio_platdata *plat = dev_get_platdata(dev);
 	struct altera_pio_regs *const regs = plat->regs;
 
-	return readl(&regs->data) & (1 << pin);
+	return !!(readl(&regs->data) & (1 << pin));
 }
 
 
Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw

PATCH v3 1/1 gpio: altera_pio: fix get_value

Quoted 2 lines · Marek Vasut

btw. you should keep a changelog with each new Vx of a patch. Here it's fine, just add one next time you submit patches.

Sure, I'll do it next time. Thanks.

Julien

#3 lore raw

PATCH v3 1/1 gpio: altera_pio: fix get_value

Quoted 8 lines · Julien Beraud
Quoted 2 lines · Marek Vasut

btw. you should keep a changelog with each new Vx of a patch. Here it's fine, just add one next time you submit patches.

Sure, I'll do it next time. Thanks.

Julien

Hi Marek,

I can see on https://patchwork.ozlabs.org/patch/1021221/ that the patch has been delegated to you. Though I assume you were thinking someone else would apply, may I ask you to apply it ?

Regards,
Julien

Applied
#4 lore raw

PATCH v3 1/1 gpio: altera_pio: fix get_value

Quoted 9 lines · Julien Béraud
Quoted 7 lines · Julien Beraud
Quoted 2 lines · Marek Vasut

btw. you should keep a changelog with each new Vx of a patch. Here it's fine, just add one next time you submit patches.

Sure, I'll do it next time. Thanks.

Quoted 7 lines
Quoted 1 line

Julien

Hi Marek,

I can see on https://patchwork.ozlabs.org/patch/1021221/ that the patch has been delegated to you. Though I assume you were thinking someone else would apply, may I ask you to apply it ?

Applied, thanks for the reminder

Signature · 2 lines
Best regards,
Marek Vasut