Blob Blame History Raw
From 3d7433a3c87754ff8b51cf06de53a3e6c38c20b0 Mon Sep 17 00:00:00 2001
From: Jordi Mallach <jordi@debian.org>
Date: Fri, 17 May 2013 18:25:51 +0200
Subject: [PATCH 1/5] =?UTF-8?q?pcm:=20Fix=20typo=20in=20documentation:=20P?=
 =?UTF-8?q?REPARE=20=E2=86=92=20PREPARED.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Jordi Mallach <jordi@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 src/pcm/pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 438fb3f..7ec1f0e 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -437,7 +437,7 @@ to #SND_PCM_STATE_SETUP
 if successfully finishes, otherwise the state #SND_PCM_STATE_OPEN
 is entered.
 When it is brought to SETUP state, this function automatically
-calls #snd_pcm_prepare() function to bring to the PREPARE state
+calls #snd_pcm_prepare() function to bring to the PREPARED state
 as below.
 
 \par snd_pcm_prepare
-- 
1.8.1.4


From 14d653d7c374f9ba6319a7c5a8ee6f0bc3071304 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Juho=20H=C3=A4m=C3=A4l=C3=A4inen?=
 <juho.hamalainen@tieto.com>
Date: Fri, 24 May 2013 14:01:25 +0300
Subject: [PATCH 2/5] ucm: Fix segfault when device argument is missing from
 _sw{dev, mod}
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Juho Hämäläinen <juho.hamalainen@tieto.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 src/ucm/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ucm/main.c b/src/ucm/main.c
index d38b7fa..0494728 100644
--- a/src/ucm/main.c
+++ b/src/ucm/main.c
@@ -1647,7 +1647,8 @@ int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
                 		goto __end;
                         }
                 } else {
-                        str = NULL;
+                        err = -EINVAL;
+                        goto __end;
                 }
                 if (check_identifier(identifier, "_swdev"))
                         err = switch_device(uc_mgr, str, value);
-- 
1.8.1.4


From 2f43b66c06ece64529e482a6dcc95cde37648252 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Fri, 24 May 2013 17:21:15 +0200
Subject: [PATCH 3/5] Allow specifying the max number of cards

Add --with-max-cards option to specify the max number of cards in
configure script, when the support for more than 32 cards is
required.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 configure.in             | 14 ++++++++++++++
 src/confmisc.c           |  2 +-
 src/control/cards.c      |  6 +++---
 src/control/control_hw.c |  2 +-
 src/hwdep/hwdep_hw.c     |  2 +-
 5 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/configure.in b/configure.in
index 35b8e84..3d394fc 100644
--- a/configure.in
+++ b/configure.in
@@ -632,6 +632,20 @@ for t in $CTL_PLUGIN_LIST; do
   fi
 done
 
+dnl Max number of cards
+AC_MSG_CHECKING(for max number of cards)
+AC_ARG_WITH(max-cards,
+  AS_HELP_STRING([--with-max-cards], [Specify the max number of cards (default = 32)]),
+  [ max_cards="$withval" ], [ max_cards="32" ])
+AC_MSG_RESULT([$max_cards])
+
+if test "$max_cards" -lt 1; then
+   AC_ERROR([Invalid max cards $max_cards])
+elif test "$max_cards" -gt 256; then
+   AC_ERROR([Invalid max cards $max_cards])
+fi
+AC_DEFINE_UNQUOTED(SND_MAX_CARDS, $max_cards, [Max number of cards])
+
 dnl Make a symlink for inclusion of alsa/xxx.h
 if test ! -L "$srcdir"/include/alsa ; then
   echo "Making a symlink include/alsa"
diff --git a/src/confmisc.c b/src/confmisc.c
index 80b0027..af686be 100644
--- a/src/confmisc.c
+++ b/src/confmisc.c
@@ -668,7 +668,7 @@ int snd_determine_driver(int card, char **driver)
 	char *res = NULL;
 	int err;
 
-	assert(card >= 0 && card <= 32);
+	assert(card >= 0 && card <= SND_MAX_CARDS);
 	err = open_ctl(card, &ctl);
 	if (err < 0) {
 		SNDERR("could not open control for card %i", card);
diff --git a/src/control/cards.c b/src/control/cards.c
index b528e33..5d7376c 100644
--- a/src/control/cards.c
+++ b/src/control/cards.c
@@ -103,7 +103,7 @@ int snd_card_next(int *rcard)
 		return -EINVAL;
 	card = *rcard;
 	card = card < 0 ? 0 : card + 1;
-	for (; card < 32; card++) {
+	for (; card < SND_MAX_CARDS; card++) {
 		if (snd_card_load(card)) {
 			*rcard = card;
 			return 0;
@@ -134,7 +134,7 @@ int snd_card_get_index(const char *string)
 	    (isdigit(*string) && isdigit(*(string + 1)) && *(string + 2) == 0)) {
 		if (sscanf(string, "%i", &card) != 1)
 			return -EINVAL;
-		if (card < 0 || card > 31)
+		if (card < 0 || card >= SND_MAX_CARDS)
 			return -EINVAL;
 		err = snd_card_load1(card);
 		if (err >= 0)
@@ -143,7 +143,7 @@ int snd_card_get_index(const char *string)
 	}
 	if (string[0] == '/')	/* device name */
 		return snd_card_load2(string);
-	for (card = 0; card < 32; card++) {
+	for (card = 0; card < SND_MAX_CARDS; card++) {
 #ifdef SUPPORT_ALOAD
 		if (! snd_card_load(card))
 			continue;
diff --git a/src/control/control_hw.c b/src/control/control_hw.c
index 90c4ba7..148097f 100644
--- a/src/control/control_hw.c
+++ b/src/control/control_hw.c
@@ -382,7 +382,7 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode)
 
 	*handle = NULL;	
 
-	if (CHECK_SANITY(card < 0 || card >= 32)) {
+	if (CHECK_SANITY(card < 0 || card >= SND_MAX_CARDS)) {
 		SNDMSG("Invalid card index %d", card);
 		return -EINVAL;
 	}
diff --git a/src/hwdep/hwdep_hw.c b/src/hwdep/hwdep_hw.c
index e4fcdc3..4314e32 100644
--- a/src/hwdep/hwdep_hw.c
+++ b/src/hwdep/hwdep_hw.c
@@ -112,7 +112,7 @@ int snd_hwdep_hw_open(snd_hwdep_t **handle, const char *name, int card, int devi
 
 	*handle = NULL;
 	
-	if (card < 0 || card >= 32)
+	if (card < 0 || card >= SND_MAX_CARDS)
 		return -EINVAL;
 	sprintf(filename, SNDRV_FILE_HWDEP, card, device);
 	fd = snd_open_device(filename, mode);
-- 
1.8.1.4


From 7f877543a36efd8fd5d38fae21352fc0567ece21 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Thu, 30 May 2013 12:26:33 +0200
Subject: [PATCH 4/5] pcm_hw: Remove unused fields in struct

These fields are not used, and their name similarity to other
fields are quite confusing when trying to debug alsa-lib.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
 src/pcm/pcm_hw.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
index 0f3226d..196393d 100644
--- a/src/pcm/pcm_hw.c
+++ b/src/pcm/pcm_hw.c
@@ -95,8 +95,6 @@ typedef struct {
 	volatile struct snd_pcm_mmap_status * mmap_status;
 	struct snd_pcm_mmap_control *mmap_control;
 	struct snd_pcm_sync_ptr *sync_ptr;
-	snd_pcm_uframes_t hw_ptr;
-	snd_pcm_uframes_t appl_ptr;
 	int period_event;
 	snd_timer_t *period_timer;
 	struct pollfd period_timer_pfd;
-- 
1.8.1.4


From f2d39afe6139ab16aa2aeea0f51f32db79ab1262 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Thu, 30 May 2013 12:26:34 +0200
Subject: [PATCH 5/5] pcm_plugin: Fix return value of snd_pcm_rewind

In case the rewind did not rewind as much as expected, e g due to
time delay between the latest avail update and the rewind, we must
properly account for that in the plugin layer.

Otherwise, the plugin's appl ptr and the hw's appl ptr become
unsynchronised, which is very bad, especially in mmap_shadow plugins,
e g, this could cause the overlapping memcpy in the softvol plugin
as seen here:
https://bugs.freedesktop.org/show_bug.cgi?id=64299

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
 src/pcm/pcm_plugin.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
index 96218a8..17157e8 100644
--- a/src/pcm/pcm_plugin.c
+++ b/src/pcm/pcm_plugin.c
@@ -219,9 +219,9 @@ static snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t
 		snd_atomic_write_end(&plugin->watom);
 		return sframes;
 	}
-	snd_pcm_mmap_appl_backward(pcm, (snd_pcm_uframes_t) frames);
+	snd_pcm_mmap_appl_backward(pcm, (snd_pcm_uframes_t) sframes);
 	snd_atomic_write_end(&plugin->watom);
-	return (snd_pcm_sframes_t) frames;
+	return (snd_pcm_sframes_t) sframes;
 }
 
 static snd_pcm_sframes_t snd_pcm_plugin_forwardable(snd_pcm_t *pcm)
-- 
1.8.1.4