fbdev: move FBIO_WAITFORVSYNC to linux/fb.h
[safe/jmp/linux-2.6] / drivers / regulator / da903x.c
index c9de730..f8c4661 100644 (file)
@@ -301,7 +301,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev,
        }
 
        val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
-       val = (val > 7 && val < 20) ? 8 : val - 12;
+       val = (val >= 20) ? val - 12 : ((val > 7) ? 8 : val);
        val <<= info->vol_shift;
        mask = ((1 << info->vol_nbits) - 1)  << info->vol_shift;
 
@@ -331,7 +331,7 @@ static int da9034_get_ldo12_voltage(struct regulator_dev *rdev)
 static int da9034_list_ldo12_voltage(struct regulator_dev *rdev,
                                     unsigned selector)
 {
-       if (selector > ARRAY_SIZE(da9034_ldo12_data))
+       if (selector >= ARRAY_SIZE(da9034_ldo12_data))
                return -EINVAL;
        return da9034_ldo12_data[selector] * 1000;
 }