macintosh: 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: Rob Herring <robh@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230310144735.1546817-1-robh@kernel.org
This commit is contained in:
Rob Herring 2023-03-10 08:47:35 -06:00 committed by Michael Ellerman
parent 4d57e3515e
commit 87b626a66d
2 changed files with 2 additions and 2 deletions

View File

@ -387,7 +387,7 @@ static int rackmeter_probe(struct macio_dev* mdev,
if (of_node_name_eq(np, "lightshow"))
break;
if (of_node_name_eq(np, "sound") &&
of_get_property(np, "virtual", NULL) != NULL)
of_property_present(np, "virtual"))
break;
}
if (np == NULL) {

View File

@ -483,7 +483,7 @@ static int probe_thermostat(struct i2c_client *client)
if (vers != 1)
return -ENXIO;
if (of_get_property(np, "hwsensor-location", NULL)) {
if (of_property_present(np, "hwsensor-location")) {
for (i = 0; i < 3; i++) {
sensor_location[i] = of_get_property(np,
"hwsensor-location", NULL) + offset;