X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fcore%2Fsound_oss.c;h=4566df41912a9f15a900914bb4bbc627619edc20;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=79752205c5c6b77028cce363c225ab7c3a2aea2d;hpb=76828883507a47dae78837ab5dec5a5b4513c667;p=linux-2.6.git diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index 79752205c..4566df419 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c @@ -34,11 +34,12 @@ #include #include #include +#include #define SNDRV_OSS_MINORS 128 static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS]; -static DECLARE_MUTEX(sound_oss_mutex); +static DEFINE_MUTEX(sound_oss_mutex); void *snd_lookup_oss_minor_data(unsigned int minor, int type) { @@ -47,16 +48,18 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type) if (minor >= ARRAY_SIZE(snd_oss_minors)) return NULL; - down(&sound_oss_mutex); + mutex_lock(&sound_oss_mutex); mreg = snd_oss_minors[minor]; if (mreg && mreg->type == type) private_data = mreg->private_data; else private_data = NULL; - up(&sound_oss_mutex); + mutex_unlock(&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; @@ -94,7 +97,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, - struct file_operations *f_ops, void *private_data, + const struct file_operations *f_ops, void *private_data, const char *name) { int minor = snd_oss_kernel_minor(type, card, dev); @@ -103,7 +106,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, int cidx = SNDRV_MINOR_OSS_CARD(minor); int track2 = -1; int register1 = -1, register2 = -1; - struct device *carddev = NULL; + struct device *carddev = snd_card_get_device_link(card); if (card && card->number >= 8) return 0; /* ignore silently */ @@ -117,7 +120,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; - down(&sound_oss_mutex); + mutex_lock(&sound_oss_mutex); snd_oss_minors[minor] = preg; minor_unit = SNDRV_MINOR_OSS_DEVICE(minor); switch (minor_unit) { @@ -131,8 +134,6 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1); break; } - if (card) - carddev = card->dev; register1 = register_sound_special_device(f_ops, minor, carddev); if (register1 != minor) goto __end; @@ -143,7 +144,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, goto __end; snd_oss_minors[track2] = preg; } - up(&sound_oss_mutex); + mutex_unlock(&sound_oss_mutex); return 0; __end: @@ -152,11 +153,13 @@ 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; - up(&sound_oss_mutex); + mutex_unlock(&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); @@ -168,10 +171,10 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev) return 0; if (minor < 0) return minor; - down(&sound_oss_mutex); + mutex_lock(&sound_oss_mutex); mptr = snd_oss_minors[minor]; if (mptr == NULL) { - up(&sound_oss_mutex); + mutex_unlock(&sound_oss_mutex); return -ENOENT; } unregister_sound_special(minor); @@ -191,18 +194,20 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev) snd_oss_minors[track2] = NULL; } snd_oss_minors[minor] = NULL; - up(&sound_oss_mutex); + mutex_unlock(&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 = NULL; +static struct snd_info_entry *snd_minor_info_oss_entry; static const char *snd_oss_device_type_name(int type) { @@ -229,7 +234,7 @@ static void snd_minor_info_oss_read(struct snd_info_entry *entry, int minor; struct snd_minor *mptr; - down(&sound_oss_mutex); + mutex_lock(&sound_oss_mutex); for (minor = 0; minor < SNDRV_OSS_MINORS; ++minor) { if (!(mptr = snd_oss_minors[minor])) continue; @@ -241,7 +246,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)); } - up(&sound_oss_mutex); + mutex_unlock(&sound_oss_mutex); } @@ -251,7 +256,6 @@ 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); @@ -264,8 +268,7 @@ int __init snd_minor_info_oss_init(void) int __exit snd_minor_info_oss_done(void) { - if (snd_minor_info_oss_entry) - snd_info_unregister(snd_minor_info_oss_entry); + snd_info_free_entry(snd_minor_info_oss_entry); return 0; } #endif /* CONFIG_PROC_FS */