summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-wcd934x.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2020-01-31 20:29:18 +0800
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2020-02-10 10:50:58 +0100
commit47203198ed3df0f6896d07613182c05cb94110a5 (patch)
treedab4de05d98b8367984b6ea937bb6f5bfe299611 /drivers/gpio/gpio-wcd934x.c
parent47d7d116661993499d626f7ec6f7679e83d59f15 (diff)
gpio: wcd934x: Fix logic of wcd_gpio_get
The check with register value and mask should be & rather than &&. While at it, also use "unsigned int" for value variable because regmap_read() takes unsigned int *val argument. Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Diffstat (limited to 'drivers/gpio/gpio-wcd934x.c')
-rw-r--r--drivers/gpio/gpio-wcd934x.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-wcd934x.c b/drivers/gpio/gpio-wcd934x.c
index 9d4ec8941b9b..1cbce5990855 100644
--- a/drivers/gpio/gpio-wcd934x.c
+++ b/drivers/gpio/gpio-wcd934x.c
@@ -57,11 +57,11 @@ static int wcd_gpio_direction_output(struct gpio_chip *chip, unsigned int pin,
static int wcd_gpio_get(struct gpio_chip *chip, unsigned int pin)
{
struct wcd_gpio_data *data = gpiochip_get_data(chip);
- int value;
+ unsigned int value;
regmap_read(data->map, WCD_REG_VAL_CTL_OFFSET, &value);
- return !!(value && WCD_PIN_MASK(pin));
+ return !!(value & WCD_PIN_MASK(pin));
}
static void wcd_gpio_set(struct gpio_chip *chip, unsigned int pin, int val)