Re: [Patch 5/11] Regulator: DA9052 regulator support v1

From: Mark Brown
Date: Tue Jun 28 2011 - 12:09:05 EST


On Mon, Jun 27, 2011 at 02:12:37PM +0530, ashishj3 wrote:

> +static int da9052_dcdc_set_current_limit(struct regulator_dev *rdev, int min_uA,
> + int max_uA)
> +{
> + struct da9052_regulator *regulator = rdev_get_drvdata(rdev);
> + int offset = rdev_get_id(rdev);
> + int reg_val;
> +
> + if (min_uA > 1200000 || max_uA > 1200000)
> + return -EINVAL;
> +
> + if (min_uA == 700)
> + reg_val = DA9052_BUCK_CURRENT_LIMIT_700mA;
> + else if (min_uA <= 800)
> + reg_val = DA9052_BUCK_CURRENT_LIMIT_800mA;
> + else if (min_uA <= 1000)
> + reg_val = DA9052_BUCK_CURRENT_LIMIT_1000mA;
> + else if (min_uA <= 1200)
> + reg_val = DA9052_BUCK_CURRENT_LIMIT_1200mA;

What if min_uA is less than 700?

Otherwise this looks reasonable - very much better!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/