From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 755952DB798; Tue, 9 Jun 2026 06:15:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780985748; cv=none; b=mQQOH5I13qWPUFXJvvdFr52AqnpRt89a6ZgpIVlYuTjr5idJaXxVjBqziGyrG5UxzLLm4tDOZcBRKXbfzfCq08RmmVX6pbt6cClqSX+UPD1RXdKMvNeMWopXh6IbCCN73TPzx3wkTMgePhlmBT8oBI9IhXkPswsqB1834eByocw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780985748; c=relaxed/simple; bh=cPva2gAmFaYku+W1JPo6ih65+2CyucxGxB/+Epfgxvo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qbjmzJXzdpiDP2fvf8xZsUw3QvHDUXkuccl/hPHu6I1I5MSxnesSQ/m/TiazuWAOk+dwM/nIVw3fDfQP8TgBLWgwVLJy57nrvaVvN3dG8rD9gJTzF9YfE0IUKDhkmahS+VrZgDMpaqi8hwZTlEEWlcV4kmcdSx+NkxTGTPN5MoA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=mu4x5jso; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="mu4x5jso" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1780985744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8IbZbE3jo0O5k9m8Y0Atqn05/3xjZN/raHrVYg8v9cA=; b=mu4x5jsoYo0l0ovgG3zOUnjhNAQicGnTrtTFx6Idq1wmNye60WV1RaPHTgTt8LrIeGV3Rp z1sQSh8qYQYqgD+WB2P0Pz0U+UWtH+CwphgBLPih3SdT7bmzxnYsrxKQ46Ig7exityyWy0 /VoZbB9nTPAPZ3JdijaeFc0zLpE0Zho= From: Kaitao Cheng To: Andy Shevchenko , Muchun Song , Philipp Reisner , Lars Ellenberg , =?UTF-8?q?Christoph=20B=C3=B6hmwalder?= , Jens Axboe , Takashi Sakamoto , Andrzej Hajda , Neil Armstrong , Robert Foss , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Christian Koenig , Huang Rui , Eddie James , Mark Brown , Maxime Coquelin , Alexandre Torgue , Laxman Dewangan , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Davidlohr Bueso , "Paul E . McKenney" , Josh Triplett , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Liam Girdwood , Jaroslav Kysela , Takashi Iwai Cc: Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Matthew Auld , Matthew Brost , Waiman Long , drbd-dev@lists.linbit.com, linux-block@vger.kernel.org, linux1394-devel@lists.sourceforge.net, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-spi@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton , Randy Dunlap , Christian Brauner , David Howells , Luca Ceresoli , Kaitao Cheng , Kaitao Cheng Subject: [PATCH v2 02/14] firewire: core: Open-code topology list walk Date: Tue, 9 Jun 2026 14:13:35 +0800 Message-ID: <20260609061347.93688-3-kaitao.cheng@linux.dev> In-Reply-To: <20260609061347.93688-1-kaitao.cheng@linux.dev> References: <20260609061347.93688-1-kaitao.cheng@linux.dev> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Kaitao Cheng A later change will make list_for_each_entry() cache the next element before entering the loop body. for_each_fw_node() intentionally appends newly discovered child nodes to the temporary walk list while the list is being traversed. Keep the loop open-coded so the next node is looked up only after children have been appended. This preserves the current breadth-first traversal semantics and prepares the code for the list iterator update. Signed-off-by: Kaitao Cheng --- drivers/firewire/core-topology.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/firewire/core-topology.c b/drivers/firewire/core-topology.c index bb2d2db30795..df2ac0dab106 100644 --- a/drivers/firewire/core-topology.c +++ b/drivers/firewire/core-topology.c @@ -272,7 +272,9 @@ static void for_each_fw_node(struct fw_card *card, struct fw_node *root, fw_node_get(root); list_add_tail(&root->link, &list); parent = NULL; - list_for_each_entry(node, &list, link) { + for (node = list_first_entry(&list, typeof(*node), link); + !list_entry_is_head(node, &list, link); + node = list_next_entry(node, link)) { node->color = card->color; for (i = 0; i < node->port_count; i++) { -- 2.43.0