xref: /linux/rust/helpers/regulator.c (revision 37a93dd5c49b5fda807fd204edf2547c3493319c)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <linux/regulator/consumer.h>
4 
5 #ifndef CONFIG_REGULATOR
6 
7 __rust_helper void rust_helper_regulator_put(struct regulator *regulator)
8 {
9 	regulator_put(regulator);
10 }
11 
12 __rust_helper int rust_helper_regulator_set_voltage(struct regulator *regulator,
13 						    int min_uV, int max_uV)
14 {
15 	return regulator_set_voltage(regulator, min_uV, max_uV);
16 }
17 
18 __rust_helper int rust_helper_regulator_get_voltage(struct regulator *regulator)
19 {
20 	return regulator_get_voltage(regulator);
21 }
22 
23 __rust_helper struct regulator *rust_helper_regulator_get(struct device *dev,
24 							  const char *id)
25 {
26 	return regulator_get(dev, id);
27 }
28 
29 __rust_helper int rust_helper_regulator_enable(struct regulator *regulator)
30 {
31 	return regulator_enable(regulator);
32 }
33 
34 __rust_helper int rust_helper_regulator_disable(struct regulator *regulator)
35 {
36 	return regulator_disable(regulator);
37 }
38 
39 __rust_helper int rust_helper_regulator_is_enabled(struct regulator *regulator)
40 {
41 	return regulator_is_enabled(regulator);
42 }
43 
44 __rust_helper int rust_helper_devm_regulator_get_enable(struct device *dev,
45 							const char *id)
46 {
47 	return devm_regulator_get_enable(dev, id);
48 }
49 
50 __rust_helper int
51 rust_helper_devm_regulator_get_enable_optional(struct device *dev,
52 					       const char *id)
53 {
54 	return devm_regulator_get_enable_optional(dev, id);
55 }
56 
57 #endif
58