ALSA: ctl: fix a bug to return no identical information in info operation for userspa...
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sat, 11 Apr 2015 08:41:03 +0000 (17:41 +0900)
committerTakashi Iwai <tiwai@suse.de>
Sat, 11 Apr 2015 15:32:16 +0000 (17:32 +0200)
In operations of SNDRV_CTL_IOCTL_ELEM_INFO, identical information in
returned value is cleared. This is not better to userspace application.

This commit confirms to return full identical information to the
operations.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/control.c

index 90a9e5d9819af8aa76c5faf5fb5afe96b6283b45..a750846514dc050ab03a4d4b4f868e075cb52995 100644 (file)
@@ -1040,8 +1040,12 @@ static int snd_ctl_elem_user_info(struct snd_kcontrol *kcontrol,
                                  struct snd_ctl_elem_info *uinfo)
 {
        struct user_element *ue = kcontrol->private_data;
+       unsigned int offset;
 
+       offset = snd_ctl_get_ioff(kcontrol, &uinfo->id);
        *uinfo = ue->info;
+       snd_ctl_build_ioff(&uinfo->id, kcontrol, offset);
+
        return 0;
 }
 
@@ -1051,10 +1055,13 @@ static int snd_ctl_elem_user_enum_info(struct snd_kcontrol *kcontrol,
        struct user_element *ue = kcontrol->private_data;
        const char *names;
        unsigned int item;
+       unsigned int offset;
 
        item = uinfo->value.enumerated.item;
 
+       offset = snd_ctl_get_ioff(kcontrol, &uinfo->id);
        *uinfo = ue->info;
+       snd_ctl_build_ioff(&uinfo->id, kcontrol, offset);
 
        item = min(item, uinfo->value.enumerated.items - 1);
        uinfo->value.enumerated.item = item;