regulator: Fixes for v6.13

A couple of fixes for !REGULATOR and !OF configurations, adding missing
 stubs.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmeBIlEACgkQJNaLcl1U
 h9C1+Af+IvpAPawwRsgekhmf52h+JGENn03h+xEbAWBvktqdqAHjgotUSJpe407o
 kOgkC2NhyQxdYL2CgXz5JF27BxwvylFjjkq+cog9S0+2Ijzr3WQTamE6JAaG/9Vb
 Fb5YiIqLW++OS/DlMbxOTSXZEY+DVW8g4JuHb/A0wGGDVM7G+d0SW1UavFbvQYCg
 e5aKI/7XrnLBRREBJYDg2P3Tm/439klgSlMo1hAzOLn5epCmoPgUy4eMBWPgTgY/
 mqAsh64BnrPOa0T2Rb0IivLcN3wKOtdNl/phlE/t+svk3etifR3cvy8710iW4y3M
 kOcinhj1SRcbDCPTupssj5tyCoGMMw==
 =fShQ
 -----END PGP SIGNATURE-----

Merge tag 'regulator-fix-v6.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fixes from Mark Brown:
 "A couple of fixes for !REGULATOR and !OF configurations, adding
  missing stubs"

* tag 'regulator-fix-v6.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: Move OF_ API declarations/definitions outside CONFIG_REGULATOR
  regulator: Guard of_regulator_bulk_get_all() with CONFIG_OF
This commit is contained in:
Linus Torvalds 2025-01-10 08:05:32 -08:00
commit b999e7f92e

View File

@ -168,29 +168,6 @@ 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);
@ -223,8 +200,6 @@ int regulator_disable_deferred(struct regulator *regulator, int ms);
int __must_check regulator_bulk_get(struct device *dev, int num_consumers,
struct regulator_bulk_data *consumers);
int __must_check of_regulator_bulk_get_all(struct device *dev, struct device_node *np,
struct regulator_bulk_data **consumers);
int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers,
struct regulator_bulk_data *consumers);
void devm_regulator_bulk_put(struct regulator_bulk_data *consumers);
@ -373,20 +348,6 @@ 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)
{
}
@ -483,12 +444,6 @@ static inline int devm_regulator_bulk_get(struct device *dev, int num_consumers,
return 0;
}
static inline int of_regulator_bulk_get_all(struct device *dev, struct device_node *np,
struct regulator_bulk_data **consumers)
{
return 0;
}
static inline int devm_regulator_bulk_get_const(
struct device *dev, int num_consumers,
const struct regulator_bulk_data *in_consumers,
@ -700,6 +655,38 @@ regulator_is_equal(struct regulator *reg1, struct regulator *reg2)
}
#endif
#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_REGULATOR)
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);
int __must_check of_regulator_bulk_get_all(struct device *dev, struct device_node *np,
struct regulator_bulk_data **consumers);
#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);
}
static inline int of_regulator_bulk_get_all(struct device *dev, struct device_node *np,
struct regulator_bulk_data **consumers)
{
return 0;
}
#endif
static inline int regulator_set_voltage_triplet(struct regulator *regulator,
int min_uV, int target_uV,
int max_uV)