[U-Boot] [PATCH v2 03/22] stm32: gpio_get_value: always return 0 or 1

Benjamin Tietz uboot at dresden.micronet24.de
Mon Jun 20 20:26:15 CEST 2016


Some functions using the GPIO-interface depend on gpio_get_value to
return 0 or 1, while the stm32 driver returned 0 or "something not zero".
This patch corrects this behaviour.
---
 drivers/gpio/stm32_gpio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/stm32_gpio.c b/drivers/gpio/stm32_gpio.c
index d092c8f..516dfcc 100644
--- a/drivers/gpio/stm32_gpio.c
+++ b/drivers/gpio/stm32_gpio.c
@@ -263,7 +263,7 @@ int gpio_get_value(unsigned gpio)
 	dsc.port = stm32_gpio_to_port(gpio);
 	dsc.pin = stm32_gpio_to_pin(gpio);
 
-	return stm32_gpin_get(&dsc);
+	return !!stm32_gpin_get(&dsc);
 }
 
 int gpio_set_value(unsigned gpio, int value)



More information about the U-Boot mailing list