Skip to contentSkip to conversation

i2c: core: Use of_property_present() for wakeup-source

PATCH New [email protected] 1 participant 1 message May 5

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: core: Use of_property_present() for wakeup-source

From: bui duc phuc <[email protected]>

The code currently uses of_property_read_bool() to check for the presence of the 'wakeup-source' property.

However, of_property_read_bool() is intended for boolean properties, and its usage on non-boolean types is deprecated. The 'wakeup-source' property may be defined either as a boolean or as a phandle-array, depending on the binding.

Switch to of_property_present() to check only for the presence of the property, avoiding any type assumptions about its type.

Also apply the same change to 'host-notify' for consistency.

---

Verified with st1232 touchscreen on Armadillo-800EVA (R8A7740).

 drivers/i2c/i2c-core-of.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/i2c-core-of.c +2 -2
index 354a88d0599e..b45d39da9208 100644
@@ -51,10 +51,10 @@ int of_i2c_get_board_info(struct device *dev, struct device_node *node,
 	info->addr = addr;
 	info->fwnode = of_fwnode_handle(node);
 
-	if (of_property_read_bool(node, "host-notify"))
+	if (of_property_present(node, "host-notify"))
 		info->flags |= I2C_CLIENT_HOST_NOTIFY;
 
-	if (of_property_read_bool(node, "wakeup-source"))
+	if (of_property_present(node, "wakeup-source"))
 		info->flags |= I2C_CLIENT_WAKE;
 
 	return 0;
Signature · 1 line
2.43.0