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>
This commit is contained in:
@@ -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)
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user