From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (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 AC7F8383333 for ; Tue, 9 Jun 2026 06:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780987370; cv=none; b=QVqc4UC29psru+Ylz2hE+dfNC72wAYBktY8/3QIFWKUV4/FHFZo63fXyxeGWvhcn8RVVFFDAgA8jXP9IT25QM474k2mc8efcrK5ESv6bJJGZhy6q23o+L6kuwmGfxmhfdDYIDDt+HF+T0XZWAOQo3n0VkDhF+8pA6+bbzzDM6hg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780987370; c=relaxed/simple; bh=tNgMvvM+CiASJY4sOEMxFckQKiwCHdQCqyU1fvL1LkQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cU9cHdOUTXjD1mguOemUtjBgB5JXUfZJ2pata9McaDFjx2p7IWJbmFA/lyZugczRQeBTA4XW9/L5eEqT5Uh3u1sz2GV40EuR3erUyMZllIKNIyKmm/uWOaml6Nu4hi/rg8aI0HRWmhSclA/PxJmCjRl5rpYSqVYt6ZMoyt2C/kQ= 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=r9H+J3Ut; arc=none smtp.client-ip=91.218.175.173 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="r9H+J3Ut" 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=1780987356; 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=okGbZnshQDiTOCCUcLiGWJ/vXeEA5Q7ST0C3mLZj8lI=; b=r9H+J3UthvdbJqCWseQmPy/6Gw04t2MD3O/3QZkG+FrfACMHjoHmAZhEA7T2/P7rXoTaRj flnwXmsam8NnpyHmx73y4wEmRAzWN+xVg1sMhEn7tyW9qKpEVePYA4xXwp0ikhd+ORVe1t m7DPL598qkuZ4CAlEebaO3UEKtTEsyk= 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 13/14] ASoC: dapm: Open-code widget invalidation walk Date: Tue, 9 Jun 2026 14:41:21 +0800 Message-ID: <20260609064122.95825-1-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-tegra@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. dapm_widget_invalidate_paths() appends newly reached widgets to the temporary work list while walking it. Keep the work-list walk open-coded so the next widget is looked up after new widgets have been appended. This preserves the existing invalidation traversal semantics and prepares the code for the list iterator update. Signed-off-by: Kaitao Cheng --- sound/soc/soc-dapm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index d6192204e613..5bd921fca132 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -255,7 +255,9 @@ static __always_inline void dapm_widget_invalidate_paths( list_add_tail(&w->work_list, &list); w->endpoints[dir] = -1; - list_for_each_entry(w, &list, work_list) { + for (w = list_first_entry(&list, typeof(*w), work_list); + !list_entry_is_head(w, &list, work_list); + w = list_next_entry(w, work_list)) { snd_soc_dapm_widget_for_each_path(w, dir, p) { if (p->is_supply || !p->connect) continue; -- 2.43.0