[PATCH] regulator: core: Fix build errors
From: Maciej Purski
Date: Mon Mar 05 2018 - 08:03:59 EST
Build errors detected by kbuild test robot occur on non-of
architectures.
This patch fixes this behavior as well as using plain integer instead
of NULL in of_count_phandle_with_args().
Fixes: 0c55103 ("regulator: core: Parse coupled regulators properties")
Signed-off-by: Maciej Purski <m.purski@xxxxxxxxxxx>
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
---
drivers/regulator/internal.h | 34 ++++++++++++++++++++++++++--------
drivers/regulator/of_regulator.c | 5 +++--
2 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/drivers/regulator/internal.h b/drivers/regulator/internal.h
index f253a47b9a99..485db15bee99 100644
--- a/drivers/regulator/internal.h
+++ b/drivers/regulator/internal.h
@@ -63,6 +63,14 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
const struct regulator_desc *desc,
struct regulator_config *config,
struct device_node **node);
+
+struct regulator_dev *of_parse_coupled_regulator(struct regulator_dev *rdev,
+ int index);
+
+int of_get_n_coupled(struct regulator_dev *rdev);
+
+bool of_check_coupling_data(struct regulator_dev *rdev);
+
#else
static inline struct regulator_init_data *
regulator_of_get_init_data(struct device *dev,
@@ -72,8 +80,25 @@ regulator_of_get_init_data(struct device *dev,
{
return NULL;
}
-#endif
+static inline struct regulator_dev *
+of_parse_coupled_regulator(struct regulator_dev *rdev,
+ int index)
+{
+ return NULL;
+}
+
+static inline int of_get_n_coupled(struct regulator_dev *rdev)
+{
+ return 0;
+}
+
+static inline bool of_check_coupling_data(struct regulator_dev *rdev)
+{
+ return false;
+}
+
+#endif
enum regulator_get_type {
NORMAL_GET,
EXCLUSIVE_GET,
@@ -83,11 +108,4 @@ enum regulator_get_type {
struct regulator *_regulator_get(struct device *dev, const char *id,
enum regulator_get_type get_type);
-
-struct regulator_dev *of_parse_coupled_regulator(struct regulator_dev *rdev,
- int index);
-
-int of_get_n_coupled(struct regulator_dev *rdev);
-
-bool of_check_coupling_data(struct regulator_dev *rdev);
#endif
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index a2eb9046adf8..98ee098e8c35 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -434,7 +434,8 @@ static bool of_coupling_find_node(struct device_node *src,
bool found = false;
n_phandles = of_count_phandle_with_args(src,
- "regulator-coupled-with", 0);
+ "regulator-coupled-with",
+ NULL);
for (i = 0; i < n_phandles; i++) {
struct device_node *tmp = of_parse_phandle(src,
@@ -495,7 +496,7 @@ bool of_check_coupling_data(struct regulator_dev *rdev)
c_n_phandles = of_count_phandle_with_args(c_node,
"regulator-coupled-with",
- 0);
+ NULL);
if (c_n_phandles != n_phandles) {
dev_err(&rdev->dev, "number of couped reg phandles mismatch\n");
--
2.16.2