For s2mpg1x, enable-gpios is optional, but when not given, the driver
is complaining quite verbosely about the missing property.
Refactor the code slightly to avoid printing those messages to the
kernel log in that case.
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
drivers/regulator/s2mps11.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 178a032c0dc192874118906aee45441a1bbd8515..2d5510acd0780ab6f9296c48ddcde5efe15ff488 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -352,7 +352,7 @@ static int s2mps11_regulator_set_suspend_disable(struct regulator_dev *rdev)
}
static int s2mps11_of_parse_gpiod(struct device_node *np,
- const char *con_id,
+ const char *con_id, bool optional,
const struct regulator_desc *desc,
struct regulator_config *config)
{
@@ -371,14 +371,19 @@ static int s2mps11_of_parse_gpiod(struct device_node *np,
if (ret == -EPROBE_DEFER)
return ret;
- if (ret == -ENOENT)
+ if (ret == -ENOENT) {
+ if (optional)
+ return 0;
+
dev_info(config->dev,
"No entry for control GPIO for %d/%s in node %pOF\n",
desc->id, desc->name, np);
- else
+ } else {
dev_warn_probe(config->dev, ret,
"Failed to get control GPIO for %d/%s in node %pOF\n",
desc->id, desc->name, np);
+ }
+
return 0;
}
@@ -409,7 +414,8 @@ static int s2mps11_of_parse_cb(struct device_node *np,
else
return 0;
- return s2mps11_of_parse_gpiod(np, "samsung,ext-control", desc, config);
+ return s2mps11_of_parse_gpiod(np, "samsung,ext-control", false, desc,
+ config);
}
static int s2mpg10_of_parse_cb(struct device_node *np,
@@ -528,7 +534,7 @@ static int s2mpg10_of_parse_cb(struct device_node *np,
++s2mpg10_desc->desc.ops;
- return s2mps11_of_parse_gpiod(np, "enable", desc, config);
+ return s2mps11_of_parse_gpiod(np, "enable", true, desc, config);
}
static int s2mpg10_enable_ext_control(struct s2mps11_info *s2mps11,
--
2.52.0.351.gbe84eed79e-goog