diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2012-01-16 22:39:58 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-20 07:02:55 -0500 |
commit | 070b9079226d4f3e3e7c9f4eb81f2e02e7d99572 (patch) | |
tree | 312b92136c28a321624bb811b43e8b03a03660ec /include/linux/regulator | |
parent | dcd6c92267155e70a94b3927bce681ce74b80d1f (diff) |
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 f2698a0edfc4..bcfe10658763 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
@@ -132,6 +132,8 @@ struct regulator_bulk_data { | |||
132 | /* regulator get and put */ | 132 | /* regulator get and put */ |
133 | struct regulator *__must_check regulator_get(struct device *dev, | 133 | struct regulator *__must_check regulator_get(struct device *dev, |
134 | const char *id); | 134 | const char *id); |
135 | struct regulator *__must_check devm_regulator_get(struct device *dev, | ||
136 | const char *id); | ||
135 | struct regulator *__must_check regulator_get_exclusive(struct device *dev, | 137 | struct regulator *__must_check regulator_get_exclusive(struct device *dev, |
136 | const char *id); | 138 | const char *id); |
137 | void regulator_put(struct regulator *regulator); | 139 | void regulator_put(struct regulator *regulator); |
@@ -200,6 +202,13 @@ static inline struct regulator *__must_check regulator_get(struct device *dev, | |||
200 | */ | 202 | */ |
201 | return NULL; | 203 | return NULL; |
202 | } | 204 | } |
205 | |||
206 | static inline struct regulator *__must_check | ||
207 | devm_regulator_get(struct device *dev, const char *id) | ||
208 | { | ||
209 | return NULL; | ||
210 | } | ||
211 | |||
203 | static inline void regulator_put(struct regulator *regulator) | 212 | static inline void regulator_put(struct regulator *regulator) |
204 | { | 213 | { |
205 | } | 214 | } |