Skip to content

Commit

Permalink
gpio: wcd934x: Fix logic of wcd_gpio_get
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Srinivas Kandagatla <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
  • Loading branch information
AxelLin authored and brgl committed Feb 10, 2020
1 parent 47d7d11 commit 4720319
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpio/gpio-wcd934x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4720319

Please sign in to comment.