Skip to contentSkip to conversation

memory: omap-gpmc: Use of_property_present() for non-boolean properties

PATCH In review Rob Herring (Arm) 2 participants 3 messages Jan 9, 2025 – Jan 13, 2025

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

PATCH 1/1 memory: omap-gpmc: Use of_property_present() for non-boolean properties

The use of of_property_read_bool() for non-boolean properties is deprecated in favor of of_property_present() when testing for property presence.

While we're here, simplify the 2 checks into a single check as they only differ in printing "NAND" vs "OneNAND" in the warning.

---
Possibly this check could just be removed altogether?

---
 drivers/memory/omap-gpmc.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/memory/omap-gpmc.c +3 -13
index e2a75a52563f..329bad46065c 100644
@@ -2226,21 +2226,11 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
 		goto err;
 	}
 
-	if (of_node_name_eq(child, "nand")) {
+	if (of_node_name_eq(child, "nand") || of_node_name_eq(child, "onenand")) {
 		/* Warn about older DT blobs with no compatible property */
-		if (!of_property_read_bool(child, "compatible")) {
+		if (!of_property_present(child, "compatible")) {
 			dev_warn(&pdev->dev,
-				 "Incompatible NAND node: missing compatible");
-			ret = -EINVAL;
-			goto err;
-		}
-	}
-
-	if (of_node_name_eq(child, "onenand")) {
-		/* Warn about older DT blobs with no compatible property */
-		if (!of_property_read_bool(child, "compatible")) {
-			dev_warn(&pdev->dev,
-				 "Incompatible OneNAND node: missing compatible");
+				 "Incompatible '%pOFn' node: missing compatible", child);
 			ret = -EINVAL;
 			goto err;
 		}
Signature · 1 line
2.45.2
maintainer
#1 lore raw

Hi Rob,

Quoted 10 lines · Rob Herring (Arm)

The use of of_property_read_bool() for non-boolean properties is deprecated in favor of of_property_present() when testing for property presence.

While we're here, simplify the 2 checks into a single check as they only differ in printing "NAND" vs "OneNAND" in the warning.

---
Possibly this check could just be removed altogether?

Yes, I agree it is better to just drop these checks. Let me know if you want me to prepare the path. Thanks.

Quoted 33 lines
---
 drivers/memory/omap-gpmc.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/memory/omap-gpmc.c +3 -13
index e2a75a52563f..329bad46065c 100644
@@ -2226,21 +2226,11 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
 		goto err;
 	}
 
-	if (of_node_name_eq(child, "nand")) {
+	if (of_node_name_eq(child, "nand") || of_node_name_eq(child, "onenand")) {
 		/* Warn about older DT blobs with no compatible property */
-		if (!of_property_read_bool(child, "compatible")) {
+		if (!of_property_present(child, "compatible")) {
 			dev_warn(&pdev->dev,
-				 "Incompatible NAND node: missing compatible");
-			ret = -EINVAL;
-			goto err;
-		}
-	}
-
-	if (of_node_name_eq(child, "onenand")) {
-		/* Warn about older DT blobs with no compatible property */
-		if (!of_property_read_bool(child, "compatible")) {
-			dev_warn(&pdev->dev,
-				 "Incompatible OneNAND node: missing compatible");
+				 "Incompatible '%pOFn' node: missing compatible", child);
 			ret = -EINVAL;
 			goto err;
 		}
Signature · 2 lines
cheers,
-roger
#2 lore raw
Quoted 11 lines · Roger Quadros

Hi Rob,

Quoted 7 lines · Rob Herring (Arm)

The use of of_property_read_bool() for non-boolean properties is deprecated in favor of of_property_present() when testing for property presence.

While we're here, simplify the 2 checks into a single check as they only differ in printing "NAND" vs "OneNAND" in the warning.

Quoted 6 lines
Quoted 3 lines

---
Possibly this check could just be removed altogether?

Yes, I agree it is better to just drop these checks. Let me know if you want me to prepare the path. Thanks.

Please do. You would know better than me on the details of why it would be fine to remove.

Rob