From 5ad14313bca82c19af7844cfbb0e1b8888ed8080 Mon Sep 17 00:00:00 2001 From: Juan Manuel Cruz Date: Wed, 26 Aug 2015 13:47:29 -0500 Subject: [PATCH] gpio: Fix designware's driver set bit function This commit fixes the set bit function. If the value to set is different from zero, then the indicated bit will be set. Change-Id: I9c42f683d108b371ca821f446ac5a10541b89b9f Signed-off-by: Juan Manuel Cruz --- drivers/gpio/gpio-dw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-dw.c b/drivers/gpio/gpio-dw.c index 62e8bcda821..bcd10c3dd36 100644 --- a/drivers/gpio/gpio-dw.c +++ b/drivers/gpio/gpio-dw.c @@ -76,7 +76,7 @@ static void dw_set_bit(uint32_t base_addr, uint32_t offset, reg = dw_read(base_addr, offset); reg &= ~BIT(bit); - reg |= ((value & 0x1) << bit); + reg |= (((!!value) & 0x1) << bit); dw_write(base_addr, offset, reg); }