All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: aloop: Fix initialization of controls
@ 2021-04-07  7:54 Jonas Holmberg
  2021-04-07  8:01 ` Jaroslav Kysela
  2021-04-07  8:22 ` Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Jonas Holmberg @ 2021-04-07  7:54 UTC (permalink / raw)
  To: tiwai, alsa-devel

Add a control to the card before copying the id so that the numid field
is initialized in the copy. Otherwise the numid field of active_id,
format_id, rate_id and channels_id will be the same (0) and
snd_ctl_notify() will not queue the events properly.

Signed-off-by: Jonas Holmberg <jonashg@axis.com>
---
 sound/drivers/aloop.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
index 52637180af33..80b814b9922a 100644
--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -1571,6 +1571,14 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
 					return -ENOMEM;
 				kctl->id.device = dev;
 				kctl->id.subdevice = substr;
+
+				/* Add the control before copying the id so that
+				 * the numid field of the id is set in the copy.
+				 */
+				err = snd_ctl_add(card, kctl);
+				if (err < 0)
+					return err;
+
 				switch (idx) {
 				case ACTIVE_IDX:
 					setup->active_id = kctl->id;
@@ -1587,9 +1595,6 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
 				default:
 					break;
 				}
-				err = snd_ctl_add(card, kctl);
-				if (err < 0)
-					return err;
 			}
 		}
 	}
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ALSA: aloop: Fix initialization of controls
  2021-04-07  7:54 [PATCH] ALSA: aloop: Fix initialization of controls Jonas Holmberg
@ 2021-04-07  8:01 ` Jaroslav Kysela
  2021-04-07  8:22 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Jaroslav Kysela @ 2021-04-07  8:01 UTC (permalink / raw)
  To: Jonas Holmberg, tiwai, alsa-devel

Dne 07. 04. 21 v 9:54 Jonas Holmberg napsal(a):
> Add a control to the card before copying the id so that the numid field
> is initialized in the copy. Otherwise the numid field of active_id,
> format_id, rate_id and channels_id will be the same (0) and
> snd_ctl_notify() will not queue the events properly.
> 
> Signed-off-by: Jonas Holmberg <jonashg@axis.com>

Nice hit. Thanks.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>

> ---
>  sound/drivers/aloop.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
> index 52637180af33..80b814b9922a 100644
> --- a/sound/drivers/aloop.c
> +++ b/sound/drivers/aloop.c
> @@ -1571,6 +1571,14 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
>  					return -ENOMEM;
>  				kctl->id.device = dev;
>  				kctl->id.subdevice = substr;
> +
> +				/* Add the control before copying the id so that
> +				 * the numid field of the id is set in the copy.
> +				 */
> +				err = snd_ctl_add(card, kctl);
> +				if (err < 0)
> +					return err;
> +
>  				switch (idx) {
>  				case ACTIVE_IDX:
>  					setup->active_id = kctl->id;
> @@ -1587,9 +1595,6 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
>  				default:
>  					break;
>  				}
> -				err = snd_ctl_add(card, kctl);
> -				if (err < 0)
> -					return err;
>  			}
>  		}
>  	}
> 


-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ALSA: aloop: Fix initialization of controls
  2021-04-07  7:54 [PATCH] ALSA: aloop: Fix initialization of controls Jonas Holmberg
  2021-04-07  8:01 ` Jaroslav Kysela
@ 2021-04-07  8:22 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2021-04-07  8:22 UTC (permalink / raw)
  To: Jonas Holmberg; +Cc: alsa-devel

On Wed, 07 Apr 2021 09:54:28 +0200,
Jonas Holmberg wrote:
> 
> Add a control to the card before copying the id so that the numid field
> is initialized in the copy. Otherwise the numid field of active_id,
> format_id, rate_id and channels_id will be the same (0) and
> snd_ctl_notify() will not queue the events properly.
> 
> Signed-off-by: Jonas Holmberg <jonashg@axis.com>

Applied now (with Cc to stable).


thanks,

Takashi

> ---
>  sound/drivers/aloop.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
> index 52637180af33..80b814b9922a 100644
> --- a/sound/drivers/aloop.c
> +++ b/sound/drivers/aloop.c
> @@ -1571,6 +1571,14 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
>  					return -ENOMEM;
>  				kctl->id.device = dev;
>  				kctl->id.subdevice = substr;
> +
> +				/* Add the control before copying the id so that
> +				 * the numid field of the id is set in the copy.
> +				 */
> +				err = snd_ctl_add(card, kctl);
> +				if (err < 0)
> +					return err;
> +
>  				switch (idx) {
>  				case ACTIVE_IDX:
>  					setup->active_id = kctl->id;
> @@ -1587,9 +1595,6 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
>  				default:
>  					break;
>  				}
> -				err = snd_ctl_add(card, kctl);
> -				if (err < 0)
> -					return err;
>  			}
>  		}
>  	}
> -- 
> 2.26.3
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-07  8:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07  7:54 [PATCH] ALSA: aloop: Fix initialization of controls Jonas Holmberg
2021-04-07  8:01 ` Jaroslav Kysela
2021-04-07  8:22 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.