Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Cc: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH 02/11] ALSA: ca0106: Simplify with snd_ctl_find_id_mixer()
Date: Thu, 20 Jul 2023 10:20:59 +0200	[thread overview]
Message-ID: <20230720082108.31346-3-tiwai@suse.de> (raw)
In-Reply-To: <20230720082108.31346-1-tiwai@suse.de>

Replace an open code with the new snd_ctl_find_id_mixer().
There is no functional change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/ca0106/ca0106_mixer.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c
index f6381c098d4f..2f37d2c3dd38 100644
--- a/sound/pci/ca0106/ca0106_mixer.c
+++ b/sound/pci/ca0106/ca0106_mixer.c
@@ -706,19 +706,9 @@ static int remove_ctl(struct snd_card *card, const char *name)
 	return snd_ctl_remove_id(card, &id);
 }
 
-static struct snd_kcontrol *ctl_find(struct snd_card *card, const char *name)
-{
-	struct snd_ctl_elem_id sid;
-	memset(&sid, 0, sizeof(sid));
-	/* FIXME: strcpy is bad. */
-	strcpy(sid.name, name);
-	sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
-	return snd_ctl_find_id(card, &sid);
-}
-
 static int rename_ctl(struct snd_card *card, const char *src, const char *dst)
 {
-	struct snd_kcontrol *kctl = ctl_find(card, src);
+	struct snd_kcontrol *kctl = snd_ctl_find_id_mixer(card, src);
 	if (kctl) {
 		snd_ctl_rename(card, kctl, dst);
 		return 0;
@@ -765,7 +755,8 @@ static void add_followers(struct snd_card *card,
 			  struct snd_kcontrol *master, const char * const *list)
 {
 	for (; *list; list++) {
-		struct snd_kcontrol *follower = ctl_find(card, *list);
+		struct snd_kcontrol *follower =
+			snd_ctl_find_id_mixer(card, *list);
 		if (follower)
 			snd_ctl_add_follower(master, follower);
 	}
-- 
2.35.3


  parent reply	other threads:[~2023-07-20  8:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20  8:20 [PATCH 00/11] ALSA: Cleanup with snd_ctl_find_id_mixer() Takashi Iwai
2023-07-20  8:20 ` [PATCH 01/11] ALSA: control: Introduce snd_ctl_find_id_mixer() Takashi Iwai
2023-07-20  8:20 ` Takashi Iwai [this message]
2023-07-20  8:21 ` [PATCH 03/11] ALSA: cs46xx: Simplify with snd_ctl_find_id_mixer() Takashi Iwai
2023-07-20  8:21 ` [PATCH 04/11] ALSA: emu10k1: " Takashi Iwai
2023-07-20  8:21 ` [PATCH 05/11] ALSA: es1968: " Takashi Iwai
2023-07-20  8:21 ` [PATCH 06/11] ALSA: ice1712: " Takashi Iwai
2023-07-20  8:21 ` [PATCH 07/11] ALSA: maestro3: " Takashi Iwai
2023-07-20  8:21 ` [PATCH 08/11] ALSA: via82xx: " Takashi Iwai
2023-07-20  8:21 ` [PATCH 09/11] ALSA: cmipci: " Takashi Iwai
2023-07-20  8:21 ` [PATCH 10/11] ASoC: mediatek: mt8188: " Takashi Iwai
2023-07-20 13:02   ` Mark Brown
2023-07-20  8:21 ` [PATCH 11/11] ALSA: ac97: " Takashi Iwai

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=20230720082108.31346-3-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox