Skip to contentSkip to conversation

ACPI / property: use cached name in acpi_fwnode_get_named_child_node()

PATCH Applied Heikki Krogerus 2 participants 2 messages Jun 9, 2020 – Jun 22, 2020 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI / property: use cached name in acpi_fwnode_get_named_child_node()

There is no need to re-evaluate the object name.

---
 drivers/acpi/property.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/acpi/property.c +2 -12
index e601c4511a8b5..6941062272e0b 100644
@@ -606,13 +606,7 @@ static struct fwnode_handle *
 acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
 				 const char *childname)
 {
-	char name[ACPI_PATH_SEGMENT_LENGTH];
 	struct fwnode_handle *child;
-	struct acpi_buffer path;
-	acpi_status status;
-
-	path.length = sizeof(name);
-	path.pointer = name;
 
 	fwnode_for_each_child_node(fwnode, child) {
 		if (is_acpi_data_node(child)) {
@@ -621,12 +615,8 @@ acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
 			continue;
 		}
 
-		status = acpi_get_name(ACPI_HANDLE_FWNODE(child),
-				       ACPI_SINGLE_NAME, &path);
-		if (ACPI_FAILURE(status))
-			break;
-
-		if (!strncmp(name, childname, ACPI_NAMESEG_SIZE))
+		if (!strncmp(acpi_device_bid(to_acpi_device_node(child)),
+			     childname, ACPI_NAMESEG_SIZE))
 			return child;
 	}
 
Signature · 1 line
2.27.0.rc2
#1 lore raw
Quoted 31 lines · CEST Heikki Krogerus

There is no need to re-evaluate the object name.

---
 drivers/acpi/property.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/acpi/property.c +0 -7
index e601c4511a8b5..6941062272e0b 100644
@@ -606,13 +606,7 @@ static struct fwnode_handle *
 acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
 				 const char *childname)
 {
-	char name[ACPI_PATH_SEGMENT_LENGTH];
 	struct fwnode_handle *child;
-	struct acpi_buffer path;
-	acpi_status status;
-
-	path.length = sizeof(name);
-	path.pointer = name;
 
 	fwnode_for_each_child_node(fwnode, child) {
 		if (is_acpi_data_node(child)) {
@@ -621,12 +615,8 @@ acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
 			continue;
 		}
 
-		status = acpi_get_name(ACPI_HANDLE_FWNODE(child),

drivers/acpi/property.c acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode, · line 622

Quoted 10 lines
drivers/acpi/property.c +2 -5
-				       ACPI_SINGLE_NAME, &path);
-		if (ACPI_FAILURE(status))
-			break;
-
-		if (!strncmp(name, childname, ACPI_NAMESEG_SIZE))
+		if (!strncmp(acpi_device_bid(to_acpi_device_node(child)),
+			     childname, ACPI_NAMESEG_SIZE))
 			return child;
 	}
 

Applied as 5.9 material, thanks!