Commit 7dda20c9 authored by Rob Herring's avatar Rob Herring Committed by Mark Brown

regulator: Use of_property_present() for testing DT property presence

It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties. As
part of this, convert of_get_property/of_find_property calls to the
recently added of_property_present() helper when we just want to test
for presence of a property and nothing more.
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230310144721.1544756-1-robh@kernel.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4eb6678a
......@@ -201,10 +201,10 @@ static int buck12_set_hw_dvs_levels(struct device_node *np,
data = container_of(desc, struct bd71815_regulator, desc);
if (of_find_property(np, "rohm,dvs-run-voltage", NULL) ||
of_find_property(np, "rohm,dvs-suspend-voltage", NULL) ||
of_find_property(np, "rohm,dvs-lpsr-voltage", NULL) ||
of_find_property(np, "rohm,dvs-snvs-voltage", NULL)) {
if (of_property_present(np, "rohm,dvs-run-voltage") ||
of_property_present(np, "rohm,dvs-suspend-voltage") ||
of_property_present(np, "rohm,dvs-lpsr-voltage") ||
of_property_present(np, "rohm,dvs-snvs-voltage")) {
ret = regmap_read(cfg->regmap, desc->vsel_reg, &val);
if (ret)
return ret;
......
......@@ -151,7 +151,7 @@ of_get_fixed_voltage_config(struct device *dev,
of_property_read_u32(np, "startup-delay-us", &config->startup_delay);
of_property_read_u32(np, "off-on-delay-us", &config->off_on_delay);
if (of_find_property(np, "vin-supply", NULL))
if (of_property_present(np, "vin-supply"))
config->input_supply = "vin";
return config;
......
......@@ -220,7 +220,7 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np,
regtype);
}
if (of_find_property(np, "vin-supply", NULL))
if (of_property_present(np, "vin-supply"))
config->input_supply = "vin";
return config;
......
......@@ -334,7 +334,7 @@ static int pwm_regulator_probe(struct platform_device *pdev)
memcpy(&drvdata->desc, &pwm_regulator_desc, sizeof(drvdata->desc));
if (of_find_property(np, "voltage-table", NULL))
if (of_property_present(np, "voltage-table"))
ret = pwm_regulator_init_table(pdev, drvdata);
else
ret = pwm_regulator_init_continuous(pdev, drvdata);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment