From: Cezary Rojewski <cezary.rojewski@intel.com>
To: broonie@kernel.org
Cc: tiwai@suse.com, perex@perex.cz, amade@asmblr.net,
linux-sound@vger.kernel.org,
Cezary Rojewski <cezary.rojewski@intel.com>
Subject: [PATCH 2/2] ASoC: codecs: hda: Use list_count_nodes() to simplify the code
Date: Mon, 14 Sep 2026 12:19:17 +0200 [thread overview]
Message-ID: <20260914101917.2969665-2-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20260914101917.2969665-1-cezary.rojewski@intel.com>
By enlisting list_count_nodes(), a recent addition to the list.h, the
code responsible for manual counting of the HDAudio PCMs can be dropped.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
sound/soc/codecs/hda.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/hda.c b/sound/soc/codecs/hda.c
index 237b0b060457..084659106d5d 100644
--- a/sound/soc/codecs/hda.c
+++ b/sound/soc/codecs/hda.c
@@ -85,12 +85,11 @@ static int hda_codec_register_dais(struct hda_codec *codec, struct snd_soc_compo
struct snd_soc_dai_driver *drvs = NULL;
struct snd_soc_dapm_context *dapm;
struct hda_pcm *pcm;
- int ret, pcm_count = 0;
+ int ret, pcm_count;
- if (list_empty(&codec->pcm_list_head))
+ pcm_count = list_count_nodes(&codec->pcm_list_head);
+ if (!pcm_count)
return -EINVAL;
- list_for_each_entry(pcm, &codec->pcm_list_head, list)
- pcm_count++;
ret = hda_codec_create_dais(codec, pcm_count, &drvs);
if (ret < 0)
--
2.34.1
next prev parent reply other threads:[~2026-09-14 10:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 10:19 [PATCH 1/2] ASoC: Intel: avs: Use list_count_nodes() to simplify the code Cezary Rojewski
2026-09-14 10:19 ` Cezary Rojewski [this message]
2026-09-14 14:23 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260914101917.2969665-2-cezary.rojewski@intel.com \
--to=cezary.rojewski@intel.com \
--cc=amade@asmblr.net \
--cc=broonie@kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.