rx51_battery: Fix channel number when reading adc value
authorMarek Belisko <marek.belisko@open-nandra.com>
Sat, 31 Aug 2013 00:47:57 +0000 (17:47 -0700)
committerAnton Vorontsov <anton@enomsg.org>
Sat, 31 Aug 2013 00:49:15 +0000 (17:49 -0700)
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 <marek.belisko@open-nandra.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
drivers/power/rx51_battery.c

index 03f57615be56efd6c0f5a008efca861bb7b81a75..1bc5857b8bd5103c0f66bb0bdfb6798d2272c933 100644 (file)
@@ -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];
 }
 
 /*