diff options
| author | Daniel Almeida <daniel.almeida@collabora.com> | 2025-09-10 14:54:32 -0300 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2025-09-10 21:02:16 +0100 |
| commit | 2e0fd4583d0efcdc260e61a22666c8368f505353 (patch) | |
| tree | ef51d84e47875f49c467c6f55a94bd98c3745323 /rust/helpers/regulator.c | |
| parent | b87ecbc54f22382ace1cf41645e8652a4ce44d52 (diff) | |
rust: regulator: add devm_enable and devm_enable_optional
A lot of drivers only care about enabling the regulator for as long as
the underlying Device is bound. This can be easily observed due to the
extensive use of `devm_regulator_get_enable` and
`devm_regulator_get_enable_optional` throughout the kernel.
Therefore, make this helper available in Rust. Also add an example
noting how it should be the default API unless the driver needs more
fine-grained control over the regulator.
Suggested-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>
Link: https://patch.msgid.link/20250910-regulator-remove-dynamic-v3-2-07af4dfa97cc@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'rust/helpers/regulator.c')
| -rw-r--r-- | rust/helpers/regulator.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/rust/helpers/regulator.c b/rust/helpers/regulator.c index cd8b7ba648ee..11bc332443bd 100644 --- a/rust/helpers/regulator.c +++ b/rust/helpers/regulator.c @@ -40,4 +40,14 @@ int rust_helper_regulator_is_enabled(struct regulator *regulator) return regulator_is_enabled(regulator); } +int rust_helper_devm_regulator_get_enable(struct device *dev, const char *id) +{ + return devm_regulator_get_enable(dev, id); +} + +int rust_helper_devm_regulator_get_enable_optional(struct device *dev, const char *id) +{ + return devm_regulator_get_enable_optional(dev, id); +} + #endif |
