On 01.02.21 09:42, Takashi Iwai wrote:
snd_ctl_new() can be used for allocating the multiple instances in one kcontrol. If the kctl object is created in this way, you'd just need to change your code to retrieve the kctl index via snd_ctl_get_ioff() instead of referring to kctl->index directly.
Hi, thanks for the response. snd_ctl_new() is static and unexported, should I provide this patch (below) as well? And if so, together with this one or separately?
Thanks, best regards
diff --git a/include/sound/control.h b/include/sound/control.h index 77d9fa10812d..a5920090fdca 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -116,6 +116,7 @@ typedef int (*snd_kctl_ioctl_func_t) (struct snd_card * card,
void snd_ctl_notify(struct snd_card * card, unsigned int mask, struct snd_ctl_elem_id * id);
+int snd_ctl_new(struct snd_kcontrol **kctl, unsigned int count, unsigned int access, struct snd_ctl_file *file); struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new * kcontrolnew, void * private_data); void snd_ctl_free_one(struct snd_kcontrol * kcontrol); int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol); diff --git a/sound/core/control.c b/sound/core/control.c index 3b44378b9dec..066288218b81 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -194,7 +194,7 @@ EXPORT_SYMBOL(snd_ctl_notify); * * Return: 0 on success, error code on failure */ -static int snd_ctl_new(struct snd_kcontrol **kctl, unsigned int count, +int snd_ctl_new(struct snd_kcontrol **kctl, unsigned int count, unsigned int access, struct snd_ctl_file *file) { unsigned int idx; @@ -214,6 +214,7 @@ static int snd_ctl_new(struct snd_kcontrol **kctl, unsigned int count,
return 0; } +EXPORT_SYMBOL(snd_ctl_new);