diff mbox series

[17/23] ASoC: intel: sof_sdw: Move amp_num initialisation to mc_probe

Message ID 20230731214257.444605-18-pierre-louis.bossart@linux.intel.com
State New
Headers show
Series ASoC: Intel: machine driver updates for 6.6 | expand

Commit Message

Pierre-Louis Bossart July 31, 2023, 9:42 p.m. UTC
From: Charles Keepax <ckeepax@opensource.cirrus.com>

The amp_num member of the info struct is zeroed at the start of
sof_card_dai_links_create, but then summed in mc_probe after
sof_card_dai_links_create is called. It is a little clearer to hoist the
initialisation out of sof_card_dai_links_create so it is on the same
level as the summation.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/sof_sdw.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c
index dc5337ea75da..1a60965439dd 100644
--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -1599,10 +1599,6 @@  static int sof_card_dai_links_create(struct snd_soc_card *card)
 	if (ret < 0)
 		return ret;
 
-	/* reset amp_num to ensure amp_num++ starts from 0 in each probe */
-	for (i = 0; i < ARRAY_SIZE(codec_info_list); i++)
-		codec_info_list[i].amp_num = 0;
-
 	if (mach_params->codec_mask & IDISP_CODEC_MASK) {
 		ctx->idisp_codec = true;
 
@@ -1991,6 +1987,10 @@  static int mc_probe(struct platform_device *pdev)
 
 	log_quirks(card->dev);
 
+	/* reset amp_num to ensure amp_num++ starts from 0 in each probe */
+	for (i = 0; i < ARRAY_SIZE(codec_info_list); i++)
+		codec_info_list[i].amp_num = 0;
+
 	ret = sof_card_dai_links_create(card);
 	if (ret < 0)
 		return ret;