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 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 7E8EDC43334 for ; Wed, 22 Jun 2022 13:11:04 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8E1731F6D; Wed, 22 Jun 2022 15:10:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8E1731F6D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1655903462; bh=3Ur4dHBuUUDP964QLvooTJDDBd0SW01UopYEBOliLrA=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JGIJSQIUCuURYwS5LE21m0pJ7jWtVP+ItHPN6Mq3wgJxJsSWR8CJjD3P6dgUCuggY B99afh1yl0+Llz9IkAO3lRTOJYr2Xi3CQeQ7mFjT0DcOBkInKRx7oHn4ZQUl4xyEZ7 y0wcB2VappgbS5EV4WQsalOnyvJ+Wt94vNAAW+us= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2B92CF8019B; Wed, 22 Jun 2022 15:10:12 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CE1CEF802D2; Wed, 22 Jun 2022 15:10:10 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id DFE76F8019B for ; Wed, 22 Jun 2022 15:10:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DFE76F8019B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="iP0LQU0B"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="XaYsgD3x" 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?= 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 Cc: alsa-devel@alsa-project.org, Vitaly Rodionov , patches@opensource.cirrus.com, Takashi Iwai , Stefan Binding , Mark Brown , linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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