diff mbox

[2/4] ctl: fix a bug to return no identical information in info operation for userspace controls

Message ID 1428741665-22262-3-git-send-email-o-takashi@sakamocchi.jp (mailing list archive)
State Accepted
Commit c378c3b03c8d6eef2d2600d0279e2c718d6a0a44
Headers show

Commit Message

Takashi Sakamoto April 11, 2015, 8:41 a.m. UTC
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>
---
 sound/core/control.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Takashi Iwai April 11, 2015, 3:40 p.m. UTC | #1
At Sat, 11 Apr 2015 17:41:03 +0900,
Takashi Sakamoto wrote:
> 
> 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>

Applied, thanks.


Takashi

> ---
>  sound/core/control.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/sound/core/control.c b/sound/core/control.c
> index 90a9e5d..a750846 100644
> --- a/sound/core/control.c
> +++ b/sound/core/control.c
> @@ -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;
> -- 
> 2.1.0
>
diff mbox

Patch

diff --git a/sound/core/control.c b/sound/core/control.c
index 90a9e5d..a750846 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -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;