Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1334676lqz; Mon, 1 Apr 2024 03:02:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXxkaeWUrUJKKLCW5zfywX4NQgciBAOn5SL0uYay/PHwLufGtvutdt4HkNcTHfiPZP0vAEzTertRNUeMq7QWv1rciBO3qJeQJXg3GRExg== X-Google-Smtp-Source: AGHT+IGKU3JvyeZ+gn9jSyJTfFvCuHPEX93PYD0csTf4YK7KKAmSjGnJ0xK3cIz3aFk04kearhEq X-Received: by 2002:a17:90a:a616:b0:2a0:2a36:91a0 with SMTP id c22-20020a17090aa61600b002a02a3691a0mr8163671pjq.18.1711965750119; Mon, 01 Apr 2024 03:02:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711965750; cv=pass; d=google.com; s=arc-20160816; b=OE7OoL9RAgAK3FMjoJGTqOYPw6YrJqSVZL8WOT1DGb9Uze3G7sx2Y8rrAMiVF24oiF +TZz7VYh+3Gn0g0U4sXZiiI/CmD5y1BHrgOEGuh4lu/ss2IuhAh7WhTpgRKpf4RrSo91 c6gKbwfO0Vg0t1FEbg8qEX9tetLyfeOK/J0EIrMIcBqTng0j8skvqztYbHSND0NIf4q7 E7tjkYb5WPSzcyfWhkovZtMtk71hOoSuFJhuW3jeddJIninG8h/zDFTsgDnGTSdDAzSN 4d+Kl4I400g7Fdol6YjjfQu3jQVZyKUOFmhvA+HrKmkQHeiq5fMc7wGkEDCVpjH73GFa 9a2g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=sQ1IUPXI8DEMkqDZPY9mFbPrpEApJsB5PFIBxvjEGNc=; fh=x7+OzJIeN5mJd4Ln+gczq2EazpTbLb1MfGhRMe/0Fjo=; b=AnocW/iazRoOhsDovE86JM6qPfCJJFXeodR/aicsYwWrqg4v/99iRszd1p5ApRp11k 3cUcVRwvue30f7vjwnyESgw+Umc77Ng2utQ69lurEyFVZK50/Cm8aNcRTIcCC2Pvntui 9sghqv2pB8iJluYRdVuUuw1B3VjnNJ2jQjUmyDhmkppn+Kk/HlWpE0Do6bo80d08JWZI P8qVVNWiprhvUZhJwNbKGE/ItGZl8OBs+WccrXh1yq05R38qvinxwyCaW5OMQ09S4J1y hExfWo0T/WOTLSS6QPSOnUFeRBZHerJF3NEuP+6P80ER+k8m7Umd4SfFeq/3vvoKsOqh 6xqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=mgLiezN4; arc=pass (i=1 spf=pass spfdomain=opensource.cirrus.com dkim=pass dkdomain=cirrus.com dmarc=pass fromdomain=opensource.cirrus.com); spf=pass (google.com: domain of linux-kernel+bounces-126582-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126582-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i7-20020a17090a650700b0029df6f09e19si10664198pjj.41.2024.04.01.03.02.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 03:02:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-126582-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=mgLiezN4; arc=pass (i=1 spf=pass spfdomain=opensource.cirrus.com dkim=pass dkdomain=cirrus.com dmarc=pass fromdomain=opensource.cirrus.com); spf=pass (google.com: domain of linux-kernel+bounces-126582-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126582-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B2B26281C94 for ; Mon, 1 Apr 2024 10:02:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FF6612E51; Mon, 1 Apr 2024 10:02:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="mgLiezN4" Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B3281119B; Mon, 1 Apr 2024 10:02:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.149.25 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711965742; cv=none; b=SC2qnXmS7Nx7nwmEMgurWJ3FFhzQShZsO69B3hR9iCNkqHPoJb3ftzOYMxbSi/ZgfjkU1FAqN3YBYInFOX9laP3dsjfapdT7wFd0krUEcYvDNZCtjHUHapOulNkKABf5UN9pGCQkAu2e8wPRSe9+pYxc+IJVWDoikCmjI97nABY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711965742; c=relaxed/simple; bh=+iI5RpOodzmJXIcv8TNfNZngHxLuBoKhh3Wx6e3sdys=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=f+xtDkG6MpEbzoMYGSGWXXMPrsT+f6zQio+Uf4Ud0PtGR+BiBxchdrbzJI4phWW6qlmsinQe5ZNuOUThL3trKVSVPJ2Xop5bDDbNZJcEq5ANrO+90ZAAOYZWzLi1gPE/rbc52MvC+d8Z9ZU3UZb5tviwJ+84Z9VuaLdyjNesqyo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=mgLiezN4; arc=none smtp.client-ip=67.231.149.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4315mEb2029960; Mon, 1 Apr 2024 05:02:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=sQ1IUPXI8DEMkqDZPY9mFbPrpEApJsB5PFIBxvjEGNc=; b= mgLiezN4B9M97zdJa2B9mJJIlEvdtKAmQvQ25qj9x0iq+Sr2H3eXRhZ0ErK9EDUo sxvU5EnRtLh16L9VCgJSLyEbnIC+cGnHWEdMnxwENAd4gniY3rzGhbP/aoOJPaTc ZBznDgrJvUOHrWAPMAOKURns0GBqJv8W0rU/3jcxt1VaUMk83pctHMNTnBCFXi2M UgHxMt1QVl3D7aB3cBDmf2NJiQIGf9wecNhpYg2gbORMXHL6mGtOTdll6PepU5Xw l934i0pbwJbuq4NKDWOAJHIZxlXM08ZnpDkH5BFfRyW3DwWtOdTTB8Q+4RQgccmm BOMv5wKrFDNSTj17GWAMxQ== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3x6g4xhtw6-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Apr 2024 05:02:13 -0500 (CDT) Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 1 Apr 2024 11:02:10 +0100 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1544.9 via Frontend Transport; Mon, 1 Apr 2024 11:02:10 +0100 Received: from ediswws06.ad.cirrus.com (ediswws06.ad.cirrus.com [198.90.208.18]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id 3AFD482026C; Mon, 1 Apr 2024 10:02:10 +0000 (UTC) From: Richard Fitzgerald To: , CC: , , , , "Richard Fitzgerald" Subject: [PATCH v2 1/3] ALSA: control: Introduce snd_ctl_find_id_mixer_locked() Date: Mon, 1 Apr 2024 10:02:08 +0000 Message-ID: <20240401100210.61277-2-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240401100210.61277-1-rf@opensource.cirrus.com> References: <20240401100210.61277-1-rf@opensource.cirrus.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: jYmcIEZ1JebaiO2pZCLbge7bIdn-bFPC X-Proofpoint-GUID: jYmcIEZ1JebaiO2pZCLbge7bIdn-bFPC X-Proofpoint-Spam-Reason: safe Adds wrapper function snd_ctl_find_id_mixer_locked(). This is identical to snd_ctl_find_id_mixer() except that it can be called from code that is already holding controls_rwsem. Signed-off-by: Richard Fitzgerald --- include/sound/control.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/sound/control.h b/include/sound/control.h index 9a4f4f7138da..c1659036c4a7 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -167,6 +167,29 @@ snd_ctl_find_id_mixer(struct snd_card *card, const char *name) return snd_ctl_find_id(card, &id); } +/** + * snd_ctl_find_id_mixer_locked - 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_locked(). + * The caller must down card->controls_rwsem before calling this function. + * + * Return: The pointer of the instance if found, or %NULL if not. + */ +static inline struct snd_kcontrol * +snd_ctl_find_id_mixer_locked(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_locked(card, &id); +} + int snd_ctl_create(struct snd_card *card); int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn); -- 2.39.2