diff options
author | Pawel MOLL <pawel.moll@st.com> | 2008-07-30 07:46:40 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-08-01 07:37:15 -0400 |
commit | f90c06a2b613eea24a77d56f24b084745c43713d (patch) | |
tree | 9a205486e526c9f5b696db96633e1a7ff7833a7c /include/sound/pcm.h | |
parent | 030a07e441296c372f946cd4065b5d831d8dc40c (diff) |
ALSA: Fix limit of 8 PCM devices in SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE
When compiled with CONFIG_SND_DYNAMIC_MINORS the ALSA core is fine
to have more than 8 PCM devices per card, except one place - the
SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE ioctl, which will not enumerate
devices > 7. This patch fixes the issue, changing the devices list
organisation.
Instead of adding new device to the tail, the list is now kept always
ordered (by card number, then device number). Thus, during enumeration,
it is easy to discover the fact that there is no more given card's
devices.
Additionally the device field of struct snd_pcm had to be changed to int,
as its "unsignednity" caused a lot of problems when comparing it to
potentially negative signed values. (-1 is 0xffffffff or even more then ;-)
Signed-off-by: Pawel Moll <pawel.moll@st.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'include/sound/pcm.h')
-rw-r--r-- | include/sound/pcm.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 51d58ccda2d..5dd8ea4a8c4 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include <sound/asound.h> | 26 | #include <sound/asound.h> |
27 | #include <sound/memalloc.h> | 27 | #include <sound/memalloc.h> |
28 | #include <sound/minors.h> | ||
28 | #include <linux/poll.h> | 29 | #include <linux/poll.h> |
29 | #include <linux/mm.h> | 30 | #include <linux/mm.h> |
30 | #include <linux/bitops.h> | 31 | #include <linux/bitops.h> |
@@ -84,7 +85,11 @@ struct snd_pcm_ops { | |||
84 | * | 85 | * |
85 | */ | 86 | */ |
86 | 87 | ||
87 | #define SNDRV_PCM_DEVICES 8 | 88 | #if defined(CONFIG_SND_DYNAMIC_MINORS) |
89 | #define SNDRV_PCM_DEVICES (SNDRV_OS_MINORS-2) | ||
90 | #else | ||
91 | #define SNDRV_PCM_DEVICES 8 | ||
92 | #endif | ||
88 | 93 | ||
89 | #define SNDRV_PCM_IOCTL1_FALSE ((void *)0) | 94 | #define SNDRV_PCM_IOCTL1_FALSE ((void *)0) |
90 | #define SNDRV_PCM_IOCTL1_TRUE ((void *)1) | 95 | #define SNDRV_PCM_IOCTL1_TRUE ((void *)1) |
@@ -416,7 +421,7 @@ struct snd_pcm_str { | |||
416 | struct snd_pcm { | 421 | struct snd_pcm { |
417 | struct snd_card *card; | 422 | struct snd_card *card; |
418 | struct list_head list; | 423 | struct list_head list; |
419 | unsigned int device; /* device number */ | 424 | int device; /* device number */ |
420 | unsigned int info_flags; | 425 | unsigned int info_flags; |
421 | unsigned short dev_class; | 426 | unsigned short dev_class; |
422 | unsigned short dev_subclass; | 427 | unsigned short dev_subclass; |