Skip to content

Commit

Permalink
thunderbolt: Refactor tb_acpi_add_link()
Browse files Browse the repository at this point in the history
Convert while loop into do-while with only a single call to
acpi_get_first_physical_node(). No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
  • Loading branch information
Andy Shevchenko authored and Mika Westerberg committed Jan 4, 2023
1 parent d311376 commit 953ff25
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions drivers/thunderbolt/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,13 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data,
* We need to do this because the xHCI driver might not yet be
* bound so the USB3 SuperSpeed ports are not yet created.
*/
dev = acpi_get_first_physical_node(adev);
while (!dev) {
adev = acpi_dev_parent(adev);
if (!adev)
break;
do {
dev = acpi_get_first_physical_node(adev);
}
if (dev)
break;

if (!dev)
goto out_put;
adev = acpi_dev_parent(adev);
} while (adev);

/*
* Check that the device is PCIe. This is because USB3
Expand Down

0 comments on commit 953ff25

Please sign in to comment.