From 4a682922817fde4d82fed4303dc902c29d7b2e4e Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 9 Feb 2012 13:26:13 +0000 Subject: [PATCH] regulator: Complain if a voltage range is specified but can't be used It doesn't make much sense to specify a range of voltages consumers can use if they haven't been given permission to change the voltage. Log if this happens, probably the user forgot to specify CHANGE_VOLTAGE. Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- drivers/regulator/core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index e3271daa3ab9..9a143aebb84b 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -805,6 +805,11 @@ static void print_constraints(struct regulator_dev *rdev) count += sprintf(buf + count, "standby"); rdev_info(rdev, "%s\n", buf); + + if ((constraints->min_uV != constraints->max_uV) && + !(constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) + rdev_warn(rdev, + "Voltage range but no REGULATOR_CHANGE_VOLTAGE\n"); } static int machine_constraints_voltage(struct regulator_dev *rdev, -- 2.39.5