[U-Boot] [PATCH v9 44/49] rockchip: gpio: Read the GPIO value correctly

Simon Glass sjg at chromium.org
Fri Jan 22 03:44:08 CET 2016


This function should return 0 or 1, not a mask. Fix it.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v9: None
Changes in v2: None

 drivers/gpio/rk_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/rk_gpio.c b/drivers/gpio/rk_gpio.c
index fbdf9f3..a22e219 100644
--- a/drivers/gpio/rk_gpio.c
+++ b/drivers/gpio/rk_gpio.c
@@ -53,7 +53,7 @@ static int rockchip_gpio_get_value(struct udevice *dev, unsigned offset)
 	struct rockchip_gpio_priv *priv = dev_get_priv(dev);
 	struct rockchip_gpio_regs *regs = priv->regs;
 
-	return readl(&regs->ext_port) & OFFSET_TO_BIT(offset);
+	return readl(&regs->ext_port) & OFFSET_TO_BIT(offset) ? 1 : 0;
 }
 
 static int rockchip_gpio_set_value(struct udevice *dev, unsigned offset,
-- 
2.7.0.rc3.207.g0ac5344



More information about the U-Boot mailing list