aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/oss
diff options
context:
space:
mode:
authorPawel MOLL <pawel.moll@st.com>2008-07-29 12:34:26 -0400
committerJaroslav Kysela <perex@perex.cz>2008-07-29 15:32:48 -0400
commit9423969005586e6e27ca380e01b4a8c50698e2af (patch)
tree818bef3892109c05a4ad5ec3ae5e90dd4436c0c6 /sound/core/oss
parent815ecf8dec95d07e260a16ebe8409f4b7c0fdc0f (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. The same limit was present in OSS emulation code. It has been fixed as well. Additionally the device field of struct snd_pcm is now int, instead of unsigned int, as there is no obvious reason for keeping it unsigned. This caused a lot of problems with comparing this value with other (almost always signed) variables. There is just one more place where device number is unsigned - in struct snd_pcm_info, which should be also sorted out in future. Signed-off-by: Pawel MOLL <pawel.moll@st.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/core/oss')
-rw-r--r--sound/core/oss/pcm_oss.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 4c601b192dd..4ccd761a5f4 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -2947,7 +2947,7 @@ static void register_oss_dsp(struct snd_pcm *pcm, int index)
2947static int snd_pcm_oss_register_minor(struct snd_pcm *pcm) 2947static int snd_pcm_oss_register_minor(struct snd_pcm *pcm)
2948{ 2948{
2949 pcm->oss.reg = 0; 2949 pcm->oss.reg = 0;
2950 if (dsp_map[pcm->card->number] == (int)pcm->device) { 2950 if (dsp_map[pcm->card->number] == pcm->device) {
2951 char name[128]; 2951 char name[128];
2952 int duplex; 2952 int duplex;
2953 register_oss_dsp(pcm, 0); 2953 register_oss_dsp(pcm, 0);
@@ -2963,7 +2963,7 @@ static int snd_pcm_oss_register_minor(struct snd_pcm *pcm)
2963 pcm->oss.reg++; 2963 pcm->oss.reg++;
2964 pcm->oss.reg_mask |= 1; 2964 pcm->oss.reg_mask |= 1;
2965 } 2965 }
2966 if (adsp_map[pcm->card->number] == (int)pcm->device) { 2966 if (adsp_map[pcm->card->number] == pcm->device) {
2967 register_oss_dsp(pcm, 1); 2967 register_oss_dsp(pcm, 1);
2968 pcm->oss.reg++; 2968 pcm->oss.reg++;
2969 pcm->oss.reg_mask |= 2; 2969 pcm->oss.reg_mask |= 2;
@@ -2988,7 +2988,7 @@ static int snd_pcm_oss_disconnect_minor(struct snd_pcm *pcm)
2988 snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM, 2988 snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM,
2989 pcm->card, 1); 2989 pcm->card, 1);
2990 } 2990 }
2991 if (dsp_map[pcm->card->number] == (int)pcm->device) { 2991 if (dsp_map[pcm->card->number] == pcm->device) {
2992#ifdef SNDRV_OSS_INFO_DEV_AUDIO 2992#ifdef SNDRV_OSS_INFO_DEV_AUDIO
2993 snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_AUDIO, pcm->card->number); 2993 snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_AUDIO, pcm->card->number);
2994#endif 2994#endif
@@ -3019,12 +3019,12 @@ static int __init alsa_pcm_oss_init(void)
3019 3019
3020 /* check device map table */ 3020 /* check device map table */
3021 for (i = 0; i < SNDRV_CARDS; i++) { 3021 for (i = 0; i < SNDRV_CARDS; i++) {
3022 if (dsp_map[i] < 0 || dsp_map[i] >= SNDRV_PCM_DEVICES) { 3022 if (dsp_map[i] < 0 || dsp_map[i] >= SNDRV_OS_MINORS) {
3023 snd_printk(KERN_ERR "invalid dsp_map[%d] = %d\n", 3023 snd_printk(KERN_ERR "invalid dsp_map[%d] = %d\n",
3024 i, dsp_map[i]); 3024 i, dsp_map[i]);
3025 dsp_map[i] = 0; 3025 dsp_map[i] = 0;
3026 } 3026 }
3027 if (adsp_map[i] < 0 || adsp_map[i] >= SNDRV_PCM_DEVICES) { 3027 if (adsp_map[i] < 0 || adsp_map[i] >= SNDRV_OS_MINORS) {
3028 snd_printk(KERN_ERR "invalid adsp_map[%d] = %d\n", 3028 snd_printk(KERN_ERR "invalid adsp_map[%d] = %d\n",
3029 i, adsp_map[i]); 3029 i, adsp_map[i]);
3030 adsp_map[i] = 1; 3030 adsp_map[i] = 1;