Skip to contentSkip to conversation

ACPICA: Eliminate double call to acpi_ns_get_parent_node in acpi_get_parent

PATCH In review Alex Chiang 2 participants 2 messages May 19, 2009

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

PATCH 1/1 ACPICA: Eliminate double call to acpi_ns_get_parent_node in acpi_get_parent

Cache the value of the parent node so we don't have to look it up twice.

---

 drivers/acpi/acpica/nsxfobj.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/acpi/acpica/nsxfobj.c +4 -4
index 1c7efc1..1cd8f15 100644
@@ -161,7 +161,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_type)
  ******************************************************************************/
 acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
 {
-	struct acpi_namespace_node *node;
+	struct acpi_namespace_node *node, *parent_node;
 	acpi_status status;
 
 	if (!ret_handle) {
@@ -189,12 +189,12 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
 
 	/* Get the parent entry */
 
-	*ret_handle =
-	    acpi_ns_convert_entry_to_handle(acpi_ns_get_parent_node(node));
+	parent_node = acpi_ns_get_parent_node(node);
+	*ret_handle = acpi_ns_convert_entry_to_handle(parent_node);
 
 	/* Return exception if parent is null */
 
-	if (!acpi_ns_get_parent_node(node)) {
+	if (!parent_node) {
 		status = AE_NULL_ENTRY;
 	}
 
#1 lore raw

I will integrate this into ACPICA.

Thanks,
Bob

Quoted 49 lines

-----Original Message-----
From: Alex Chiang [mailto:[email protected]]
Sent: Monday, May 18, 2009 8:23 PM
To: [email protected]
Cc: [email protected]; [email protected]; Moore, Robert
Subject: [PATCH] ACPICA: Eliminate double call to acpi_ns_get_parent_node in acpi_get_parent

Cache the value of the parent node so we don't have to look it up twice.

---

drivers/acpi/acpica/nsxfobj.c | 8 ++++----

1 files changed, 4 insertions(+), 4 deletions(-)
drivers/acpi/acpica/nsxfobj.c +1 -1
index 1c7efc1..1cd8f15 100644
@@ -161,7 +161,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_type)
 
 ***************************************************************************
 ***/
 acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
 {
-	struct acpi_namespace_node *node;
+	struct acpi_namespace_node *node, *parent_node;
 	acpi_status status;
	if (!ret_handle) {
drivers/acpi/acpica/nsxfobj.c +3 -3
@@ -189,12 +189,12 @@ acpi_status acpi_get_parent(acpi_handle handle,
 acpi_handle * ret_handle)
 
 	/* Get the parent entry */
 
-	*ret_handle =
-	    acpi_ns_convert_entry_to_handle(acpi_ns_get_parent_node(node));
+	parent_node = acpi_ns_get_parent_node(node);
+	*ret_handle = acpi_ns_convert_entry_to_handle(parent_node);
 
 	/* Return exception if parent is null */
 
-	if (!acpi_ns_get_parent_node(node)) {
+	if (!parent_node) {
 		status = AE_NULL_ENTRY;
 	}