git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
sound
/
core
/
sound_oss.c
diff --git
a/sound/core/sound_oss.c
b/sound/core/sound_oss.c
index
7975220
..
4566df4
100644
(file)
--- a/
sound/core/sound_oss.c
+++ b/
sound/core/sound_oss.c
@@
-34,11
+34,12
@@
#include <sound/minors.h>
#include <sound/info.h>
#include <linux/sound.h>
#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];
#define SNDRV_OSS_MINORS 128
static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS];
-static DE
CLAR
E_MUTEX(sound_oss_mutex);
+static DE
FIN
E_MUTEX(sound_oss_mutex);
void *snd_lookup_oss_minor_data(unsigned int minor, int type)
{
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;
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;
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;
}
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;
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,
}
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);
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;
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 */
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;
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) {
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;
}
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;
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;
}
goto __end;
snd_oss_minors[track2] = preg;
}
-
up
(&sound_oss_mutex);
+
mutex_unlock
(&sound_oss_mutex);
return 0;
__end:
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;
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;
}
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);
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;
return 0;
if (minor < 0)
return minor;
-
down
(&sound_oss_mutex);
+
mutex_lock
(&sound_oss_mutex);
mptr = snd_oss_minors[minor];
if (mptr == NULL) {
mptr = snd_oss_minors[minor];
if (mptr == NULL) {
-
up
(&sound_oss_mutex);
+
mutex_unlock
(&sound_oss_mutex);
return -ENOENT;
}
unregister_sound_special(minor);
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;
snd_oss_minors[track2] = NULL;
}
snd_oss_minors[minor] = NULL;
-
up
(&sound_oss_mutex);
+
mutex_unlock
(&sound_oss_mutex);
kfree(mptr);
return 0;
}
kfree(mptr);
return 0;
}
+EXPORT_SYMBOL(snd_unregister_oss_device);
+
/*
* INFO PART
*/
#ifdef CONFIG_PROC_FS
/*
* 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)
{
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;
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;
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));
}
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 = 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);
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)
{
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 */
return 0;
}
#endif /* CONFIG_PROC_FS */