Unverified Commit 5bd73a16 authored by Rob Herring's avatar Rob Herring Committed by Mark Brown
Browse files

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: default avatarRob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230310144722.1544843-1-robh@kernel.org


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7dda20c9
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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)
+3 −8
Original line number Diff line number Diff line
@@ -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) {
+1 −2
Original line number Diff line number Diff line
@@ -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",
+6 −11
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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,
Loading