diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-23 23:44:19 -0500 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-23 23:44:19 -0500 |
| commit | 1ebbe2b20091d306453a5cf480a87e6cd28ae76f (patch) | |
| tree | f5cd7a0fa69b8b1938cb5a0faed2e7b0628072a5 /sound/core/sound_oss.c | |
| parent | ac58c9059da8886b5e8cde012a80266b18ca146e (diff) | |
| parent | 674a396c6d2ba0341ebdd7c1c9950f32f018e2dd (diff) | |
Merge branch 'linus'
Diffstat (limited to 'sound/core/sound_oss.c')
| -rw-r--r-- | sound/core/sound_oss.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index d0be32b517c1..4023d3b406de 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c | |||
| @@ -34,26 +34,27 @@ | |||
| 34 | #include <sound/minors.h> | 34 | #include <sound/minors.h> |
| 35 | #include <sound/info.h> | 35 | #include <sound/info.h> |
| 36 | #include <linux/sound.h> | 36 | #include <linux/sound.h> |
| 37 | #include <linux/mutex.h> | ||
| 37 | 38 | ||
| 38 | #define SNDRV_OSS_MINORS 128 | 39 | #define SNDRV_OSS_MINORS 128 |
| 39 | 40 | ||
| 40 | static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS]; | 41 | static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS]; |
| 41 | static DECLARE_MUTEX(sound_oss_mutex); | 42 | static DEFINE_MUTEX(sound_oss_mutex); |
| 42 | 43 | ||
| 43 | void *snd_lookup_oss_minor_data(unsigned int minor, int type) | 44 | void *snd_lookup_oss_minor_data(unsigned int minor, int type) |
| 44 | { | 45 | { |
| 45 | struct snd_minor *mreg; | 46 | struct snd_minor *mreg; |
| 46 | void *private_data; | 47 | void *private_data; |
| 47 | 48 | ||
| 48 | if (minor > ARRAY_SIZE(snd_oss_minors)) | 49 | if (minor >= ARRAY_SIZE(snd_oss_minors)) |
| 49 | return NULL; | 50 | return NULL; |
| 50 | down(&sound_oss_mutex); | 51 | mutex_lock(&sound_oss_mutex); |
| 51 | mreg = snd_oss_minors[minor]; | 52 | mreg = snd_oss_minors[minor]; |
| 52 | if (mreg && mreg->type == type) | 53 | if (mreg && mreg->type == type) |
| 53 | private_data = mreg->private_data; | 54 | private_data = mreg->private_data; |
| 54 | else | 55 | else |
| 55 | private_data = NULL; | 56 | private_data = NULL; |
| 56 | up(&sound_oss_mutex); | 57 | mutex_unlock(&sound_oss_mutex); |
| 57 | return private_data; | 58 | return private_data; |
| 58 | } | 59 | } |
| 59 | 60 | ||
| @@ -117,7 +118,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, | |||
| 117 | preg->device = dev; | 118 | preg->device = dev; |
| 118 | preg->f_ops = f_ops; | 119 | preg->f_ops = f_ops; |
| 119 | preg->private_data = private_data; | 120 | preg->private_data = private_data; |
| 120 | down(&sound_oss_mutex); | 121 | mutex_lock(&sound_oss_mutex); |
| 121 | snd_oss_minors[minor] = preg; | 122 | snd_oss_minors[minor] = preg; |
| 122 | minor_unit = SNDRV_MINOR_OSS_DEVICE(minor); | 123 | minor_unit = SNDRV_MINOR_OSS_DEVICE(minor); |
| 123 | switch (minor_unit) { | 124 | switch (minor_unit) { |
| @@ -143,7 +144,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, | |||
| 143 | goto __end; | 144 | goto __end; |
| 144 | snd_oss_minors[track2] = preg; | 145 | snd_oss_minors[track2] = preg; |
| 145 | } | 146 | } |
| 146 | up(&sound_oss_mutex); | 147 | mutex_unlock(&sound_oss_mutex); |
| 147 | return 0; | 148 | return 0; |
| 148 | 149 | ||
| 149 | __end: | 150 | __end: |
| @@ -152,7 +153,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, | |||
| 152 | if (register1 >= 0) | 153 | if (register1 >= 0) |
| 153 | unregister_sound_special(register1); | 154 | unregister_sound_special(register1); |
| 154 | snd_oss_minors[minor] = NULL; | 155 | snd_oss_minors[minor] = NULL; |
| 155 | up(&sound_oss_mutex); | 156 | mutex_unlock(&sound_oss_mutex); |
| 156 | kfree(preg); | 157 | kfree(preg); |
| 157 | return -EBUSY; | 158 | return -EBUSY; |
| 158 | } | 159 | } |
| @@ -168,10 +169,10 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev) | |||
| 168 | return 0; | 169 | return 0; |
| 169 | if (minor < 0) | 170 | if (minor < 0) |
| 170 | return minor; | 171 | return minor; |
| 171 | down(&sound_oss_mutex); | 172 | mutex_lock(&sound_oss_mutex); |
| 172 | mptr = snd_oss_minors[minor]; | 173 | mptr = snd_oss_minors[minor]; |
| 173 | if (mptr == NULL) { | 174 | if (mptr == NULL) { |
| 174 | up(&sound_oss_mutex); | 175 | mutex_unlock(&sound_oss_mutex); |
| 175 | return -ENOENT; | 176 | return -ENOENT; |
| 176 | } | 177 | } |
| 177 | unregister_sound_special(minor); | 178 | unregister_sound_special(minor); |
| @@ -191,7 +192,7 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev) | |||
| 191 | snd_oss_minors[track2] = NULL; | 192 | snd_oss_minors[track2] = NULL; |
| 192 | } | 193 | } |
| 193 | snd_oss_minors[minor] = NULL; | 194 | snd_oss_minors[minor] = NULL; |
| 194 | up(&sound_oss_mutex); | 195 | mutex_unlock(&sound_oss_mutex); |
| 195 | kfree(mptr); | 196 | kfree(mptr); |
| 196 | return 0; | 197 | return 0; |
| 197 | } | 198 | } |
| @@ -229,7 +230,7 @@ static void snd_minor_info_oss_read(struct snd_info_entry *entry, | |||
| 229 | int minor; | 230 | int minor; |
| 230 | struct snd_minor *mptr; | 231 | struct snd_minor *mptr; |
| 231 | 232 | ||
| 232 | down(&sound_oss_mutex); | 233 | mutex_lock(&sound_oss_mutex); |
| 233 | for (minor = 0; minor < SNDRV_OSS_MINORS; ++minor) { | 234 | for (minor = 0; minor < SNDRV_OSS_MINORS; ++minor) { |
| 234 | if (!(mptr = snd_oss_minors[minor])) | 235 | if (!(mptr = snd_oss_minors[minor])) |
| 235 | continue; | 236 | continue; |
| @@ -241,7 +242,7 @@ static void snd_minor_info_oss_read(struct snd_info_entry *entry, | |||
| 241 | snd_iprintf(buffer, "%3i: : %s\n", minor, | 242 | snd_iprintf(buffer, "%3i: : %s\n", minor, |
| 242 | snd_oss_device_type_name(mptr->type)); | 243 | snd_oss_device_type_name(mptr->type)); |
| 243 | } | 244 | } |
| 244 | up(&sound_oss_mutex); | 245 | mutex_unlock(&sound_oss_mutex); |
| 245 | } | 246 | } |
| 246 | 247 | ||
| 247 | 248 | ||
