diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-26 16:07:46 +0000 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-26 16:07:46 +0000 |
commit | e8f00041a65d0d67b54843b3c93f229f6ba917f6 (patch) | |
tree | 013db745705b348c23731c17eec444a55010dedc /include | |
parent | 88e339541d28153b6d2bfad9b25b3462fcd2bcaa (diff) | |
parent | e6e740304aa2a49ef09497e6c0bb906ed7987f6b (diff) | |
download | linux-e8f00041a65d0d67b54843b3c93f229f6ba917f6.tar.bz2 |
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 { /* 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); +void devm_regulator_free(struct regulator *regulator); /* regulator output control and status */ int regulator_enable(struct regulator *regulator); @@ -145,6 +148,8 @@ int regulator_disable_deferred(struct regulator *regulator, int ms); int regulator_bulk_get(struct device *dev, int num_consumers, struct regulator_bulk_data *consumers); +int devm_regulator_bulk_get(struct device *dev, int num_consumers, + struct regulator_bulk_data *consumers); int regulator_bulk_enable(int num_consumers, struct regulator_bulk_data *consumers); int regulator_bulk_disable(int num_consumers, @@ -200,6 +205,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) { } |