]> err.no Git - linux-2.6/commitdiff
[ALSA] fix improper CONFIG_SND_MAJOR usage
authorClemens Ladisch <clemens@ladisch.de>
Mon, 24 Oct 2005 15:05:03 +0000 (17:05 +0200)
committerJaroslav Kysela <perex@suse.cz>
Fri, 4 Nov 2005 12:20:08 +0000 (13:20 +0100)
Modules: HWDEP Midlevel,PCM Midlevel,RawMidi Midlevel,ALSA Core

Replace usage of CONFIG_SND_MAJOR with snd_major, where appropriate.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
include/sound/core.h
sound/core/hwdep.c
sound/core/pcm_native.c
sound/core/rawmidi.c

index 642ddfbc63254668c3fd15da0ba5502de86df7ac..2be65ad2fd835dbfa200bacf605fe9ddde00c235 100644 (file)
@@ -255,6 +255,7 @@ typedef struct _snd_minor snd_minor_t;
 
 /* sound.c */
 
+extern int snd_major;
 extern int snd_ecards_limit;
 
 void snd_request_card(int card);
index 9383f1294fb5ec528bd2160df78fd1b579ec5279..e91cee35a4b9e3d640ad159b489644a941bf0da9 100644 (file)
@@ -81,20 +81,16 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
        int err;
        wait_queue_t wait;
 
-       switch (major) {
-       case CONFIG_SND_MAJOR:
+       if (major == snd_major) {
                cardnum = SNDRV_MINOR_CARD(iminor(inode));
                device = SNDRV_MINOR_DEVICE(iminor(inode)) - SNDRV_MINOR_HWDEP;
-               break;
 #ifdef CONFIG_SND_OSSEMUL
-       case SOUND_MAJOR:
+       } else if (major == SOUND_MAJOR) {
                cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode));
                device = 0;
-               break;
 #endif
-       default:
+       } else
                return -ENXIO;
-       }
        cardnum %= SNDRV_CARDS;
        device %= SNDRV_MINOR_HWDEPS;
        hw = snd_hwdep_devices[(cardnum * SNDRV_MINOR_HWDEPS) + device];
index a1924f12d8fcde95d67f2a75259e321c65807b21..16e252f5495424fc051eb0c3d4f2584990fe22bb 100644 (file)
@@ -1522,7 +1522,6 @@ static int snd_pcm_drop(snd_pcm_substream_t *substream)
 
 
 /* WARNING: Don't forget to fput back the file */
-extern int snd_major;
 static struct file *snd_pcm_file_fd(int fd)
 {
        struct file *file;
index 7c20eafecb8ac6932cf9e547d6d16e0edeb129da..d033e61c05c7b24ac9687fb6f059e66160a8757d 100644 (file)
@@ -378,24 +378,20 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
        struct list_head *list;
        snd_ctl_file_t *kctl;
 
-       switch (maj) {
-       case CONFIG_SND_MAJOR:
+       if (maj == snd_major) {
                cardnum = SNDRV_MINOR_CARD(iminor(inode));
                cardnum %= SNDRV_CARDS;
                device = SNDRV_MINOR_DEVICE(iminor(inode)) - SNDRV_MINOR_RAWMIDI;
                device %= SNDRV_MINOR_RAWMIDIS;
-               break;
 #ifdef CONFIG_SND_OSSEMUL
-       case SOUND_MAJOR:
+       } else if (maj == SOUND_MAJOR) {
                cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode));
                cardnum %= SNDRV_CARDS;
                device = SNDRV_MINOR_OSS_DEVICE(iminor(inode)) == SNDRV_MINOR_OSS_MIDI ?
                        midi_map[cardnum] : amidi_map[cardnum];
-               break;
 #endif
-       default:
+       } else
                return -ENXIO;
-       }
 
        rmidi = snd_rawmidi_devices[(cardnum * SNDRV_RAWMIDI_DEVICES) + device];
        if (rmidi == NULL)
@@ -411,7 +407,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
        if (err < 0)
                return -ENODEV;
        fflags = snd_rawmidi_file_flags(file);
-       if ((file->f_flags & O_APPEND) || maj != CONFIG_SND_MAJOR) /* OSS emul? */
+       if ((file->f_flags & O_APPEND) || maj == SOUND_MAJOR) /* OSS emul? */
                fflags |= SNDRV_RAWMIDI_LFLG_APPEND;
        fflags |= SNDRV_RAWMIDI_LFLG_NOOPENLOCK;
        rawmidi_file = kmalloc(sizeof(*rawmidi_file), GFP_KERNEL);