Commit db15e631 authored by Marek Belisko's avatar Marek Belisko Committed by Anton Vorontsov

rx51_battery: Fix channel number when reading adc value

This issue was introduced in commit 8e2747f0 "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: default avatarMarek Belisko <marek.belisko@open-nandra.com>
Signed-off-by: default avatarAnton Vorontsov <anton@enomsg.org>
parent da0a00eb
...@@ -51,7 +51,7 @@ static int rx51_battery_read_adc(int channel) ...@@ -51,7 +51,7 @@ static int rx51_battery_read_adc(int channel)
if (twl4030_madc_conversion(&req) <= 0) if (twl4030_madc_conversion(&req) <= 0)
return -ENODATA; return -ENODATA;
return req.rbuf[channel]; return req.rbuf[ffs(channel) - 1];
} }
/* /*
......
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