From: Shawn Guo Date: Sun, 5 Aug 2012 15:05:20 +0000 (+0800) Subject: regulator: add a new API regulator_set_voltage_tol() X-Git-Tag: firefly_0821_release~3680^2~2008^2^4 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3f1965776f6ec769192400810b6260fe48301bbb;p=firefly-linux-kernel-4.4.55.git regulator: add a new API regulator_set_voltage_tol() There are some use cases where a voltage range could be reasonably specified by a target voltage and tolerance. Add a new API regulator_set_voltage_tol() wrapping regulator_set_voltage() call to ease the users. Signed-off-by: Shawn Guo Signed-off-by: Mark Brown --- diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index da339fd8c755..21603524bdb2 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -352,4 +352,11 @@ static inline void regulator_set_drvdata(struct regulator *regulator, #endif +static inline int regulator_set_voltage_tol(struct regulator *regulator, + int new_uV, int tol_uV) +{ + return regulator_set_voltage(regulator, + new_uV - tol_uV, new_uV + tol_uV); +} + #endif