public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] thunderbolt: Refactor tb_acpi_add_link()
@ 2023-01-02 19:24 Andy Shevchenko
  2023-01-04  7:46 ` Mika Westerberg
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2023-01-02 19:24 UTC (permalink / raw)
  To: Mika Westerberg, linux-usb, linux-kernel
  Cc: Andreas Noever, Michael Jamet, Yehezkel Bernat, Andy Shevchenko

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>
---
 drivers/thunderbolt/acpi.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/thunderbolt/acpi.c b/drivers/thunderbolt/acpi.c
index 317e4f5fdb97..628225deb8fe 100644
--- a/drivers/thunderbolt/acpi.c
+++ b/drivers/thunderbolt/acpi.c
@@ -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
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] thunderbolt: Refactor tb_acpi_add_link()
  2023-01-02 19:24 [PATCH v1 1/1] thunderbolt: Refactor tb_acpi_add_link() Andy Shevchenko
@ 2023-01-04  7:46 ` Mika Westerberg
  0 siblings, 0 replies; 2+ messages in thread
From: Mika Westerberg @ 2023-01-04  7:46 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-usb, linux-kernel, Andreas Noever, Michael Jamet,
	Yehezkel Bernat

On Mon, Jan 02, 2023 at 09:24:04PM +0200, Andy Shevchenko wrote:
> 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>

Applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-04  7:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-02 19:24 [PATCH v1 1/1] thunderbolt: Refactor tb_acpi_add_link() Andy Shevchenko
2023-01-04  7:46 ` Mika Westerberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox