Skip to content

Commit

Permalink
ACPI: property: use cached name in acpi_fwnode_get_named_child_node()
Browse files Browse the repository at this point in the history
There is no need to re-evaluate the object name.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Heikki Krogerus authored and Rafael J. Wysocki committed Jun 22, 2020
1 parent 4877846 commit cbdd865
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions drivers/acpi/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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;
}

Expand Down

0 comments on commit cbdd865

Please sign in to comment.