Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Rob Herring and committed by
Mark Brown
5bd73a16 7dda20c9

+17 -36
+1 -2
drivers/regulator/lp872x.c
··· 832 832 return ERR_PTR(-ENOMEM); 833 833 834 834 of_property_read_u8(np, "ti,general-config", &pdata->general_config); 835 - if (of_find_property(np, "ti,update-config", NULL)) 836 - pdata->update_config = true; 835 + pdata->update_config = of_property_read_bool(np, "ti,update-config"); 837 836 838 837 pdata->dvs = devm_kzalloc(dev, sizeof(struct lp872x_dvs), GFP_KERNEL); 839 838 if (!pdata->dvs)
+3 -8
drivers/regulator/max8997-regulator.c
··· 943 943 } 944 944 of_node_put(regulators_np); 945 945 946 - if (of_get_property(pmic_np, "max8997,pmic-buck1-uses-gpio-dvs", NULL)) 947 - pdata->buck1_gpiodvs = true; 948 - 949 - if (of_get_property(pmic_np, "max8997,pmic-buck2-uses-gpio-dvs", NULL)) 950 - pdata->buck2_gpiodvs = true; 951 - 952 - if (of_get_property(pmic_np, "max8997,pmic-buck5-uses-gpio-dvs", NULL)) 953 - pdata->buck5_gpiodvs = true; 946 + pdata->buck1_gpiodvs = of_property_read_bool(pmic_np, "max8997,pmic-buck1-uses-gpio-dvs"); 947 + pdata->buck2_gpiodvs = of_property_read_bool(pmic_np, "max8997,pmic-buck2-uses-gpio-dvs"); 948 + pdata->buck5_gpiodvs = of_property_read_bool(pmic_np, "max8997,pmic-buck5-uses-gpio-dvs"); 954 949 955 950 if (pdata->buck1_gpiodvs || pdata->buck2_gpiodvs || 956 951 pdata->buck5_gpiodvs) {
+1 -2
drivers/regulator/max8998.c
··· 618 618 if (ret) 619 619 return -EINVAL; 620 620 621 - if (of_find_property(pmic_np, "max8998,pmic-buck-voltage-lock", NULL)) 622 - pdata->buck_voltage_lock = true; 621 + pdata->buck_voltage_lock = of_property_read_bool(pmic_np, "max8998,pmic-buck-voltage-lock"); 623 622 624 623 ret = of_property_read_u32(pmic_np, 625 624 "max8998,pmic-buck1-default-dvs-idx",
+6 -11
drivers/regulator/s5m8767.c
··· 605 605 606 606 of_node_put(regulators_np); 607 607 608 - if (of_get_property(pmic_np, "s5m8767,pmic-buck2-uses-gpio-dvs", NULL)) { 608 + if (of_property_read_bool(pmic_np, "s5m8767,pmic-buck2-uses-gpio-dvs")) { 609 609 pdata->buck2_gpiodvs = true; 610 610 611 611 if (of_property_read_u32_array(pmic_np, ··· 616 616 } 617 617 } 618 618 619 - if (of_get_property(pmic_np, "s5m8767,pmic-buck3-uses-gpio-dvs", NULL)) { 619 + if (of_property_read_bool(pmic_np, "s5m8767,pmic-buck3-uses-gpio-dvs")) { 620 620 pdata->buck3_gpiodvs = true; 621 621 622 622 if (of_property_read_u32_array(pmic_np, ··· 627 627 } 628 628 } 629 629 630 - if (of_get_property(pmic_np, "s5m8767,pmic-buck4-uses-gpio-dvs", NULL)) { 630 + if (of_property_read_bool(pmic_np, "s5m8767,pmic-buck4-uses-gpio-dvs")) { 631 631 pdata->buck4_gpiodvs = true; 632 632 633 633 if (of_property_read_u32_array(pmic_np, ··· 661 661 if (ret) 662 662 return -EINVAL; 663 663 664 - if (of_get_property(pmic_np, "s5m8767,pmic-buck2-ramp-enable", NULL)) 665 - pdata->buck2_ramp_enable = true; 666 - 667 - if (of_get_property(pmic_np, "s5m8767,pmic-buck3-ramp-enable", NULL)) 668 - pdata->buck3_ramp_enable = true; 669 - 670 - if (of_get_property(pmic_np, "s5m8767,pmic-buck4-ramp-enable", NULL)) 671 - pdata->buck4_ramp_enable = true; 664 + pdata->buck2_ramp_enable = of_property_read_bool(pmic_np, "s5m8767,pmic-buck2-ramp-enable"); 665 + pdata->buck3_ramp_enable = of_property_read_bool(pmic_np, "s5m8767,pmic-buck3-ramp-enable"); 666 + pdata->buck4_ramp_enable = of_property_read_bool(pmic_np, "s5m8767,pmic-buck4-ramp-enable"); 672 667 673 668 if (pdata->buck2_ramp_enable || pdata->buck3_ramp_enable 674 669 || pdata->buck4_ramp_enable) {
+1 -1
drivers/regulator/stpmic1_regulator.c
··· 576 576 } 577 577 578 578 /* set mask reset */ 579 - if (of_get_property(config.of_node, "st,mask-reset", NULL) && 579 + if (of_property_read_bool(config.of_node, "st,mask-reset") && 580 580 cfg->mask_reset_reg != 0) { 581 581 ret = regmap_update_bits(pmic_dev->regmap, 582 582 cfg->mask_reset_reg,
+4 -11
drivers/regulator/tps62360-regulator.c
··· 296 296 return NULL; 297 297 } 298 298 299 - if (of_find_property(np, "ti,vsel0-state-high", NULL)) 300 - pdata->vsel0_def_state = 1; 301 - 302 - if (of_find_property(np, "ti,vsel1-state-high", NULL)) 303 - pdata->vsel1_def_state = 1; 304 - 305 - if (of_find_property(np, "ti,enable-pull-down", NULL)) 306 - pdata->en_internal_pulldn = true; 307 - 308 - if (of_find_property(np, "ti,enable-vout-discharge", NULL)) 309 - pdata->en_discharge = true; 299 + pdata->vsel0_def_state = of_property_read_bool(np, "ti,vsel0-state-high"); 300 + pdata->vsel1_def_state = of_property_read_bool(np, "ti,vsel1-state-high"); 301 + pdata->en_internal_pulldn = of_property_read_bool(np, "ti,enable-pull-down"); 302 + pdata->en_discharge = of_property_read_bool(np, "ti,enable-vout-discharge"); 310 303 311 304 return pdata; 312 305 }
+1 -1
drivers/regulator/twl6030-regulator.c
··· 729 729 break; 730 730 } 731 731 732 - if (of_get_property(np, "ti,retain-on-reset", NULL)) 732 + if (of_property_read_bool(np, "ti,retain-on-reset")) 733 733 info->flags |= TWL_6030_WARM_RESET; 734 734 735 735 config.dev = &pdev->dev;