Skip to content

Commit

Permalink
gpio/gpio-stmpe: Fix the value returned by _get_value routine
Browse files Browse the repository at this point in the history
The present _get_value routine returns the contents of the GPIO Monitor Pin
Status Register(GPMR) starting from the bit whose value is requested to BIT 0
(irrelevant bits are replace by 0).

For e.g. if we request the value of GPIO 6 in the earlier implementation the
value returned is:

	BIT6 followed by 6 0's

whereas it should just return BIT6.

This patch addresses the same.

Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com>
Reviewed-by: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
  • Loading branch information
Bhupesh Sharma authored and Grant Likely committed Mar 12, 2012
1 parent 0dc665d commit 7535b8b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-stmpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static int stmpe_gpio_get(struct gpio_chip *chip, unsigned offset)
if (ret < 0)
return ret;

return ret & mask;
return !!(ret & mask);
}

static void stmpe_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
Expand Down

0 comments on commit 7535b8b

Please sign in to comment.