lkml.org 
[lkml]   [2022]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2022-06-22 15:12    [W:0.062 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site