Messages in this thread Patch in this message | | | From | Stephen Warren <> | Subject | [PATCH V2 2/3] regulator: add regulator_get_voltage_fixed helper op | Date | Wed, 8 Aug 2012 15:18:46 -0600 |
| |
From: Stephen Warren <swarren@nvidia.com>
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 <swarren@nvidia.com> --- 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
| |