[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87y1xon8sz.wl-tiwai@suse.de>
Date: Wed, 22 Jun 2022 15:10:04 +0200
From: Takashi Iwai <tiwai@...e.de>
To: Amadeusz Sławiński
<amadeuszx.slawinski@...ux.intel.com>
Cc: Vitaly Rodionov <vitalyr@...nsource.cirrus.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, Mark Brown <broonie@...nel.org>,
patches@...nsource.cirrus.com, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org,
Stefan Binding <sbinding@...nsource.cirrus.com>
Subject: Re: [PATCH v7 01/14] ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls
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
Powered by blists - more mailing lists