]> git.karo-electronics.de Git - linux-beck.git/commitdiff
regulator: wm8350: Fix the logic to choose best current limit setting
authorAxel Lin <axel.lin@gmail.com>
Tue, 27 Mar 2012 07:20:08 +0000 (15:20 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 28 Mar 2012 11:44:07 +0000 (12:44 +0100)
Current implementation in get_isink_val actually choose the biggest current
limit setting falls within the specified range.
What we want is to choose the smallest current limit setting falls within the
specified range. Fix it.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/wm8350-regulator.c

index ff3465423be12e3774022adf6629cb993701002e..f29803cfd0cb3652ba5294cd69e39d342142910f 100644 (file)
@@ -99,7 +99,7 @@ static int get_isink_val(int min_uA, int max_uA, u16 *setting)
 {
        int i;
 
-       for (i = ARRAY_SIZE(isink_cur) - 1; i >= 0; i--) {
+       for (i = 0; i < ARRAY_SIZE(isink_cur); i++) {
                if (min_uA <= isink_cur[i] && max_uA >= isink_cur[i]) {
                        *setting = i;
                        return 0;