Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp3014699rdb; Tue, 6 Feb 2024 04:58:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IEciJ/ob0guub4eu/5qqovs+5Ppp57xdqouX7UeMASvd+n56EutjGXkAfDeSfn7IRUUVwu0 X-Received: by 2002:a54:4512:0:b0:3be:d941:621b with SMTP id l18-20020a544512000000b003bed941621bmr2106439oil.26.1707224320029; Tue, 06 Feb 2024 04:58:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707224320; cv=pass; d=google.com; s=arc-20160816; b=KRQWqh+FOHjm/2+sSnHPQpcFTqHx/TC2cuoNsK4tccXBEJ1wZ1+XXimI6oNNQ7NHOl bcv59Nk25T49hlnXXKOaEuApyZrV0FWfnxPOEFyod6FE7t3sZEd22JRPkv3xmIfoo1Mr 6YDwa+5Pqb9MfAtdgfiw2KeG1ESGKhfB+pu9BX8XcAJ/qMi0djzu7uyokGd/fdSQ1bwu 5yTKuYVpmG0VymPYddvw8kIgYkGfZmIsU6npwViBzQO5fEKwIyXMGfqRyrmoVt1UCMt1 kSLWyYgIZ9z4p1etZAEtNrOjYNRBc8Sh1auvpmeVVUzIt+jYfK+x2sZIlcfcV8mwfAFP AlYw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature:dkim-signature:dkim-signature:dkim-signature; bh=hrPdcscD82ZUY6PH9OM5wcI+tI4zDbEnOTR3kzNVpoY=; fh=4aoaFh9MK+N+z2OtLW+/I+lJpdb5nbtJujpYK3qCN2A=; b=ZuF2f1p3p7luhRGk54HIW6XntRIJXwG6hINzEU5v2071coJ5hxB/H/nFS7w0WtxfMY IfovX7yuN4FBqcgkNMrKq4m3C5rpJh6rEau2KRkJ2MTWbPnwPGWuynud+za222B0CiBd LyJk1E2ZWL411N68K/ztvjDPCVMNZ5RXHDM+z+CizBEp0OU9rFvCURlr35CAXQVaYfl/ q+olz+e9bkklMusisMatIK+cSGZP+MFXDMuIfnK6HjN5iU9TwLi4tuR3TYfQJcpIi5MX OBcbWbV38l0utPnQfTNrGtCk9pGaKh6urSgmAGyihTv6SIoHzBILGZbtAcQTdbf0SOON OIfg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Vu0o+OOJ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Vu0o+OOJ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-54976-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54976-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de X-Forwarded-Encrypted: i=1; AJvYcCW9/ZjgHdqWLxfMzMbLcqzbqglkRsZZoJ9ykTTkdQebVX7ILval9YwOas/RchPD1ycuJf1k7lPcPDeiuJqdeIeZx5nZwi/l7wMVbxecMw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x12-20020a05622a000c00b0042bec0c07a4si2270017qtw.413.2024.02.06.04.58.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 04:58:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54976-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Vu0o+OOJ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Vu0o+OOJ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-54976-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54976-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 696531C217CA for ; Tue, 6 Feb 2024 12:58:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2BED7131721; Tue, 6 Feb 2024 12:57:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Vu0o+OOJ"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="so+rAKsH"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Vu0o+OOJ"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="so+rAKsH" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82B5D12F386; Tue, 6 Feb 2024 12:57:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707224271; cv=none; b=Y8R7QqJTwgNdf+6uh4WU1Pi+pfI8QGtPrw/ciYFN6rsSF1uHsuyQmuGl23hs1RLwWySWpzVXH0vDAjlwK1iLrrZU4WG6wfUVEk/wP2h9opfSVBITnkJkQUByuWod5bYbpzPwwsys67wQ2VJKSSjydi5Vsiwgso/Ih+BKBkIs4AE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707224271; c=relaxed/simple; bh=iL0HRojAzYDaeWoChYZcGEd6ts/epCRxUVQaIOugMFE=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=KFOxX6movHkMkcO8CwNthfGh4Kup1SabrWzCcOaV+tPGXkyKZ7WWC/Lr5p9bHOby8z5nhU6lraFCbq6XRnmA2VXJnH25Mza0GmpM1YFNi08ONDDSXndA4O3U3OgRa/3uJhJJL4Np4TTDLSXsKt7Oe4C8eP8EYcb0fg++X7901oM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=Vu0o+OOJ; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=so+rAKsH; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=Vu0o+OOJ; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=so+rAKsH; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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 smtp-out1.suse.de (Postfix) with ESMTPS id 63FFE21F97; Tue, 6 Feb 2024 12:57:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707224267; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hrPdcscD82ZUY6PH9OM5wcI+tI4zDbEnOTR3kzNVpoY=; b=Vu0o+OOJCFymyujwpECX00A2LCtfKTRvohJSFlRp2HCQDi2ASSyoXDk1TRT9PKwu321lSM DQQMpThrEAdi3gZ19WRBx0XyssIohW0LukqZnIfCIJJNNC5o5z/QvL6R32M7/sAqM4cQR1 EAoGKcKPoWnRCVoChWgr7HnZqBqnH7E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707224267; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hrPdcscD82ZUY6PH9OM5wcI+tI4zDbEnOTR3kzNVpoY=; b=so+rAKsHbAGYwYUwwIrZetLGZ3KJ5tk2kB6NITrgOAmtmPCU6vhDIr769baVDdI9a+KnWu RA/S6XqmGkLW6GDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707224267; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hrPdcscD82ZUY6PH9OM5wcI+tI4zDbEnOTR3kzNVpoY=; b=Vu0o+OOJCFymyujwpECX00A2LCtfKTRvohJSFlRp2HCQDi2ASSyoXDk1TRT9PKwu321lSM DQQMpThrEAdi3gZ19WRBx0XyssIohW0LukqZnIfCIJJNNC5o5z/QvL6R32M7/sAqM4cQR1 EAoGKcKPoWnRCVoChWgr7HnZqBqnH7E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707224267; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hrPdcscD82ZUY6PH9OM5wcI+tI4zDbEnOTR3kzNVpoY=; b=so+rAKsHbAGYwYUwwIrZetLGZ3KJ5tk2kB6NITrgOAmtmPCU6vhDIr769baVDdI9a+KnWu RA/S6XqmGkLW6GDA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1A5CB139D8; Tue, 6 Feb 2024 12:57:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id jP2zBcsswmXfMwAAD6G6ig (envelope-from ); Tue, 06 Feb 2024 12:57:47 +0000 Date: Tue, 06 Feb 2024 13:57:46 +0100 Message-ID: <871q9pwy0l.wl-tiwai@suse.de> From: Takashi Iwai To: Wesley Cheng Cc: , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v13 48/53] ALSA: usb-audio: mixer: Add USB offloading mixer control In-Reply-To: <20240203023645.31105-49-quic_wcheng@quicinc.com> References: <20240203023645.31105-1-quic_wcheng@quicinc.com> <20240203023645.31105-49-quic_wcheng@quicinc.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Level: Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Vu0o+OOJ; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=so+rAKsH X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-2.60 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; R_RATELIMIT(0.00)[to_ip_from(RLe67txhfobum3fqdb5xx8e3au)]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.09)[64.59%]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TAGGED_RCPT(0.00)[dt]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.00)[-1.000]; DWL_DNSWL_HI(-3.50)[suse.de:dkim]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWELVE(0.00)[23]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,quicinc.com:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FREEMAIL_CC(0.00)[linaro.org,intel.com,perex.cz,kernel.org,lwn.net,gmail.com,linuxfoundation.org,synopsys.com,quicinc.com,suse.com,vger.kernel.org,alsa-project.org]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Score: -2.60 X-Rspamd-Queue-Id: 63FFE21F97 X-Spam-Flag: NO On Sat, 03 Feb 2024 03:36:40 +0100, Wesley Cheng wrote: > > In order to allow userspace/applications know about USB offloading status, > expose a sound kcontrol that fetches information about which sound card > index is associated with the ASoC platform card supporting offloading. In > the USB audio offloading framework, the ASoC BE DAI link is the entity > responsible for registering to the SOC USB layer. SOC USB will expose more > details about the current offloading status, which includes the USB sound > card and USB PCM device indexes currently being used. > > Signed-off-by: Wesley Cheng The concept is understandable, but the control element name ("SNDUSB OFFLD playback available") looks non-intrusive and non-conformant. Use a bit more understandable name instead. This provides a card number where the offload driver is bound, and the name should indicate something about that. Also, about the implementation: > +static int > +snd_usb_offload_create_mixer(struct usb_mixer_interface *mixer, > + const struct snd_kcontrol_new *new_kctl) > +{ > + struct snd_kcontrol *kctl; > + struct usb_mixer_elem_info *elem; > + > + elem = kzalloc(sizeof(struct usb_mixer_elem_info), GFP_KERNEL); > + if (!elem) > + return -ENOMEM; > + > + elem->head.mixer = mixer; > + elem->val_type = USB_MIXER_S32; > + elem->control = 0; > + elem->head.id = 0; > + elem->channels = 1; > + > + kctl = snd_ctl_new1(new_kctl, elem); > + if (!kctl) { > + kfree(elem); > + return -ENOMEM; > + } > + kctl->private_free = snd_usb_mixer_elem_free; > + > + return snd_usb_mixer_add_control(&elem->head, kctl); This control has almost little to do with the standard USB interface, and it'll be much simpler if you create a raw control element. Pass the bus or the sysdev to private_data, and that's all you need in the get callback. Also, don't forget to set the proper access bits (it's read-only). thanks, Takashi