Commit 47203198 authored by Axel Lin's avatar Axel Lin Committed by Bartosz Golaszewski

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: default avatarAxel Lin <axel.lin@ingics.com>
Reviewed-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
parent 47d7d116
...@@ -57,11 +57,11 @@ static int wcd_gpio_direction_output(struct gpio_chip *chip, unsigned int pin, ...@@ -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) static int wcd_gpio_get(struct gpio_chip *chip, unsigned int pin)
{ {
struct wcd_gpio_data *data = gpiochip_get_data(chip); struct wcd_gpio_data *data = gpiochip_get_data(chip);
int value; unsigned int value;
regmap_read(data->map, WCD_REG_VAL_CTL_OFFSET, &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) static void wcd_gpio_set(struct gpio_chip *chip, unsigned int pin, int val)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment