From patchwork Thu Jul 20 08:20:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13320002 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 762F5EB64DC for ; Thu, 20 Jul 2023 08:22:48 +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 52AC7207; Thu, 20 Jul 2023 10:21:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 52AC7207 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1689841366; bh=ttdmDmLJzKov7q6ZzFVoreZPmgxZSZarpVuWEDB5mys=; 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=jfl9ymXSOxFhOZXCiKqs/uhPSgGgdaGGPWgIPw00hIs190Qcan8MveSgRqzB6JFrU ZJBgMRH4wIpKyc7eb2VRXBsHZY7+QydFtoV2u0OWznSpkwpAWNjPoaev1XjPoNwyhU XuRGAX+GXT/NrS2t71uIeRQze/fK7ngm/HDeqot8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D9635F80568; Thu, 20 Jul 2023 10:21:24 +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 67C0AF80568; Thu, 20 Jul 2023 10:21:24 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 58298F8057C; Thu, 20 Jul 2023 10:21:20 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2E72AF80557 for ; Thu, 20 Jul 2023 10:21:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2E72AF80557 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=N4+FuRuX; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Sa9ibJjT Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id AEA2E20598; Thu, 20 Jul 2023 08:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689841275; h=from:from:reply-to: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=HZ2jjyvedNZu7vtrtVYWzfG6FJ6u9u6YNWL9iFvKWCw=; b=N4+FuRuXOZ7nVVFExWaT+Fr5ZBpSqaVSBWoUoRwbgB4J/6VG0WNv3azPQwEqhCfhVm0tS+ g2KR8pCUK/3FgQ8cmR6+ULCRgYp9Wq30JvJ6UtJ9UvqwHyTuyoUtqzujDengunezPIikS7 JAjf4OpQnz4pqsrq5MnY//WW2rTBnPc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689841275; h=from:from:reply-to: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=HZ2jjyvedNZu7vtrtVYWzfG6FJ6u9u6YNWL9iFvKWCw=; b=Sa9ibJjT3LcEiUjJVrqkTdGMIjGKVET7LHgaN1NxGa+8HmfAIbJtIxyuwiTMwzq0uoifRb XZur16DSmptK9zAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 93F9D13924; Thu, 20 Jul 2023 08:21:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iGAwI3vuuGQmIgAAMHmgww (envelope-from ); Thu, 20 Jul 2023 08:21:15 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Takashi Iwai Subject: [PATCH 01/11] ALSA: control: Introduce snd_ctl_find_id_mixer() Date: Thu, 20 Jul 2023 10:20:58 +0200 Message-Id: <20230720082108.31346-2-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230720082108.31346-1-tiwai@suse.de> References: <20230720082108.31346-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: LDNZSXQRANCOXMCIXFNW2SSXD5DPHCNZ X-Message-ID-Hash: LDNZSXQRANCOXMCIXFNW2SSXD5DPHCNZ X-MailFrom: tiwai@suse.de 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.8 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: A commonly seen pattern is to run snd_ctl_find_id() for a mixer control element with a given string. Let's provide a standard helper for achieving that for simplifying the code. Signed-off-by: Takashi Iwai --- include/sound/control.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/sound/control.h b/include/sound/control.h index 42e8dbb22d8e..69d950a34ca3 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -145,6 +145,28 @@ struct snd_kcontrol *snd_ctl_find_numid(struct snd_card *card, unsigned int numi struct snd_kcontrol *snd_ctl_find_id_locked(struct snd_card *card, const struct snd_ctl_elem_id *id); struct snd_kcontrol *snd_ctl_find_id(struct snd_card *card, const struct snd_ctl_elem_id *id); +/** + * snd_ctl_find_id_mixer - find the control instance with the given name string + * @card: the card instance + * @name: the name string + * + * Finds the control instance with the given name and + * @SNDRV_CTL_ELEM_IFACE_MIXER. Other fields are set to zero. + * + * This is merely a wrapper to snd_ctl_find_id(). + * + * Return: The pointer of the instance if found, or %NULL if not. + */ +static inline struct snd_kcontrol * +snd_ctl_find_id_mixer(struct snd_card *card, const char *name) +{ + struct snd_ctl_elem_id id = {}; + + id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; + strscpy(id.name, name, sizeof(id.name)); + return snd_ctl_find_id(card, &id); +} + int snd_ctl_create(struct snd_card *card); int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn); From patchwork Thu Jul 20 08:20:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13320008 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 8758AEB64DA for ; Thu, 20 Jul 2023 08:24:26 +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 B1ADC85D; Thu, 20 Jul 2023 10:23:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B1ADC85D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1689841464; bh=atkd7/pGRzIXeznoy/0HwXR1yM1YaoNVEkiQZ9FChjE=; 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=k/1ACguzSArbcLji0zp7TTiW3GrGj2OXf+VfuDjKtyw+RKzi6r1YVPU1uKXMwD69V hmwAL+RHD0hEBTdPJsm7xoST1+qykYEyrEX4Q9foMfhb9dNJ+qqGwRvKqrJ3nCX4wv d8kV7fIWr2nXkdGU4J28m0fdvFjlGgm9K8Qopy2w= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2EF7CF805D7; Thu, 20 Jul 2023 10:21:41 +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 90DB2F805D7; Thu, 20 Jul 2023 10:21:40 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 28202F805AE; Thu, 20 Jul 2023 10:21:36 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id EBBC1F8055C for ; Thu, 20 Jul 2023 10:21:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EBBC1F8055C Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=D/wWaeGQ; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=drBLxKZ2 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D89AF22A16; Thu, 20 Jul 2023 08:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689841275; h=from:from:reply-to: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=yeb97bre1Cm7+FfhwHXupgjJISWLuT8+HPz/HPaEC/k=; b=D/wWaeGQiqM65e7iuFKJwuJLuxdgoe9PUqs27ab/bh/7AXdabNoO5GqviC3Kx9R2Xho1DG 80sF/YO0f5oF0YheWEzQyfHtwfUmKsOaIy2KGRZZnKRu7WbLpk9J6wtiNYgBMKK0TXR+r/ qMnZVhfcFNsiymJi/Rzy37rp9qfFZQ4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689841275; h=from:from:reply-to: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=yeb97bre1Cm7+FfhwHXupgjJISWLuT8+HPz/HPaEC/k=; b=drBLxKZ2fYzc5CoM5JKL3G3hy5+63GhKWJi0A8ONErYByeVZpuCWoPMJWbeRQxGxyY/LZK /u6cXU2ZrXJM3NCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B240C133DD; Thu, 20 Jul 2023 08:21:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QLViKnvuuGQmIgAAMHmgww (envelope-from ); Thu, 20 Jul 2023 08:21:15 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Takashi Iwai Subject: [PATCH 02/11] ALSA: ca0106: Simplify with snd_ctl_find_id_mixer() Date: Thu, 20 Jul 2023 10:20:59 +0200 Message-Id: <20230720082108.31346-3-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230720082108.31346-1-tiwai@suse.de> References: <20230720082108.31346-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: 467QE4WRR73MERFB4LQDZG2PGZWZEZVE X-Message-ID-Hash: 467QE4WRR73MERFB4LQDZG2PGZWZEZVE X-MailFrom: tiwai@suse.de 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.8 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: Replace an open code with the new snd_ctl_find_id_mixer(). There is no functional change. Signed-off-by: Takashi Iwai --- 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); } From patchwork Thu Jul 20 08:21:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13320003 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 C78DAC001DC for ; Thu, 20 Jul 2023 08:23:08 +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 AF51E1FE; Thu, 20 Jul 2023 10:22:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AF51E1FE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1689841386; bh=HQlTMk0Z1K9Qkrg1H/Tfhp/RLCfyzJI/kjA7oAgjWiQ=; 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=hME+TiomLHzjQZKH4qhsfom1pgZqNScqsXkZGfE/YUlqkRtjWXcOdM/XUJSBdsHr2 AqDGdNpkgecDRwvIwuJaeL4XautBR3r6s+WRzDCx/HCjakkFdpp+eXpZKn0JNyvXbf mgkJLJJ0oZoxd78Hv696/uHS7eGrZjshDd/SOAPE= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 73A3BF8059F; Thu, 20 Jul 2023 10:21:27 +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 13DBAF800D2; Thu, 20 Jul 2023 10:21:27 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 99B77F8057B; Thu, 20 Jul 2023 10:21:22 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 86C50F80563 for ; Thu, 20 Jul 2023 10:21:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 86C50F80563 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=c9vjqDTn; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=GxUjEbrM Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id EF25620599; Thu, 20 Jul 2023 08:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689841275; h=from:from:reply-to: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=OxGSFeOvASua+zngCw7ZinrgYKEkfs0LHfbTvB1Kl1M=; b=c9vjqDTnKd0pFdyhUR5GEkC4wycwwJeI0O/CjG8J37Y5IfZMkpoFbckw9vUMHIyyPSsVfn JjWMC0j+gL97l8Hx0nXxdge2Yyx5JT9qy+zutblABJeVTf9xhOlAcQP/v6clarn7a/0ias CIoM8Un8MrPQTNRumIEU1Dhj4tX26w8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689841275; h=from:from:reply-to: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=OxGSFeOvASua+zngCw7ZinrgYKEkfs0LHfbTvB1Kl1M=; b=GxUjEbrMIZ8FPn4TQ47f0kUD10YAAyf9B5C2rB5pRRlqxfqKWYmgykMDF10Y0G8dTAybHY R3TDjLe03FiptiCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D07CD13924; Thu, 20 Jul 2023 08:21:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 2KQAMnvuuGQmIgAAMHmgww (envelope-from ); Thu, 20 Jul 2023 08:21:15 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Takashi Iwai Subject: [PATCH 03/11] ALSA: cs46xx: Simplify with snd_ctl_find_id_mixer() Date: Thu, 20 Jul 2023 10:21:00 +0200 Message-Id: <20230720082108.31346-4-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230720082108.31346-1-tiwai@suse.de> References: <20230720082108.31346-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: RB7ASXZTWBMVFCYTHZ4DHEB3XOS34GP3 X-Message-ID-Hash: RB7ASXZTWBMVFCYTHZ4DHEB3XOS34GP3 X-MailFrom: tiwai@suse.de 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.8 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: Replace an open code with the new snd_ctl_find_id_mixer(). There is no functional change. Signed-off-by: Takashi Iwai --- sound/pci/cs46xx/cs46xx_lib.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 7d882b33d45e..f3a94bb537bd 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c @@ -2449,7 +2449,6 @@ static int cs46xx_detect_codec(struct snd_cs46xx *chip, int codec) int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device) { struct snd_card *card = chip->card; - struct snd_ctl_elem_id id; int err; unsigned int idx; static const struct snd_ac97_bus_ops ops = { @@ -2490,10 +2489,8 @@ int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device) } /* get EAPD mixer switch (for voyetra hack) */ - memset(&id, 0, sizeof(id)); - id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - strcpy(id.name, "External Amplifier"); - chip->eapd_switch = snd_ctl_find_id(chip->card, &id); + chip->eapd_switch = snd_ctl_find_id_mixer(chip->card, + "External Amplifier"); #ifdef CONFIG_SND_CS46XX_NEW_DSP if (chip->nr_ac97_codecs == 1) { From patchwork Thu Jul 20 08:21:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13320005 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 0A270EB64DA for ; Thu, 20 Jul 2023 08:23:35 +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 BA7B61FC; Thu, 20 Jul 2023 10:22:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BA7B61FC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1689841412; bh=R5A7GIEzOLM1iml8w5hoA6pJCGHoPfftFm50Y3jeIXQ=; 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=PKQUeKZfZs4jldTh8x4Ms1+4vTSfrFS0YR67zk8bfz0IOJ0bduUoMunIsc3IH+CeI 0qXQk30Ee2TFH1Cu+He7S9yynbHL0jkxWP7IGQVrZ2cKJa5JtyICioVuw7Cq4EkwgA ToejVcOt6sMaQSzTlRBJpPMuDgrNbxB2m91S0OaA= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A29D8F805BB; Thu, 20 Jul 2023 10:21:33 +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 1F7D3F805B0; Thu, 20 Jul 2023 10:21:33 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 38E5AF805A9; Thu, 20 Jul 2023 10:21:29 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9722CF80564 for ; Thu, 20 Jul 2023 10:21:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9722CF80564 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=KMwghCmt; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=PoocrDVz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 2ED7122A17; Thu, 20 Jul 2023 08:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689841276; h=from:from:reply-to: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=7vHNyWvT387q2clwLlUp6chwdsB/tNC7DWkVIiH3ioc=; b=KMwghCmtpDUDx7BoTwOtFBcjDO3s0yd3NRiSESGgW7vX5GSfU09oA0aJHIXEIvQMD5fuye MbHPwYR1Z0aGLiG2p7xb208q3FW5Z2L9Vr/ViifzrsStiplrpsjy9zg4x5dvLHvzUsQdj4 ZFa4hJ0qy8BiKbgVJAJJFnBqNzp1v9w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689841276; h=from:from:reply-to: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=7vHNyWvT387q2clwLlUp6chwdsB/tNC7DWkVIiH3ioc=; b=PoocrDVzND7/wiYg6+RBAmbN/rZ5ScgW3cTJebSw472JjKTwu4o/o8eSQeypOZcoiOSpZM LyWDp5RSUc02iiCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F3AAB133DD; Thu, 20 Jul 2023 08:21:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mFN/OnvuuGQmIgAAMHmgww (envelope-from ); Thu, 20 Jul 2023 08:21:15 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Takashi Iwai Subject: [PATCH 04/11] ALSA: emu10k1: Simplify with snd_ctl_find_id_mixer() Date: Thu, 20 Jul 2023 10:21:01 +0200 Message-Id: <20230720082108.31346-5-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230720082108.31346-1-tiwai@suse.de> References: <20230720082108.31346-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: VJ7SKX43RZW3TLLTRVCTSBHSH2LBDIIQ X-Message-ID-Hash: VJ7SKX43RZW3TLLTRVCTSBHSH2LBDIIQ X-MailFrom: tiwai@suse.de 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.8 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: Replace an open code with the new snd_ctl_find_id_mixer(). There is no functional change. Signed-off-by: Takashi Iwai --- sound/pci/emu10k1/emumixer.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index f72a01f8f8f2..0a32ea53d8c6 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c @@ -1982,18 +1982,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)); - 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; From patchwork Thu Jul 20 08:21:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13320013 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 5FE24EB64DA for ; Thu, 20 Jul 2023 08:25:47 +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 9DC7886E; Thu, 20 Jul 2023 10:24:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9DC7886E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1689841545; bh=FX+ZOW47F066Qtxxzpu+vOWohmB18oe53AjabejB1+Q=; 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=HTESK48hwGlw9SX2F164y50oxvJojSXzzUQ6dMeIcZ5Eu7FGaKihCvdpYBDW2enW7 Lvf6adAh6gr18HHhn1Luz2j6jggRF17JZsGTem29vREwbeC7wwUFWm8UrlX4RgETRr 4jxnzGs0KLlTGrp4OKvFbg4mOjNQ8GvlYJM9n6w0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8EDCAF80564; Thu, 20 Jul 2023 10:23:31 +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 491B0F80557; Thu, 20 Jul 2023 10:23:31 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8A804F8032D; Thu, 20 Jul 2023 10:23:25 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 510DBF8056F for ; Thu, 20 Jul 2023 10:21:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 510DBF8056F Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=QTpIVNeN; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=9nA7caE3 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 765B42059A; Thu, 20 Jul 2023 08:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689841276; h=from:from:reply-to: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=DB+vYfx1hn3LaFRUZQuOUy/637bSLU0C9BrNp0ZxXZ8=; b=QTpIVNeNhEptHxDjZi5fxl/eEdgNxHcyqIKq788aT/oJrbL+lHuCo0kU6LLJBmbX6rbdbm h6Y05RbyjkCajt/ecRM6Zf9Xj8EPslE+3Ns12vDnWO6hIMOuhXeHYc/+GDsgQzye/3ZqjY mPugfpm1Qym2upPcQCF4lntTDXoKv7o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689841276; h=from:from:reply-to: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=DB+vYfx1hn3LaFRUZQuOUy/637bSLU0C9BrNp0ZxXZ8=; b=9nA7caE3u7jJNOZKxtIPSZDZpOnrUDJ0sjkSgdQJvY+4cDbiNviQKCpGG0H9sv0NJA23H/ N5BkkY+8BdUAwxDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 470E3133DD; Thu, 20 Jul 2023 08:21:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id OIcWDHzuuGQmIgAAMHmgww (envelope-from ); Thu, 20 Jul 2023 08:21:16 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Takashi Iwai Subject: [PATCH 05/11] ALSA: es1968: Simplify with snd_ctl_find_id_mixer() Date: Thu, 20 Jul 2023 10:21:02 +0200 Message-Id: <20230720082108.31346-6-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230720082108.31346-1-tiwai@suse.de> References: <20230720082108.31346-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: H42D52EXQ2M6MF6MS6XLS63VGLJRJWKP X-Message-ID-Hash: H42D52EXQ2M6MF6MS6XLS63VGLJRJWKP X-MailFrom: tiwai@suse.de 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.8 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: Replace an open code with the new snd_ctl_find_id_mixer(). There is no functional change. Signed-off-by: Takashi Iwai --- sound/pci/es1968.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 4a7e20bb11bc..4bc0f53c223b 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -2005,9 +2005,6 @@ snd_es1968_mixer(struct es1968 *chip) { struct snd_ac97_bus *pbus; struct snd_ac97_template ac97; -#ifndef CONFIG_SND_ES1968_INPUT - struct snd_ctl_elem_id elem_id; -#endif int err; static const struct snd_ac97_bus_ops ops = { .write = snd_es1968_ac97_write, @@ -2027,14 +2024,10 @@ snd_es1968_mixer(struct es1968 *chip) #ifndef CONFIG_SND_ES1968_INPUT /* attach master switch / volumes for h/w volume control */ - memset(&elem_id, 0, sizeof(elem_id)); - elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - strcpy(elem_id.name, "Master Playback Switch"); - chip->master_switch = snd_ctl_find_id(chip->card, &elem_id); - memset(&elem_id, 0, sizeof(elem_id)); - elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - strcpy(elem_id.name, "Master Playback Volume"); - chip->master_volume = snd_ctl_find_id(chip->card, &elem_id); + chip->master_switch = snd_ctl_find_id_mixer(chip->card, + "Master Playback Switch"); + chip->master_volume = snd_ctl_find_id_mixer(chip->card, + "Master Playback Volume"); #endif return 0; From patchwork Thu Jul 20 08:21:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13320006 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 5FAA5EB64DA for ; Thu, 20 Jul 2023 08:24:04 +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 6E2871F4; Thu, 20 Jul 2023 10:23:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6E2871F4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1689841442; bh=3ZbKJwObTrfZprQIX1Z/rbI9K4UAfCte+tJGEpVLCO8=; 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=Y20HbShGve2Y3dHK5E/r+52cuk7s9mxxHzZirX2Dk6BcvZdGlMmlzPx/XQGmTAjZu S5ckuHtDs4GQ8ivDi/O/2BhnQtSJM8fwYGBC5eLdkZMfma5ReAzbhM4y11g/H9RPA7 4ay1dfQFPXylhHbCGZfBGKX0C0CmThzC0MjdfOio= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0A1E1F805C7; Thu, 20 Jul 2023 10:21:38 +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 59188F805C0; Thu, 20 Jul 2023 10:21:37 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5BE31F805B6; Thu, 20 Jul 2023 10:21:33 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2A124F80567 for ; Thu, 20 Jul 2023 10:21:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2A124F80567 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=TL0kzQJh; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=zxribTo5 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A9B032059B; Thu, 20 Jul 2023 08:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689841276; h=from:from:reply-to: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=CEva5Y3WwOHaTzNqNrt8HQ9HtsFyOyyFO+HmgBN2y/g=; b=TL0kzQJhntkpxH+PlAWsTIvtc6TYYm7BpGI7dEDTCDs1eYaMNI0DWzEeoBPqCJ1y8gBlJC FmF+psANVV+4aJ3IfZFtEYcgA4tlzh1uxNDK1yBkIwYbomdWcieKUz/ONniNobTkmCDWX2 V1Nc1rMQRRuv9cz7RUinZ0hgAsJGsLQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689841276; h=from:from:reply-to: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=CEva5Y3WwOHaTzNqNrt8HQ9HtsFyOyyFO+HmgBN2y/g=; b=zxribTo5hlSblYWciksdFhrsrS+nPloZ4bdxHCkde+6kQD1nMpPHS3ga/Cgb2lppC3zLDb HZWu/MLVZo9unyDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7DD23133DD; Thu, 20 Jul 2023 08:21:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KDReHXzuuGQmIgAAMHmgww (envelope-from ); Thu, 20 Jul 2023 08:21:16 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Takashi Iwai Subject: [PATCH 06/11] ALSA: ice1712: Simplify with snd_ctl_find_id_mixer() Date: Thu, 20 Jul 2023 10:21:03 +0200 Message-Id: <20230720082108.31346-7-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230720082108.31346-1-tiwai@suse.de> References: <20230720082108.31346-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: 7FM6GCBTMTQF443OEPPRKAHQ5AT4YX5S X-Message-ID-Hash: 7FM6GCBTMTQF443OEPPRKAHQ5AT4YX5S X-MailFrom: tiwai@suse.de 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.8 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: Replace an open code with the new snd_ctl_find_id_mixer(). There is no functional change. Also, add the missing NULL checks in psc724_set_jack_state() to deal with error cases. Signed-off-by: Takashi Iwai --- sound/pci/ice1712/juli.c | 13 ++----------- sound/pci/ice1712/psc724.c | 19 ++++++++----------- sound/pci/ice1712/quartet.c | 13 ++----------- sound/pci/ice1712/wm8776.c | 6 +----- 4 files changed, 13 insertions(+), 38 deletions(-) diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index f0f8324b08b6..d80ecf1edc16 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c @@ -408,22 +408,13 @@ static const char * const follower_vols[] = { static DECLARE_TLV_DB_SCALE(juli_master_db_scale, -6350, 50, 1); -static struct snd_kcontrol *ctl_find(struct snd_card *card, - const char *name) -{ - struct snd_ctl_elem_id sid = {0}; - - strscpy(sid.name, name, sizeof(sid.name)); - sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - return snd_ctl_find_id(card, &sid); -} - 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); /* dev_dbg(card->dev, "add_followers - %s\n", *list); */ if (follower) { /* dev_dbg(card->dev, "follower %s found\n", *list); */ diff --git a/sound/pci/ice1712/psc724.c b/sound/pci/ice1712/psc724.c index 82cf365cda10..0818e42c94ca 100644 --- a/sound/pci/ice1712/psc724.c +++ b/sound/pci/ice1712/psc724.c @@ -177,7 +177,6 @@ static bool psc724_get_master_switch(struct snd_ice1712 *ice) static void psc724_set_jack_state(struct snd_ice1712 *ice, bool hp_connected) { struct psc724_spec *spec = ice->spec; - struct snd_ctl_elem_id elem_id; struct snd_kcontrol *kctl; u16 power = spec->wm8776.regs[WM8776_REG_PWRDOWN] & ~WM8776_PWR_HPPD; @@ -187,17 +186,15 @@ static void psc724_set_jack_state(struct snd_ice1712 *ice, bool hp_connected) snd_wm8776_set_power(&spec->wm8776, power); spec->hp_connected = hp_connected; /* notify about master speaker mute change */ - memset(&elem_id, 0, sizeof(elem_id)); - elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - strscpy(elem_id.name, "Master Speakers Playback Switch", - sizeof(elem_id.name)); - kctl = snd_ctl_find_id(ice->card, &elem_id); - snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); + kctl = snd_ctl_find_id_mixer(ice->card, + "Master Speakers Playback Switch"); + if (kctl) + snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); /* and headphone mute change */ - strscpy(elem_id.name, spec->wm8776.ctl[WM8776_CTL_HP_SW].name, - sizeof(elem_id.name)); - kctl = snd_ctl_find_id(ice->card, &elem_id); - snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); + kctl = snd_ctl_find_id_mixer(ice->card, + spec->wm8776.ctl[WM8776_CTL_HP_SW].name); + if (kctl) + snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); } static void psc724_update_hp_jack_state(struct work_struct *work) diff --git a/sound/pci/ice1712/quartet.c b/sound/pci/ice1712/quartet.c index 20b3e8f94719..9450c4b104f7 100644 --- a/sound/pci/ice1712/quartet.c +++ b/sound/pci/ice1712/quartet.c @@ -766,21 +766,12 @@ static const char * const follower_vols[] = { static DECLARE_TLV_DB_SCALE(qtet_master_db_scale, -6350, 50, 1); -static struct snd_kcontrol *ctl_find(struct snd_card *card, - const char *name) -{ - struct snd_ctl_elem_id sid = {0}; - - strscpy(sid.name, name, sizeof(sid.name)); - sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - return snd_ctl_find_id(card, &sid); -} - 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); } diff --git a/sound/pci/ice1712/wm8776.c b/sound/pci/ice1712/wm8776.c index 6eda86119dff..493425697bb4 100644 --- a/sound/pci/ice1712/wm8776.c +++ b/sound/pci/ice1712/wm8776.c @@ -34,13 +34,9 @@ static void snd_wm8776_activate_ctl(struct snd_wm8776 *wm, struct snd_card *card = wm->card; struct snd_kcontrol *kctl; struct snd_kcontrol_volatile *vd; - struct snd_ctl_elem_id elem_id; unsigned int index_offset; - memset(&elem_id, 0, sizeof(elem_id)); - strscpy(elem_id.name, ctl_name, sizeof(elem_id.name)); - elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - kctl = snd_ctl_find_id(card, &elem_id); + kctl = snd_ctl_find_id_mixer(card, ctl_name); if (!kctl) return; index_offset = snd_ctl_get_ioff(kctl, &kctl->id); From patchwork Thu Jul 20 08:21:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13320010 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 281D4EB64DA for ; Thu, 20 Jul 2023 08:24:57 +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 781874E; Thu, 20 Jul 2023 10:24:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 781874E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1689841495; bh=lJrH3gDCtAkg+90x5AWcNs82XlqZt1pFdmKcdZ4bYsY=; 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=OUOBaxkG1JPxAM0rcxtnuhj+/kMHNOhUVajB8nqrWTPhIM6ETRcvPGmZSX9jKzuPs NEV+umkkf26vzeyQIxKWaGGRY273qME1nXPh02l+Dn/eWttzLnijHVU2BdVeCTlO2s ovlLBWwiptCtOwt1aeZQHT4BvbwDJjGc7L7kdjvo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3F58BF805F7; Thu, 20 Jul 2023 10:21:45 +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 13795F805EA; Thu, 20 Jul 2023 10:21:45 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D3E35F805D7; Thu, 20 Jul 2023 10:21:39 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E12ABF80579 for ; Thu, 20 Jul 2023 10:21:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E12ABF80579 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=xdDDKW8C; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=mEdgwJQ7 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CD73B2059C; Thu, 20 Jul 2023 08:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689841276; h=from:from:reply-to: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=3r/FtEDnCnsRxswu2gYU+CsO43aX0mwDg/BHPXp6Fvo=; b=xdDDKW8CYYSU1d9rpahW2tTgJN6cYaQEc+xS5wppwBqCO5eiQe00V1xQPumD6e+GxXltoF xcju88DHobwOP0W4qgmfznIByZXXWyysdM2bD/s47DP8g8Ny/fjIlSzHcA9ezoyEgMgkGF QtUnK7arrJ/2Eht8QzwpvlX/RU7EDnk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689841276; h=from:from:reply-to: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=3r/FtEDnCnsRxswu2gYU+CsO43aX0mwDg/BHPXp6Fvo=; b=mEdgwJQ7U7t4tQP5g22INg5iAbF3fvVTZ/6u8Ub6q4oVGgFQmXiqYsN7lioD0ZovB6xBxP H+6sXtp7k1sN4hCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id ACCED13924; Thu, 20 Jul 2023 08:21:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aJFfKXzuuGQmIgAAMHmgww (envelope-from ); Thu, 20 Jul 2023 08:21:16 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Takashi Iwai Subject: [PATCH 07/11] ALSA: maestro3: Simplify with snd_ctl_find_id_mixer() Date: Thu, 20 Jul 2023 10:21:04 +0200 Message-Id: <20230720082108.31346-8-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230720082108.31346-1-tiwai@suse.de> References: <20230720082108.31346-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: DZLYMB574QS5NAHBMWTUUWKGZMSRAFN6 X-Message-ID-Hash: DZLYMB574QS5NAHBMWTUUWKGZMSRAFN6 X-MailFrom: tiwai@suse.de 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.8 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: Replace an open code with the new snd_ctl_find_id_mixer(). There is no functional change. Signed-off-by: Takashi Iwai --- sound/pci/maestro3.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 261850775c80..305cbd24a391 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -2029,9 +2029,6 @@ static int snd_m3_mixer(struct snd_m3 *chip) { struct snd_ac97_bus *pbus; struct snd_ac97_template ac97; -#ifndef CONFIG_SND_MAESTRO3_INPUT - struct snd_ctl_elem_id elem_id; -#endif int err; static const struct snd_ac97_bus_ops ops = { .write = snd_m3_ac97_write, @@ -2054,14 +2051,10 @@ static int snd_m3_mixer(struct snd_m3 *chip) snd_ac97_write(chip->ac97, AC97_PCM, 0); #ifndef CONFIG_SND_MAESTRO3_INPUT - memset(&elem_id, 0, sizeof(elem_id)); - elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - strcpy(elem_id.name, "Master Playback Switch"); - chip->master_switch = snd_ctl_find_id(chip->card, &elem_id); - memset(&elem_id, 0, sizeof(elem_id)); - elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - strcpy(elem_id.name, "Master Playback Volume"); - chip->master_volume = snd_ctl_find_id(chip->card, &elem_id); + chip->master_switch = snd_ctl_find_id_mixer(chip->card, + "Master Playback Switch"); + chip->master_volume = snd_ctl_find_id_mixer(chip->card, + "Master Playback Volume"); #endif return 0; From patchwork Thu Jul 20 08:21:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13320009 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 71E54EB64DA for ; Thu, 20 Jul 2023 08:24:46 +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 6C6E483E; Thu, 20 Jul 2023 10:23:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6C6E483E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1689841484; bh=KzzCJszpUd0J3SXbCewIsRuHijL8llFGLNfDm1O6n8g=; 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=oeLHw8J3fA+K8FSeFaHP9LLWbwGjZz4n5DbSNuDsMA0HxasFj8JBP8vymCqerJ+SO sgxMgbxMnt48S2i1N/is+1UzHrDO6lDtNdj99SYjbWV/I3lVUVd3B0vak/Ox/ksiM0 IRVa2XRsmxTnvqJBeKSdf1frlxIy7Z5lwqO6mfho= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A5818F805ED; Thu, 20 Jul 2023 10:21:43 +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 4C287F805E8; Thu, 20 Jul 2023 10:21:43 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4A9DEF805BF; Thu, 20 Jul 2023 10:21:38 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C5C4CF80570 for ; Thu, 20 Jul 2023 10:21:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C5C4CF80570 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=lOl2/qWS; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=hCP5lEZO Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 034732059D; Thu, 20 Jul 2023 08:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689841277; h=from:from:reply-to: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=5T3kG7ZHa/EgSbYDuam2xxh8RuXEIX5kvIC9Sx2D4oY=; b=lOl2/qWSlDVkqe3gpLwxfMYSPE18SfUFBaAwh+2sAVHbkcMil/RhTHzyLEksxZCly8QebQ /Nb7EH49ysv4XPJG/MVoKYRQ/N/ieIkdrNVf+suv0yRW3W4D+hBZ/Se8vTv9t6sqk9kE/t aBmyH2rBgqVutDEEfdxLV/Ue89jtbpU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689841277; h=from:from:reply-to: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=5T3kG7ZHa/EgSbYDuam2xxh8RuXEIX5kvIC9Sx2D4oY=; b=hCP5lEZOqeyZxEINJO95VcAZNBqLlap5YOLoH13V7usXdZO0FN0BOxc4DJ1/bHlXuo+92U rvqto+nZaaIuR9CA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D86F6133DD; Thu, 20 Jul 2023 08:21:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yM1GMnzuuGQmIgAAMHmgww (envelope-from ); Thu, 20 Jul 2023 08:21:16 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Takashi Iwai Subject: [PATCH 08/11] ALSA: via82xx: Simplify with snd_ctl_find_id_mixer() Date: Thu, 20 Jul 2023 10:21:05 +0200 Message-Id: <20230720082108.31346-9-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230720082108.31346-1-tiwai@suse.de> References: <20230720082108.31346-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: KQ2OBAM5WP73TO4ECLNGALPV4WWOSUYV X-Message-ID-Hash: KQ2OBAM5WP73TO4ECLNGALPV4WWOSUYV X-MailFrom: tiwai@suse.de 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.8 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: Replace an open code with the new snd_ctl_find_id_mixer(). There is no functional change. Signed-off-by: Takashi Iwai --- sound/pci/via82xx.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 361b83fd721e..d8666ff7bdfa 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -1984,11 +1984,7 @@ static int snd_via8233_init_misc(struct via82xx *chip) /* when no h/w PCM volume control is found, use DXS volume control * as the PCM vol control */ - struct snd_ctl_elem_id sid; - memset(&sid, 0, sizeof(sid)); - strcpy(sid.name, "PCM Playback Volume"); - sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - if (! snd_ctl_find_id(chip->card, &sid)) { + if (!snd_ctl_find_id_mixer(chip->card, "PCM Playback Volume")) { dev_info(chip->card->dev, "Using DXS as PCM Playback\n"); err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_pcmdxs_volume_control, chip)); From patchwork Thu Jul 20 08:21:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13320007 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 17416EB64DA for ; Thu, 20 Jul 2023 08:24:15 +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 E8E8C886; Thu, 20 Jul 2023 10:23:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E8E8C886 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1689841453; bh=7TDGZhqC9Vb7sNgIsaqQ74vomAC+1aAikC3adFunV90=; 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=Fu8fNvT93Subibgp8f/EkOYQUFRQ/i4fTulk1xYyLcTfceRuuegWEpepq+zFWMDVi iZkWUXV4sa/ZgQrWTorkOpjOOlGng6lWsMcYnvXidBmEWn1DlrXikerROTdbxXP/w2 GCR1uJYX7X875TBzMwZVJG/xMnbup9wd/qWwmaTI= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 539CCF805D6; Thu, 20 Jul 2023 10:21:39 +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 DB3DAF805CA; Thu, 20 Jul 2023 10:21:38 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B8A20F805BA; Thu, 20 Jul 2023 10:21:34 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E7C7FF8057A for ; Thu, 20 Jul 2023 10:21:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E7C7FF8057A Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=g5cixmiD; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=fKbnbnA0 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1F0712059E; Thu, 20 Jul 2023 08:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689841277; h=from:from:reply-to: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=UqSylQW4mlUNtN8vqZjztHnvqbzIMxqmyeP/M13SHzo=; b=g5cixmiD9ymttVLwgZxiGa8YcC9Sz1aJ8SQIeoj64dS1I4QTRaVgrMEhe/efWUlNZvkpog h1TMf0XtO/LeL3DCUiTMcfReHfMVLkVfT44I3AQHzjkp+CiCbl5AhRuq5ul+e41m24m3Kr FHL2YNjIJqcbDBK8Uv7B9NYq/e5PCDM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689841277; h=from:from:reply-to: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=UqSylQW4mlUNtN8vqZjztHnvqbzIMxqmyeP/M13SHzo=; b=fKbnbnA0rpb7KqsGeVEdlA8fqzvL5Fh+K7TJ8GjBhWV2IGbimH+bUZ2JtwHE7bNOyFpg+k Fi12BSfHnWjQBPBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 05C1B13924; Thu, 20 Jul 2023 08:21:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cO2DAH3uuGQmIgAAMHmgww (envelope-from ); Thu, 20 Jul 2023 08:21:17 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Takashi Iwai Subject: [PATCH 09/11] ALSA: cmipci: Simplify with snd_ctl_find_id_mixer() Date: Thu, 20 Jul 2023 10:21:06 +0200 Message-Id: <20230720082108.31346-10-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230720082108.31346-1-tiwai@suse.de> References: <20230720082108.31346-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: ILWCH3INGKR2HXEPXXPNA4IUZ2DUYXEA X-Message-ID-Hash: ILWCH3INGKR2HXEPXXPNA4IUZ2DUYXEA X-MailFrom: tiwai@suse.de 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.8 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: Replace an open code with the new snd_ctl_find_id_mixer(). There is no functional change. Signed-off-by: Takashi Iwai --- sound/pci/cmipci.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 6d25c12d9ef0..1415baac9c36 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -2734,12 +2734,8 @@ static int snd_cmipci_mixer_new(struct cmipci *cm, int pcm_spdif_device) } for (idx = 0; idx < CM_SAVED_MIXERS; idx++) { - struct snd_ctl_elem_id elem_id; struct snd_kcontrol *ctl; - memset(&elem_id, 0, sizeof(elem_id)); - elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - strcpy(elem_id.name, cm_saved_mixer[idx].name); - ctl = snd_ctl_find_id(cm->card, &elem_id); + ctl = snd_ctl_find_id_mixer(cm->card, cm_saved_mixer[idx].name); if (ctl) cm->mixer_res_ctl[idx] = ctl; } From patchwork Thu Jul 20 08:21:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13320011 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 1B420EB64DC for ; Thu, 20 Jul 2023 08:25:13 +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 A4EA6210; Thu, 20 Jul 2023 10:24:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A4EA6210 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1689841510; bh=UN5MfoQiMH0kLMy0KAHvDzXDdJPeAmYI3cXUkN5nFsE=; 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=TbwPfDv29AOM65VapyI+O8cOLwBSEObRbv6ju1v8mOLVIGCOfocVyB0NpSOqYcJ3o QCenIe8GGiX+s/j1SRJcMtGJ0cS+ECa30G5hUHnICqMocfhx1ONHH7Cu75OOASfuC3 Q04O/ktzMNxjPSft/cx2XeBqa1tBI7NUdXoXZO0I= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D9308F80153; Thu, 20 Jul 2023 10:23:26 +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 76AEEF800D2; Thu, 20 Jul 2023 10:23:26 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8C67CF8032D; Thu, 20 Jul 2023 10:23:22 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id DE0B9F80578 for ; Thu, 20 Jul 2023 10:21:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DE0B9F80578 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=XIhJsYut; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=2EahGONB Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 46C252059F; Thu, 20 Jul 2023 08:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689841277; h=from:from:reply-to: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=Z9GcxqEYpMX1bdRnBZr6GKoehA9jvtDPge/h0IwWcis=; b=XIhJsYutg0d4EzqNFwdgoWFFsiPIY6OFSRsPfnHYpkyGE7VVQ/5moadKKSQTD2MqHSTnvZ bxzgiz4u0pM1F+hGvzMx7vVOX0IWyeZsFBqUuwZQ+1VcGROMRAFlpQ+YRioCZZEg9FPfvu igZiS/fMRZmJoxlqT8Fkrri2bdyiUzM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689841277; h=from:from:reply-to: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=Z9GcxqEYpMX1bdRnBZr6GKoehA9jvtDPge/h0IwWcis=; b=2EahGONBEHoH+FDCEaxkwR8Mf8DDkttFPanVyloQHWOggOix3fhz1e6Rk2O6L5k7AIJJc2 YOgbYiGmXIy8/SBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 23521133DD; Thu, 20 Jul 2023 08:21:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CHzJB33uuGQmIgAAMHmgww (envelope-from ); Thu, 20 Jul 2023 08:21:17 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Takashi Iwai , Trevor Wu , Mark Brown Subject: [PATCH 10/11] ASoC: mediatek: mt8188: Simplify with snd_ctl_find_id_mixer() Date: Thu, 20 Jul 2023 10:21:07 +0200 Message-Id: <20230720082108.31346-11-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230720082108.31346-1-tiwai@suse.de> References: <20230720082108.31346-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: IEAS6A2MGGIOFPPVFAH3IHD6LPF3ICLH X-Message-ID-Hash: IEAS6A2MGGIOFPPVFAH3IHD6LPF3ICLH X-MailFrom: tiwai@suse.de 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.8 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: Replace an open code with the new snd_ctl_find_id_mixer(). There is no functional change. Cc: Trevor Wu Cc: Mark Brown Signed-off-by: Takashi Iwai Acked-by: Mark Brown --- sound/soc/mediatek/mt8188/mt8188-mt6359.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/sound/soc/mediatek/mt8188/mt8188-mt6359.c b/sound/soc/mediatek/mt8188/mt8188-mt6359.c index ac69c23e0da1..6ebcc9497ea0 100644 --- a/sound/soc/mediatek/mt8188/mt8188-mt6359.c +++ b/sound/soc/mediatek/mt8188/mt8188-mt6359.c @@ -969,16 +969,6 @@ static struct snd_soc_dai_link mt8188_mt6359_dai_links[] = { }, }; -static struct snd_kcontrol *ctl_find(struct snd_card *card, const char *name) -{ - struct snd_ctl_elem_id sid; - - memset(&sid, 0, sizeof(sid)); - strcpy(sid.name, name); - sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - return snd_ctl_find_id(card, &sid); -} - static void mt8188_fixup_controls(struct snd_soc_card *card) { struct mt8188_mt6359_priv *priv = snd_soc_card_get_drvdata(card); @@ -995,7 +985,7 @@ static void mt8188_fixup_controls(struct snd_soc_card *card) snd_soc_dapm_free_widget(w); } - kctl = ctl_find(card->snd_card, "Headphone Switch"); + kctl = snd_ctl_find_id_mixer(card->snd_card, "Headphone Switch"); if (kctl) snd_ctl_remove(card->snd_card, kctl); else From patchwork Thu Jul 20 08:21:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13320012 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 9C783EB64DD for ; Thu, 20 Jul 2023 08:25:32 +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 981D4844; Thu, 20 Jul 2023 10:24:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 981D4844 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1689841530; bh=+mkcZDrt9ZbU3ZmBcC66ZWAf34bWyxbnVn/MY3On43A=; 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=dneCQyfhmJ0YGP6hezTOV4127hmgYHT6FBzk+PFHkwrCzAPGE7VTGTr8o1RL1DykJ Xgl8SVSO83jln4k2AYBiLS+dPPYZdRgBOmg8ltf3/KRcHxnFZfxF70JJMkbeQhqkVt YqqBFD5RmrLTwrUEW5ahBHG87f1q9m3PiI5UPth4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D7577F80552; Thu, 20 Jul 2023 10:23:29 +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 68A89F80544; Thu, 20 Jul 2023 10:23:29 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3C753F8047D; Thu, 20 Jul 2023 10:23:23 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id CB389F80571 for ; Thu, 20 Jul 2023 10:21:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CB389F80571 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=DQqWXk8/; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=5YjcOzn/ Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 63BF222A18; Thu, 20 Jul 2023 08:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689841277; h=from:from:reply-to: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=Y4wm8M4OM8MKECZbZOt1K1Ap0+m1G55EdKz2DyJE6cU=; b=DQqWXk8/ed0FIjrxKogc2/+7NPmwTZzyXzngL80+ATEMBd0sgRK46kuO/Q3TeZd/420QUY GszFuy4VrJJTOuLBvmHgThAFbam3vw3RZuOuoPgfXJ6+bJDFmwSN2PNBzfac4GD7F1o0Rh iXXsYWl9NzODnecGQIsyU/cOsQNhJuo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689841277; h=from:from:reply-to: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=Y4wm8M4OM8MKECZbZOt1K1Ap0+m1G55EdKz2DyJE6cU=; b=5YjcOzn/hCfnT4NNEFEBQrM+6FJ1pdUHlZDiTCqvrsbHPFNCTlMCCCXE00oiYdDa2UxuIK uIapwCerAqJrTXDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4A44913924; Thu, 20 Jul 2023 08:21:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SIc9EX3uuGQmIgAAMHmgww (envelope-from ); Thu, 20 Jul 2023 08:21:17 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: Takashi Iwai Subject: [PATCH 11/11] ALSA: ac97: Simplify with snd_ctl_find_id_mixer() Date: Thu, 20 Jul 2023 10:21:08 +0200 Message-Id: <20230720082108.31346-12-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230720082108.31346-1-tiwai@suse.de> References: <20230720082108.31346-1-tiwai@suse.de> MIME-Version: 1.0 Message-ID-Hash: NSWB6PDGBFZMMPIRULWK6HSXXQGKPWZH X-Message-ID-Hash: NSWB6PDGBFZMMPIRULWK6HSXXQGKPWZH X-MailFrom: tiwai@suse.de 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.8 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: Replace an open code with the new snd_ctl_find_id_mixer(). There is no functional change. Signed-off-by: Takashi Iwai --- sound/pci/ac97/ac97_patch.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 4b5f33de70d5..ccfd9c7bf900 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c @@ -3431,11 +3431,7 @@ static const char * const follower_sws_vt1616[] = { static struct snd_kcontrol *snd_ac97_find_mixer_ctl(struct snd_ac97 *ac97, const char *name) { - struct snd_ctl_elem_id id; - memset(&id, 0, sizeof(id)); - id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - strcpy(id.name, name); - return snd_ctl_find_id(ac97->bus->card, &id); + return snd_ctl_find_id_mixer(ac97->bus->card, name); } /* create a virtual master control and add followers */