diff mbox

[v3] gpio: bcm281xx: Fix return value of bcm_kona_gpio_get()

Message ID 1385075566-23989-1-git-send-email-markus.mayer@linaro.org
State Accepted
Commit e2f0b00560729c47f39b2bc624eb93d82dc0e3e8
Headers show

Commit Message

Markus Mayer Nov. 21, 2013, 11:12 p.m. UTC
We need to return the corresponding bit for a particular GPIO. This bit
contains shift not mask.

Signed-off-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Tim Kryger <tim.kryger@linaro.org>
Reviewed-by: Matt Porter <matt.porter@linaro.org>
---

Changes since v2:
-----------------

Use 
	return !!(val & BIT(bit));
rather than
	return (val >> bit) & 1;

Changes since v1:
-----------------

Clarified commit message


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

Comments

Linus Walleij Nov. 27, 2013, 2:01 p.m. UTC | #1
On Fri, Nov 22, 2013 at 12:12 AM, Markus Mayer <markus.mayer@linaro.org> wrote:

> We need to return the corresponding bit for a particular GPIO. This bit
> contains shift not mask.
>
> Signed-off-by: Markus Mayer <markus.mayer@linaro.org>
> Reviewed-by: Tim Kryger <tim.kryger@linaro.org>
> Reviewed-by: Matt Porter <matt.porter@linaro.org>

Patch applied for fixes, thanks!

Yours,
Linus Walleij
diff mbox

Patch

diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c
index 72c927d..54c18c2 100644
--- a/drivers/gpio/gpio-bcm-kona.c
+++ b/drivers/gpio/gpio-bcm-kona.c
@@ -158,7 +158,7 @@  static int bcm_kona_gpio_get(struct gpio_chip *chip, unsigned gpio)
 	spin_unlock_irqrestore(&kona_gpio->lock, flags);
 
 	/* return the specified bit status */
-	return !!(val & bit);
+	return !!(val & BIT(bit));
 }
 
 static int bcm_kona_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)