diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2012-01-17 03:39:58 (GMT) |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-20 12:02:55 (GMT) |
commit | 070b9079226d4f3e3e7c9f4eb81f2e02e7d99572 (patch) | |
tree | 312b92136c28a321624bb811b43e8b03a03660ec /include/linux/regulator | |
parent | dcd6c92267155e70a94b3927bce681ce74b80d1f (diff) | |
download | linux-fsl-qoriq-070b9079226d4f3e3e7c9f4eb81f2e02e7d99572.tar.xz |
regulator: Add devm_regulator_get()
Add a resource managed regulator_get() to simplify regulator
usage in drivers. This allows driver authors to "get and forget"
about their regulators by automatically calling regulator_put()
when the driver is detached.
[Fixed up a couple of coding style issues -- broonie]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/linux/regulator')
-rw-r--r-- | include/linux/regulator/consumer.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index f2698a0..bcfe106 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -132,6 +132,8 @@ struct regulator_bulk_data { /* regulator get and put */ struct regulator *__must_check regulator_get(struct device *dev, const char *id); +struct regulator *__must_check devm_regulator_get(struct device *dev, + const char *id); struct regulator *__must_check regulator_get_exclusive(struct device *dev, const char *id); void regulator_put(struct regulator *regulator); @@ -200,6 +202,13 @@ static inline struct regulator *__must_check regulator_get(struct device *dev, */ return NULL; } + +static inline struct regulator *__must_check +devm_regulator_get(struct device *dev, const char *id) +{ + return NULL; +} + static inline void regulator_put(struct regulator *regulator) { } |