regulator: Use of_property_read_bool() for boolean properties

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.
Convert reading boolean properties to to of_property_read_bool().

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230310144722.1544843-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Rob Herring 2023-03-10 08:47:22 -06:00 committed by Mark Brown
parent 7dda20c97f
commit 5bd73a162b
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
7 changed files with 17 additions and 36 deletions

View File

@ -832,8 +832,7 @@ static struct lp872x_platform_data
return ERR_PTR(-ENOMEM);
of_property_read_u8(np, "ti,general-config", &pdata->general_config);
if (of_find_property(np, "ti,update-config", NULL))
pdata->update_config = true;
pdata->update_config = of_property_read_bool(np, "ti,update-config");
pdata->dvs = devm_kzalloc(dev, sizeof(struct lp872x_dvs), GFP_KERNEL);
if (!pdata->dvs)

View File

@ -943,14 +943,9 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev,
}
of_node_put(regulators_np);
if (of_get_property(pmic_np, "max8997,pmic-buck1-uses-gpio-dvs", NULL))
pdata->buck1_gpiodvs = true;
if (of_get_property(pmic_np, "max8997,pmic-buck2-uses-gpio-dvs", NULL))
pdata->buck2_gpiodvs = true;
if (of_get_property(pmic_np, "max8997,pmic-buck5-uses-gpio-dvs", NULL))
pdata->buck5_gpiodvs = true;
pdata->buck1_gpiodvs = of_property_read_bool(pmic_np, "max8997,pmic-buck1-uses-gpio-dvs");
pdata->buck2_gpiodvs = of_property_read_bool(pmic_np, "max8997,pmic-buck2-uses-gpio-dvs");
pdata->buck5_gpiodvs = of_property_read_bool(pmic_np, "max8997,pmic-buck5-uses-gpio-dvs");
if (pdata->buck1_gpiodvs || pdata->buck2_gpiodvs ||
pdata->buck5_gpiodvs) {

View File

@ -618,8 +618,7 @@ static int max8998_pmic_dt_parse_pdata(struct max8998_dev *iodev,
if (ret)
return -EINVAL;
if (of_find_property(pmic_np, "max8998,pmic-buck-voltage-lock", NULL))
pdata->buck_voltage_lock = true;
pdata->buck_voltage_lock = of_property_read_bool(pmic_np, "max8998,pmic-buck-voltage-lock");
ret = of_property_read_u32(pmic_np,
"max8998,pmic-buck1-default-dvs-idx",

View File

@ -605,7 +605,7 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
of_node_put(regulators_np);
if (of_get_property(pmic_np, "s5m8767,pmic-buck2-uses-gpio-dvs", NULL)) {
if (of_property_read_bool(pmic_np, "s5m8767,pmic-buck2-uses-gpio-dvs")) {
pdata->buck2_gpiodvs = true;
if (of_property_read_u32_array(pmic_np,
@ -616,7 +616,7 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
}
}
if (of_get_property(pmic_np, "s5m8767,pmic-buck3-uses-gpio-dvs", NULL)) {
if (of_property_read_bool(pmic_np, "s5m8767,pmic-buck3-uses-gpio-dvs")) {
pdata->buck3_gpiodvs = true;
if (of_property_read_u32_array(pmic_np,
@ -627,7 +627,7 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
}
}
if (of_get_property(pmic_np, "s5m8767,pmic-buck4-uses-gpio-dvs", NULL)) {
if (of_property_read_bool(pmic_np, "s5m8767,pmic-buck4-uses-gpio-dvs")) {
pdata->buck4_gpiodvs = true;
if (of_property_read_u32_array(pmic_np,
@ -661,14 +661,9 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
if (ret)
return -EINVAL;
if (of_get_property(pmic_np, "s5m8767,pmic-buck2-ramp-enable", NULL))
pdata->buck2_ramp_enable = true;
if (of_get_property(pmic_np, "s5m8767,pmic-buck3-ramp-enable", NULL))
pdata->buck3_ramp_enable = true;
if (of_get_property(pmic_np, "s5m8767,pmic-buck4-ramp-enable", NULL))
pdata->buck4_ramp_enable = true;
pdata->buck2_ramp_enable = of_property_read_bool(pmic_np, "s5m8767,pmic-buck2-ramp-enable");
pdata->buck3_ramp_enable = of_property_read_bool(pmic_np, "s5m8767,pmic-buck3-ramp-enable");
pdata->buck4_ramp_enable = of_property_read_bool(pmic_np, "s5m8767,pmic-buck4-ramp-enable");
if (pdata->buck2_ramp_enable || pdata->buck3_ramp_enable
|| pdata->buck4_ramp_enable) {

View File

@ -576,7 +576,7 @@ static int stpmic1_regulator_register(struct platform_device *pdev, int id,
}
/* set mask reset */
if (of_get_property(config.of_node, "st,mask-reset", NULL) &&
if (of_property_read_bool(config.of_node, "st,mask-reset") &&
cfg->mask_reset_reg != 0) {
ret = regmap_update_bits(pmic_dev->regmap,
cfg->mask_reset_reg,

View File

@ -296,17 +296,10 @@ static struct tps62360_regulator_platform_data *
return NULL;
}
if (of_find_property(np, "ti,vsel0-state-high", NULL))
pdata->vsel0_def_state = 1;
if (of_find_property(np, "ti,vsel1-state-high", NULL))
pdata->vsel1_def_state = 1;
if (of_find_property(np, "ti,enable-pull-down", NULL))
pdata->en_internal_pulldn = true;
if (of_find_property(np, "ti,enable-vout-discharge", NULL))
pdata->en_discharge = true;
pdata->vsel0_def_state = of_property_read_bool(np, "ti,vsel0-state-high");
pdata->vsel1_def_state = of_property_read_bool(np, "ti,vsel1-state-high");
pdata->en_internal_pulldn = of_property_read_bool(np, "ti,enable-pull-down");
pdata->en_discharge = of_property_read_bool(np, "ti,enable-vout-discharge");
return pdata;
}

View File

@ -729,7 +729,7 @@ static int twlreg_probe(struct platform_device *pdev)
break;
}
if (of_get_property(np, "ti,retain-on-reset", NULL))
if (of_property_read_bool(np, "ti,retain-on-reset"))
info->flags |= TWL_6030_WARM_RESET;
config.dev = &pdev->dev;