diff options
author | Andrew Ruder <andy@aeruder.net> | 2013-08-07 17:52:40 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-08-16 11:19:16 -0400 |
commit | 40a625daa88653d7942dc85483f6f289cd687cb7 (patch) | |
tree | 0ed75d57c2afc2b2c5168f5c4f9cfa95cffacb79 /drivers/gpio | |
parent | 08a67a58af3c361ae3e8d6fcf23a1489213309a9 (diff) |
gpio: pca953x: fix gpio input on gpio offsets >= 8
This change fixes a regression introduced by commit
f5f0b7aa8 (gpio: pca953x: make the register access by GPIO bank)
When the pca953x driver was converted to using 8-bit reads/writes
the bitmask in pca953x_gpio_get_value wasn't adjusted with a
modulus BANK_SZ and consequently looks at the wrong bits in the
input register.
Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>
Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-pca953x.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index 07651d30ba8b..91eb8d4492ef 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c | |||
@@ -308,7 +308,7 @@ static int pca953x_gpio_get_value(struct gpio_chip *gc, unsigned off) | |||
308 | return 0; | 308 | return 0; |
309 | } | 309 | } |
310 | 310 | ||
311 | return (reg_val & (1u << off)) ? 1 : 0; | 311 | return (reg_val & (1u << (off % BANK_SZ))) ? 1 : 0; |
312 | } | 312 | } |
313 | 313 | ||
314 | static void pca953x_gpio_set_value(struct gpio_chip *gc, unsigned off, int val) | 314 | static void pca953x_gpio_set_value(struct gpio_chip *gc, unsigned off, int val) |