From patchwork Fri Apr 26 09:57:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 792711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9507C4345F for ; Fri, 26 Apr 2024 10:00:58 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DB430844; Fri, 26 Apr 2024 12:00:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DB430844 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1714125656; bh=DUVgDs0/gvFlo4f+lMztb4TNTC7UqT0l2BjujtY77hY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Ry35HmHwyahM53eti3q0nqPYZ2vdeNJMb/qeft/sU4FiwJuuQydQrhF/JuxAuFl4N 2Z/Uy+jhzQ2Xqt7UMmizUdraA4yy6Cy9KgnTrSMjizTrXBiyQXqYH3RA2fHEo27/OQ PiIQpMYSEPcbirjY7er1aOZ2sB/cFXvfgPm84fW4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7D3E6F805DF; Fri, 26 Apr 2024 11:59:50 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id ABDF8F805F7; Fri, 26 Apr 2024 11:59:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C3ACDF80423; Fri, 26 Apr 2024 11:57:11 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4D47DF8003C for ; Fri, 26 Apr 2024 11:56:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4D47DF8003C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=HMndcyhK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714125417; x=1745661417; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DUVgDs0/gvFlo4f+lMztb4TNTC7UqT0l2BjujtY77hY=; b=HMndcyhK2IOJhANSSkyr9LkASu+EPmC5oXWubDjHTfpB8c7VRc88McWV CQwsNMlcei36IVXJ7RfxDHmmK53y+eGghnbtQrNMYg8mjoWQTcYCYIlZB LX2QX7eEq3mjdAfD5kojmp8Qv9428stiGIVUaSdfQMgDO3CqCaXywYLMp Fwlrnu6zLoDtCN4UMBeAgHe6bdYSRPQsWhdF1S6O9iPtb5AE6wbanHMpt c9/YMoKcDzLms5LIIRzK3PH6uStAK6sDxZEuAMxioeVZfY8/YQuOoJ49a qG7gWRCBKE38mBAsUUdqxs2dU1m11kFlR9mw9HGF+1Z9G4mWeoXHb4hps Q==; X-CSE-ConnectionGUID: 6J3Q5j/xRZeM2G4HqG9fJw== X-CSE-MsgGUID: rFtrjQJYQPKHg1xbFeESoQ== X-IronPort-AV: E=McAfee;i="6600,9927,11055"; a="20409184" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="20409184" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 02:56:51 -0700 X-CSE-ConnectionGUID: JimNMcCbRmCgssMA9AEfhQ== X-CSE-MsgGUID: VXfDG88vQIuOE7DecZbNLQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="25460546" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmviesa010.fm.intel.com with ESMTP; 26 Apr 2024 02:56:49 -0700 From: Cezary Rojewski To: broonie@kernel.org Cc: alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, Cezary Rojewski Subject: [PATCH 1/8] ASoC: pcm: Reverse iterate DAIs when shutting them down Date: Fri, 26 Apr 2024 11:57:26 +0200 Message-Id: <20240426095733.3946951-2-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240426095733.3946951-1-cezary.rojewski@intel.com> References: <20240426095733.3946951-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Message-ID-Hash: D7XTR5F3LRDSDJRWEY7KJLPYZA535UAU X-Message-ID-Hash: D7XTR5F3LRDSDJRWEY7KJLPYZA535UAU X-MailFrom: cezary.rojewski@intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: During startup snd_soc_dai_startup() is launched in ascending order and the exact same thing is done during shutdown procedure. Reverse the order in the latter so that it is symmetric to the former. Signed-off-by: Cezary Rojewski --- include/sound/soc.h | 4 ++++ sound/soc/soc-pcm.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 0376f7e4c15d..a4747c3d0856 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1225,6 +1225,10 @@ struct snd_soc_pcm_runtime { ((i) < (rtd)->dai_link->num_cpus + (rtd)->dai_link->num_codecs) && \ ((dai) = (rtd)->dais[i]); \ (i)++) +#define for_each_rtd_dais_reverse(rtd, i, dai) \ + for ((i) = (rtd)->dai_link->num_cpus + (rtd)->dai_link->num_codecs - 1; \ + (i) >= 0 && ((dai) = (rtd)->dais[i]); \ + (i)--) #define for_each_rtd_ch_maps(rtd, i, ch_maps) for_each_link_ch_maps(rtd->dai_link, i, ch_maps) void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd); diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index b0e1bd7f588b..711b2f49ed88 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -724,7 +724,7 @@ static int soc_pcm_clean(struct snd_soc_pcm_runtime *rtd, } } - for_each_rtd_dais(rtd, i, dai) + for_each_rtd_dais_reverse(rtd, i, dai) snd_soc_dai_shutdown(dai, substream, rollback); snd_soc_link_shutdown(substream, rollback);