From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F23A0C433EF for ; Wed, 22 Jun 2022 13:10:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352156AbiFVNKO (ORCPT ); Wed, 22 Jun 2022 09:10:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352087AbiFVNKL (ORCPT ); Wed, 22 Jun 2022 09:10:11 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B02816585 for ; Wed, 22 Jun 2022 06:10:07 -0700 (PDT) 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 BBBDB21B7D; Wed, 22 Jun 2022 13:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1655903405; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TPq/PYAfUeArN2v5LZAdETQPOiri6zDleVEOUExbxsM=; b=iP0LQU0B72dXyEUXeiRd7ei2C5Kw3uGLRK+eFb6ZN2ODd+acmfdbWaQ6QiLCwmyiLlh4pL GCp5xyY4BFgK3gruF61bPHj5cKw8TSN3TC3jJNktrNCHSWfhmhmrComYP5D80zwabefYvB +k0qfsPdES1FcqKrYQWzhiOhBLuNz5Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1655903405; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TPq/PYAfUeArN2v5LZAdETQPOiri6zDleVEOUExbxsM=; b=XaYsgD3xTNr7U669pBlBhguFGCGPn+Eheg6V25EOLcDMQsFShk58TeluQOffovNTBO+y2z +0ZELqC1exxk23BA== 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 8AA4B134A9; Wed, 22 Jun 2022 13:10:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id XZE1Ia0Us2KgKAAAMHmgww (envelope-from ); Wed, 22 Jun 2022 13:10:05 +0000 Date: Wed, 22 Jun 2022 15:10:04 +0200 Message-ID: <87y1xon8sz.wl-tiwai@suse.de> From: Takashi Iwai To: Amadeusz =?ISO-8859-2?Q?S=B3awi=F1ski?= Cc: Vitaly Rodionov , Jaroslav Kysela , Takashi Iwai , Mark Brown , patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Stefan Binding Subject: Re: [PATCH v7 01/14] ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls In-Reply-To: References: <20220622074653.179078-1-vitalyr@opensource.cirrus.com> <20220622074653.179078-2-vitalyr@opensource.cirrus.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 22 Jun 2022 10:40:20 +0200, Amadeusz Sławiński wrote: > > > +static int hda_cs_dsp_add_kcontrol(struct hda_cs_dsp_coeff_ctl *ctl) > > +{ > > + struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl; > > + struct snd_kcontrol_new *kcontrol; > > + struct snd_kcontrol *kctl; > > + int ret = 0; > > + > > + if (cs_ctl->len > ADSP_MAX_STD_CTRL_SIZE) { > > + dev_err(cs_ctl->dsp->dev, "Control %s: length %zu exceeds maximum %d\n", ctl->name, > > + cs_ctl->len, ADSP_MAX_STD_CTRL_SIZE); > > + return -EINVAL; > > + } > > + > > + kcontrol = kzalloc(sizeof(*kcontrol), GFP_KERNEL); > > + if (!kcontrol) > > + return -ENOMEM; > > + > > + kcontrol->name = ctl->name; > > + kcontrol->info = hda_cs_dsp_coeff_info; > > + kcontrol->iface = SNDRV_CTL_ELEM_IFACE_MIXER; > > + kcontrol->private_value = (unsigned long)ctl; > > + kcontrol->access = wmfw_convert_flags(cs_ctl->flags); > > + > > + kcontrol->get = hda_cs_dsp_coeff_get; > > + kcontrol->put = hda_cs_dsp_coeff_put; > > + > > + kctl = snd_ctl_new1(kcontrol, NULL); > > Wouldn't > kctl = snd_ctl_new1(kcontrol, ctl); > work instead of > kcontrol->private_value = (unsigned long)ctl; > ... > kctl = snd_ctl_new1(kcontrol, NULL); > ? The second argument to snd_ctl_new1() is set to private_data field, while private_value is taken from snd_kcontrol_new template. Takashi