Skip to content

Commit 907af7d

Browse files
Mani-Sadhasivambroonie
authored andcommitted
regulator: Move OF_ API declarations/definitions outside CONFIG_REGULATOR
Since these are hidden inside CONFIG_REGULATOR, building the consumer drivers without CONFIG_REGULATOR will result in the following build error: >> drivers/pci/pwrctrl/slot.c:39:15: error: implicit declaration of function 'of_regulator_bulk_get_all'; did you mean 'regulator_bulk_get'? [-Werror=implicit-function-declaration] 39 | ret = of_regulator_bulk_get_all(dev, dev_of_node(dev), | ^~~~~~~~~~~~~~~~~~~~~~~~~ | regulator_bulk_get cc1: some warnings being treated as errors This also removes the duplicated definitions that were possibly added to fix the build issues. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Fixes: 27b9ecc ("regulator: Add of_regulator_bulk_get_all") Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 1156b5e commit 907af7d

File tree

1 file changed

+32
-46
lines changed

1 file changed

+32
-46
lines changed

include/linux/regulator/consumer.h

Lines changed: 32 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -168,38 +168,6 @@ int devm_regulator_get_enable_read_voltage(struct device *dev, const char *id);
168168
void regulator_put(struct regulator *regulator);
169169
void devm_regulator_put(struct regulator *regulator);
170170

171-
#if IS_ENABLED(CONFIG_OF)
172-
struct regulator *__must_check of_regulator_get_optional(struct device *dev,
173-
struct device_node *node,
174-
const char *id);
175-
struct regulator *__must_check devm_of_regulator_get_optional(struct device *dev,
176-
struct device_node *node,
177-
const char *id);
178-
int __must_check of_regulator_bulk_get_all(struct device *dev, struct device_node *np,
179-
struct regulator_bulk_data **consumers);
180-
#else
181-
static inline struct regulator *__must_check of_regulator_get_optional(struct device *dev,
182-
struct device_node *node,
183-
const char *id)
184-
{
185-
return ERR_PTR(-ENODEV);
186-
}
187-
188-
static inline struct regulator *__must_check devm_of_regulator_get_optional(struct device *dev,
189-
struct device_node *node,
190-
const char *id)
191-
{
192-
return ERR_PTR(-ENODEV);
193-
}
194-
195-
static inline int of_regulator_bulk_get_all(struct device *dev, struct device_node *np,
196-
struct regulator_bulk_data **consumers)
197-
{
198-
return 0;
199-
}
200-
201-
#endif
202-
203171
int regulator_register_supply_alias(struct device *dev, const char *id,
204172
struct device *alias_dev,
205173
const char *alias_id);
@@ -380,20 +348,6 @@ devm_regulator_get_optional(struct device *dev, const char *id)
380348
return ERR_PTR(-ENODEV);
381349
}
382350

383-
static inline struct regulator *__must_check of_regulator_get_optional(struct device *dev,
384-
struct device_node *node,
385-
const char *id)
386-
{
387-
return ERR_PTR(-ENODEV);
388-
}
389-
390-
static inline struct regulator *__must_check devm_of_regulator_get_optional(struct device *dev,
391-
struct device_node *node,
392-
const char *id)
393-
{
394-
return ERR_PTR(-ENODEV);
395-
}
396-
397351
static inline void regulator_put(struct regulator *regulator)
398352
{
399353
}
@@ -701,6 +655,38 @@ regulator_is_equal(struct regulator *reg1, struct regulator *reg2)
701655
}
702656
#endif
703657

658+
#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_REGULATOR)
659+
struct regulator *__must_check of_regulator_get_optional(struct device *dev,
660+
struct device_node *node,
661+
const char *id);
662+
struct regulator *__must_check devm_of_regulator_get_optional(struct device *dev,
663+
struct device_node *node,
664+
const char *id);
665+
int __must_check of_regulator_bulk_get_all(struct device *dev, struct device_node *np,
666+
struct regulator_bulk_data **consumers);
667+
#else
668+
static inline struct regulator *__must_check of_regulator_get_optional(struct device *dev,
669+
struct device_node *node,
670+
const char *id)
671+
{
672+
return ERR_PTR(-ENODEV);
673+
}
674+
675+
static inline struct regulator *__must_check devm_of_regulator_get_optional(struct device *dev,
676+
struct device_node *node,
677+
const char *id)
678+
{
679+
return ERR_PTR(-ENODEV);
680+
}
681+
682+
static inline int of_regulator_bulk_get_all(struct device *dev, struct device_node *np,
683+
struct regulator_bulk_data **consumers)
684+
{
685+
return 0;
686+
}
687+
688+
#endif
689+
704690
static inline int regulator_set_voltage_triplet(struct regulator *regulator,
705691
int min_uV, int target_uV,
706692
int max_uV)

0 commit comments

Comments
 (0)