Commit 1ba58fbb authored by Rob Herring's avatar Rob Herring Committed by Lee Jones

mfd: various: 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>
Signed-off-by: default avatarLee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230310144712.1543379-1-robh@kernel.org
parent 2ddbddaf
...@@ -28,7 +28,7 @@ static const struct mfd_cell bcm2835_power_devs[] = { ...@@ -28,7 +28,7 @@ static const struct mfd_cell bcm2835_power_devs[] = {
static int bcm2835_pm_get_pdata(struct platform_device *pdev, static int bcm2835_pm_get_pdata(struct platform_device *pdev,
struct bcm2835_pm *pm) struct bcm2835_pm *pm)
{ {
if (of_find_property(pm->dev->of_node, "reg-names", NULL)) { if (of_property_present(pm->dev->of_node, "reg-names")) {
struct resource *res; struct resource *res;
pm->base = devm_platform_ioremap_resource_byname(pdev, "pm"); pm->base = devm_platform_ioremap_resource_byname(pdev, "pm");
......
...@@ -112,7 +112,7 @@ static int khadas_mcu_probe(struct i2c_client *client) ...@@ -112,7 +112,7 @@ static int khadas_mcu_probe(struct i2c_client *client)
if (ret) if (ret)
return ret; return ret;
if (of_find_property(dev->of_node, "#cooling-cells", NULL)) if (of_property_present(dev->of_node, "#cooling-cells"))
return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
khadas_mcu_fan_cells, khadas_mcu_fan_cells,
ARRAY_SIZE(khadas_mcu_fan_cells), ARRAY_SIZE(khadas_mcu_fan_cells),
......
...@@ -1378,7 +1378,7 @@ int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum) ...@@ -1378,7 +1378,7 @@ int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum)
stmpe_of_probe(pdata, np); stmpe_of_probe(pdata, np);
if (of_find_property(np, "interrupts", NULL) == NULL) if (!of_property_present(np, "interrupts"))
ci->irq = -1; ci->irq = -1;
stmpe = devm_kzalloc(ci->dev, sizeof(struct stmpe), GFP_KERNEL); stmpe = devm_kzalloc(ci->dev, sizeof(struct stmpe), GFP_KERNEL);
......
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