linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / sound / core / sound_oss.c
index 74f0fe5..7975220 100644 (file)
 #include <sound/minors.h>
 #include <sound/info.h>
 #include <linux/sound.h>
-#include <linux/mutex.h>
 
 #define SNDRV_OSS_MINORS 128
 
 static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS];
-static DEFINE_MUTEX(sound_oss_mutex);
+static DECLARE_MUTEX(sound_oss_mutex);
 
 void *snd_lookup_oss_minor_data(unsigned int minor, int type)
 {
@@ -48,18 +47,16 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type)
 
        if (minor >= ARRAY_SIZE(snd_oss_minors))
                return NULL;
-       mutex_lock(&sound_oss_mutex);
+       down(&sound_oss_mutex);
        mreg = snd_oss_minors[minor];
        if (mreg && mreg->type == type)
                private_data = mreg->private_data;
        else
                private_data = NULL;
-       mutex_unlock(&sound_oss_mutex);
+       up(&sound_oss_mutex);
        return private_data;
 }
 
-EXPORT_SYMBOL(snd_lookup_oss_minor_data);
-
 static int snd_oss_kernel_minor(int type, struct snd_card *card, int dev)
 {
        int minor;
@@ -97,7 +94,7 @@ static int snd_oss_kernel_minor(int type, struct snd_card *card, int dev)
 }
 
 int snd_register_oss_device(int type, struct snd_card *card, int dev,
-                           const struct file_operations *f_ops, void *private_data,
+                           struct file_operations *f_ops, void *private_data,
                            const char *name)
 {
        int minor = snd_oss_kernel_minor(type, card, dev);
@@ -120,7 +117,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev,
        preg->device = dev;
        preg->f_ops = f_ops;
        preg->private_data = private_data;
-       mutex_lock(&sound_oss_mutex);
+       down(&sound_oss_mutex);
        snd_oss_minors[minor] = preg;
        minor_unit = SNDRV_MINOR_OSS_DEVICE(minor);
        switch (minor_unit) {
@@ -146,7 +143,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev,
                        goto __end;
                snd_oss_minors[track2] = preg;
        }
-       mutex_unlock(&sound_oss_mutex);
+       up(&sound_oss_mutex);
        return 0;
 
       __end:
@@ -155,13 +152,11 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev,
        if (register1 >= 0)
                unregister_sound_special(register1);
        snd_oss_minors[minor] = NULL;
-       mutex_unlock(&sound_oss_mutex);
+       up(&sound_oss_mutex);
        kfree(preg);
        return -EBUSY;
 }
 
-EXPORT_SYMBOL(snd_register_oss_device);
-
 int snd_unregister_oss_device(int type, struct snd_card *card, int dev)
 {
        int minor = snd_oss_kernel_minor(type, card, dev);
@@ -173,10 +168,10 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev)
                return 0;
        if (minor < 0)
                return minor;
-       mutex_lock(&sound_oss_mutex);
+       down(&sound_oss_mutex);
        mptr = snd_oss_minors[minor];
        if (mptr == NULL) {
-               mutex_unlock(&sound_oss_mutex);
+               up(&sound_oss_mutex);
                return -ENOENT;
        }
        unregister_sound_special(minor);
@@ -196,20 +191,18 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev)
                snd_oss_minors[track2] = NULL;
        }
        snd_oss_minors[minor] = NULL;
-       mutex_unlock(&sound_oss_mutex);
+       up(&sound_oss_mutex);
        kfree(mptr);
        return 0;
 }
 
-EXPORT_SYMBOL(snd_unregister_oss_device);
-
 /*
  *  INFO PART
  */
 
 #ifdef CONFIG_PROC_FS
 
-static struct snd_info_entry *snd_minor_info_oss_entry;
+static struct snd_info_entry *snd_minor_info_oss_entry = NULL;
 
 static const char *snd_oss_device_type_name(int type)
 {
@@ -236,7 +229,7 @@ static void snd_minor_info_oss_read(struct snd_info_entry *entry,
        int minor;
        struct snd_minor *mptr;
 
-       mutex_lock(&sound_oss_mutex);
+       down(&sound_oss_mutex);
        for (minor = 0; minor < SNDRV_OSS_MINORS; ++minor) {
                if (!(mptr = snd_oss_minors[minor]))
                        continue;
@@ -248,7 +241,7 @@ static void snd_minor_info_oss_read(struct snd_info_entry *entry,
                        snd_iprintf(buffer, "%3i:       : %s\n", minor,
                                    snd_oss_device_type_name(mptr->type));
        }
-       mutex_unlock(&sound_oss_mutex);
+       up(&sound_oss_mutex);
 }
 
 
@@ -258,6 +251,7 @@ int __init snd_minor_info_oss_init(void)
 
        entry = snd_info_create_module_entry(THIS_MODULE, "devices", snd_oss_root);
        if (entry) {
+               entry->c.text.read_size = PAGE_SIZE;
                entry->c.text.read = snd_minor_info_oss_read;
                if (snd_info_register(entry) < 0) {
                        snd_info_free_entry(entry);