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: next-20120816~42^2~4^2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3f1965776f6ec769192400810b6260fe48301bbb;p=karo-tx-linux.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