diff options
| author | Ulf Hansson <ulf.hansson@linaro.org> | 2024-10-02 13:20:16 +0300 |
|---|---|---|
| committer | Ulf Hansson <ulf.hansson@linaro.org> | 2024-10-02 13:20:16 +0300 |
| commit | 576cc535ce4ea85e900384766c4cb113750d4b69 (patch) | |
| tree | 8dd66f4ddf330f858e07e1041f73c891c081a5b2 /include/linux | |
| parent | eb8333673e1ebc2418980b664a84c91b4e98afc4 (diff) | |
| parent | 36ec3f437227470568e5f460997f367f5446a34d (diff) | |
| download | linux-576cc535ce4ea85e900384766c4cb113750d4b69.tar.xz | |
Merge tag 'regulator-of-get-optional' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
regulator: Add of_regulator_get_optional() APIs
Add of_regulator_get_optional() APIs, which can be used by generic code
to improve integration of regulator management helpers for their users.
Merge this into the pmdomain tree to allow new users to be added.
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/regulator/consumer.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index b9ce521910a0..8c3c372ad735 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -168,6 +168,29 @@ int devm_regulator_get_enable_read_voltage(struct device *dev, const char *id); void regulator_put(struct regulator *regulator); void devm_regulator_put(struct regulator *regulator); +#if IS_ENABLED(CONFIG_OF) +struct regulator *__must_check of_regulator_get_optional(struct device *dev, + struct device_node *node, + const char *id); +struct regulator *__must_check devm_of_regulator_get_optional(struct device *dev, + struct device_node *node, + const char *id); +#else +static inline struct regulator *__must_check of_regulator_get_optional(struct device *dev, + struct device_node *node, + const char *id) +{ + return ERR_PTR(-ENODEV); +} + +static inline struct regulator *__must_check devm_of_regulator_get_optional(struct device *dev, + struct device_node *node, + const char *id) +{ + return ERR_PTR(-ENODEV); +} +#endif + int regulator_register_supply_alias(struct device *dev, const char *id, struct device *alias_dev, const char *alias_id); @@ -350,6 +373,20 @@ devm_regulator_get_optional(struct device *dev, const char *id) return ERR_PTR(-ENODEV); } +static inline struct regulator *__must_check of_regulator_get_optional(struct device *dev, + struct device_node *node, + const char *id) +{ + return ERR_PTR(-ENODEV); +} + +static inline struct regulator *__must_check devm_of_regulator_get_optional(struct device *dev, + struct device_node *node, + const char *id) +{ + return ERR_PTR(-ENODEV); +} + static inline void regulator_put(struct regulator *regulator) { } |
