diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-26 11:07:46 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-26 11:07:46 -0500 |
commit | e8f00041a65d0d67b54843b3c93f229f6ba917f6 (patch) | |
tree | 013db745705b348c23731c17eec444a55010dedc /include | |
parent | 88e339541d28153b6d2bfad9b25b3462fcd2bcaa (diff) | |
parent | e6e740304aa2a49ef09497e6c0bb906ed7987f6b (diff) |
Merge tag 'topic/devm' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into HEAD
Provide managed versions of regulator_get() and regulator_bulk_get(),
saving code in error handling and cleanup paths by ensuring that that
the regulators will be automatically unregistered when the device is
unregistered.
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/regulator/consumer.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index f2698a0edfc4..35c42834ba3d 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
@@ -132,9 +132,12 @@ 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); |
140 | void devm_regulator_free(struct regulator *regulator); | ||
138 | 141 | ||
139 | /* regulator output control and status */ | 142 | /* regulator output control and status */ |
140 | int regulator_enable(struct regulator *regulator); | 143 | int regulator_enable(struct regulator *regulator); |
@@ -145,6 +148,8 @@ int regulator_disable_deferred(struct regulator *regulator, int ms); | |||
145 | 148 | ||
146 | int regulator_bulk_get(struct device *dev, int num_consumers, | 149 | int regulator_bulk_get(struct device *dev, int num_consumers, |
147 | struct regulator_bulk_data *consumers); | 150 | struct regulator_bulk_data *consumers); |
151 | int devm_regulator_bulk_get(struct device *dev, int num_consumers, | ||
152 | struct regulator_bulk_data *consumers); | ||
148 | int regulator_bulk_enable(int num_consumers, | 153 | int regulator_bulk_enable(int num_consumers, |
149 | struct regulator_bulk_data *consumers); | 154 | struct regulator_bulk_data *consumers); |
150 | int regulator_bulk_disable(int num_consumers, | 155 | int regulator_bulk_disable(int num_consumers, |
@@ -200,6 +205,13 @@ static inline struct regulator *__must_check regulator_get(struct device *dev, | |||
200 | */ | 205 | */ |
201 | return NULL; | 206 | return NULL; |
202 | } | 207 | } |
208 | |||
209 | static inline struct regulator *__must_check | ||
210 | devm_regulator_get(struct device *dev, const char *id) | ||
211 | { | ||
212 | return NULL; | ||
213 | } | ||
214 | |||
203 | static inline void regulator_put(struct regulator *regulator) | 215 | static inline void regulator_put(struct regulator *regulator) |
204 | { | 216 | { |
205 | } | 217 | } |