git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[ALSA] Remove bogus check of mmap_count in snd_pcm_release()
[pandora-kernel.git]
/
sound
/
core
/
sound_oss.c
diff --git
a/sound/core/sound_oss.c
b/sound/core/sound_oss.c
index
b9e89ca
..
74f0fe5
100644
(file)
--- a/
sound/core/sound_oss.c
+++ b/
sound/core/sound_oss.c
@@
-34,29
+34,32
@@
#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)
{
struct snd_minor *mreg;
void *private_data;
void *snd_lookup_oss_minor_data(unsigned int minor, int type)
{
struct snd_minor *mreg;
void *private_data;
- if (minor > ARRAY_SIZE(snd_oss_minors))
+ if (minor >
=
ARRAY_SIZE(snd_oss_minors))
return NULL;
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);
@@
-105,6
+108,8
@@
int snd_register_oss_device(int type, struct snd_card *card, int dev,
int register1 = -1, register2 = -1;
struct device *carddev = NULL;
int register1 = -1, register2 = -1;
struct device *carddev = NULL;
+ if (card && card->number >= 8)
+ return 0; /* ignore silently */
if (minor < 0)
return minor;
preg = kmalloc(sizeof(struct snd_minor), GFP_KERNEL);
if (minor < 0)
return minor;
preg = kmalloc(sizeof(struct snd_minor), GFP_KERNEL);
@@
-115,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) {
@@
-141,7
+146,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:
@@
-150,11
+155,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);
@@
-162,12
+169,14
@@
int snd_unregister_oss_device(int type, struct snd_card *card, int dev)
int track2 = -1;
struct snd_minor *mptr;
int track2 = -1;
struct snd_minor *mptr;
+ if (card && card->number >= 8)
+ return 0;
if (minor < 0)
return minor;
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);
@@
-187,18
+196,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)
{
@@
-225,7
+236,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;
@@
-237,19
+248,16
@@
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);
}
}
-#endif /* CONFIG_PROC_FS */
int __init snd_minor_info_oss_init(void)
{
int __init snd_minor_info_oss_init(void)
{
-#ifdef CONFIG_PROC_FS
struct snd_info_entry *entry;
entry = snd_info_create_module_entry(THIS_MODULE, "devices", snd_oss_root);
if (entry) {
struct snd_info_entry *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);
@@
-257,17
+265,15
@@
int __init snd_minor_info_oss_init(void)
}
}
snd_minor_info_oss_entry = entry;
}
}
snd_minor_info_oss_entry = entry;
-#endif
return 0;
}
int __exit snd_minor_info_oss_done(void)
{
return 0;
}
int __exit snd_minor_info_oss_done(void)
{
-#ifdef CONFIG_PROC_FS
if (snd_minor_info_oss_entry)
snd_info_unregister(snd_minor_info_oss_entry);
if (snd_minor_info_oss_entry)
snd_info_unregister(snd_minor_info_oss_entry);
-#endif
return 0;
}
return 0;
}
+#endif /* CONFIG_PROC_FS */
#endif /* CONFIG_SND_OSSEMUL */
#endif /* CONFIG_SND_OSSEMUL */