From: Stephen Warren <[email protected]> Fixed regulators always output desc->min_uV. Add a helper get_voltage op to save duplicating this code in drivers.
Signed-off-by: Stephen Warren <[email protected]> --- v2: New patch drivers/regulator/core.c | 14 ++++++++++++++ include/linux/regulator/driver.h | 1 + 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 457be22..c0129bf 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1973,6 +1973,20 @@ int regulator_is_supported_voltage(struct regulator *regulator, EXPORT_SYMBOL_GPL(regulator_is_supported_voltage); /** + * regulator_get_voltage_fixed - standard get_voltage for fixed regulators + * + * @rdev: regulator to operate on + * + * Fixed regulators can use this as their get_voltage operation, saving + * some code. + */ +int regulator_get_voltage_fixed(struct regulator_dev *rdev) +{ + return rdev->desc->min_uV; +} +EXPORT_SYMBOL_GPL(regulator_get_voltage_fixed); + +/** * regulator_get_voltage_sel_regmap - standard get_voltage_sel for regmap users * * @rdev: regulator to operate on diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 2c40c86..aa0145a 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -306,6 +306,7 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev, int min_uV, int max_uV); int regulator_map_voltage_iterate(struct regulator_dev *rdev, int min_uV, int max_uV); +int regulator_get_voltage_fixed(struct regulator_dev *rdev); int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev); int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel); int regulator_is_enabled_regmap(struct regulator_dev *rdev); -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

