sbawe: fix memory detection part 2
[safe/jmp/linux-2.6] / sound / oss / dev_table.c
index fb64279..727bdb9 100644 (file)
 
 #include <linux/init.h>
 
-#define _DEV_TABLE_C_
 #include "sound_config.h"
 
+struct audio_operations *audio_devs[MAX_AUDIO_DEV];
+EXPORT_SYMBOL(audio_devs);
+
+int num_audiodevs;
+EXPORT_SYMBOL(num_audiodevs);
+
+struct mixer_operations *mixer_devs[MAX_MIXER_DEV];
+EXPORT_SYMBOL(mixer_devs);
+
+int num_mixers;
+EXPORT_SYMBOL(num_mixers);
+
+struct synth_operations *synth_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV];
+EXPORT_SYMBOL(synth_devs);
+
+int num_synths;
+
+struct midi_operations *midi_devs[MAX_MIDI_DEV];
+EXPORT_SYMBOL(midi_devs);
+
+int num_midis;
+EXPORT_SYMBOL(num_midis);
+
+struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV] = {
+       &default_sound_timer, NULL
+};
+EXPORT_SYMBOL(sound_timer_devs);
+
+int num_sound_timers = 1;
+
+
 static int sound_alloc_audiodev(void);
 
 int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,
@@ -37,14 +67,15 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,
                return -(EBUSY);
        }
        d = (struct audio_driver *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_driver)));
-
-       if (sound_nblocks < 1024)
-               sound_nblocks++;
+       sound_nblocks++;
+       if (sound_nblocks >= MAX_MEM_BLOCKS)
+               sound_nblocks = MAX_MEM_BLOCKS - 1;
 
        op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_operations)));
+       sound_nblocks++;
+       if (sound_nblocks >= MAX_MEM_BLOCKS)
+               sound_nblocks = MAX_MEM_BLOCKS - 1;
 
-       if (sound_nblocks < 1024)
-               sound_nblocks++;
        if (d == NULL || op == NULL) {
                printk(KERN_ERR "Sound: Can't allocate driver for (%s)\n", name);
                sound_unload_audiodev(num);
@@ -75,6 +106,7 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,
        audio_init_devices();
        return num;
 }
+EXPORT_SYMBOL(sound_install_audiodrv);
 
 int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,
        int driver_size, void *devc)
@@ -97,9 +129,10 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,
           until you unload sound! */
           
        op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct mixer_operations)));
+       sound_nblocks++;
+       if (sound_nblocks >= MAX_MEM_BLOCKS)
+               sound_nblocks = MAX_MEM_BLOCKS - 1;
 
-       if (sound_nblocks < 1024)
-               sound_nblocks++;
        if (op == NULL) {
                printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name);
                return -ENOMEM;
@@ -113,6 +146,7 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,
        mixer_devs[n] = op;
        return n;
 }
+EXPORT_SYMBOL(sound_install_mixer);
 
 void sound_unload_audiodev(int dev)
 {
@@ -122,6 +156,7 @@ void sound_unload_audiodev(int dev)
                unregister_sound_dsp((dev<<4)+3);
        }
 }
+EXPORT_SYMBOL(sound_unload_audiodev);
 
 static int sound_alloc_audiodev(void)
 { 
@@ -144,6 +179,7 @@ int sound_alloc_mididev(void)
                num_midis = i + 1;
        return i;
 }
+EXPORT_SYMBOL(sound_alloc_mididev);
 
 int sound_alloc_synthdev(void)
 {
@@ -158,6 +194,7 @@ int sound_alloc_synthdev(void)
        }
        return -1;
 }
+EXPORT_SYMBOL(sound_alloc_synthdev);
 
 int sound_alloc_mixerdev(void)
 {
@@ -169,6 +206,7 @@ int sound_alloc_mixerdev(void)
                num_mixers = i + 1;
        return i;
 }
+EXPORT_SYMBOL(sound_alloc_mixerdev);
 
 int sound_alloc_timerdev(void)
 {
@@ -183,6 +221,7 @@ int sound_alloc_timerdev(void)
        }
        return -1;
 }
+EXPORT_SYMBOL(sound_alloc_timerdev);
 
 void sound_unload_mixerdev(int dev)
 {
@@ -192,6 +231,7 @@ void sound_unload_mixerdev(int dev)
                num_mixers--;
        }
 }
+EXPORT_SYMBOL(sound_unload_mixerdev);
 
 void sound_unload_mididev(int dev)
 {
@@ -200,15 +240,19 @@ void sound_unload_mididev(int dev)
                unregister_sound_midi((dev<<4)+2);
        }
 }
+EXPORT_SYMBOL(sound_unload_mididev);
 
 void sound_unload_synthdev(int dev)
 {
        if (dev != -1)
                synth_devs[dev] = NULL;
 }
+EXPORT_SYMBOL(sound_unload_synthdev);
 
 void sound_unload_timerdev(int dev)
 {
        if (dev != -1)
                sound_timer_devs[dev] = NULL;
 }
+EXPORT_SYMBOL(sound_unload_timerdev);
+