From e277e656804c85a0729d4fd8cdd3c8ab3e6b3b86 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 11 Oct 2013 09:30:24 +0800 Subject: regulator: Remove max_uV from struct regulator_linear_range linear ranges means each range has linear voltage settings. So we can calculate max_uV for each linear range in regulator core rather than set the max_uV field in drivers. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/helpers.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/regulator/helpers.c') diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c index 6e30df1..e221a27 100644 --- a/drivers/regulator/helpers.c +++ b/drivers/regulator/helpers.c @@ -284,9 +284,13 @@ int regulator_map_voltage_linear_range(struct regulator_dev *rdev, } for (i = 0; i < rdev->desc->n_linear_ranges; i++) { + int linear_max_uV; + range = &rdev->desc->linear_ranges[i]; + linear_max_uV = range->min_uV + + (range->max_sel - range->min_sel) * range->uV_step; - if (!(min_uV <= range->max_uV && max_uV >= range->min_uV)) + if (!(min_uV <= linear_max_uV && max_uV >= range->min_uV)) continue; if (min_uV <= range->min_uV) -- cgit v1.1