From: Marek Belisko Date: Sat, 31 Aug 2013 00:47:57 +0000 (-0700) Subject: rx51_battery: Fix channel number when reading adc value X-Git-Tag: upstream/snapshot3+hdmi~4348^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db15e6312efd537e2deb2cbad110c23f98704a3c;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git rx51_battery: Fix channel number when reading adc value This issue was introduced in commit 8e2747f031bd "power: rx51_battery: Replace hardcoded channels values." Original code use channel as argument which was shifted by one in function. After mentioned commit argument is already shifted so we need to get index back. Signed-off-by: Marek Belisko Signed-off-by: Anton Vorontsov --- diff --git a/drivers/power/rx51_battery.c b/drivers/power/rx51_battery.c index 03f5761..1bc5857 100644 --- a/drivers/power/rx51_battery.c +++ b/drivers/power/rx51_battery.c @@ -51,7 +51,7 @@ static int rx51_battery_read_adc(int channel) if (twl4030_madc_conversion(&req) <= 0) return -ENODATA; - return req.rbuf[channel]; + return req.rbuf[ffs(channel) - 1]; } /*