diff options
Diffstat (limited to 'sound/core/info_oss.c')
| -rw-r--r-- | sound/core/info_oss.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sound/core/info_oss.c b/sound/core/info_oss.c index 820f4772e44a..f9ce854b3d11 100644 --- a/sound/core/info_oss.c +++ b/sound/core/info_oss.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <sound/info.h> | 28 | #include <sound/info.h> |
| 29 | #include <sound/version.h> | 29 | #include <sound/version.h> |
| 30 | #include <linux/utsname.h> | 30 | #include <linux/utsname.h> |
| 31 | #include <linux/mutex.h> | ||
| 31 | 32 | ||
| 32 | #if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) | 33 | #if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) |
| 33 | 34 | ||
| @@ -35,7 +36,7 @@ | |||
| 35 | * OSS compatible part | 36 | * OSS compatible part |
| 36 | */ | 37 | */ |
| 37 | 38 | ||
| 38 | static DECLARE_MUTEX(strings); | 39 | static DEFINE_MUTEX(strings); |
| 39 | static char *snd_sndstat_strings[SNDRV_CARDS][SNDRV_OSS_INFO_DEV_COUNT]; | 40 | static char *snd_sndstat_strings[SNDRV_CARDS][SNDRV_OSS_INFO_DEV_COUNT]; |
| 40 | static struct snd_info_entry *snd_sndstat_proc_entry; | 41 | static struct snd_info_entry *snd_sndstat_proc_entry; |
| 41 | 42 | ||
| @@ -45,7 +46,7 @@ int snd_oss_info_register(int dev, int num, char *string) | |||
| 45 | 46 | ||
| 46 | snd_assert(dev >= 0 && dev < SNDRV_OSS_INFO_DEV_COUNT, return -ENXIO); | 47 | snd_assert(dev >= 0 && dev < SNDRV_OSS_INFO_DEV_COUNT, return -ENXIO); |
| 47 | snd_assert(num >= 0 && num < SNDRV_CARDS, return -ENXIO); | 48 | snd_assert(num >= 0 && num < SNDRV_CARDS, return -ENXIO); |
| 48 | down(&strings); | 49 | mutex_lock(&strings); |
| 49 | if (string == NULL) { | 50 | if (string == NULL) { |
| 50 | if ((x = snd_sndstat_strings[num][dev]) != NULL) { | 51 | if ((x = snd_sndstat_strings[num][dev]) != NULL) { |
| 51 | kfree(x); | 52 | kfree(x); |
| @@ -54,12 +55,12 @@ int snd_oss_info_register(int dev, int num, char *string) | |||
| 54 | } else { | 55 | } else { |
| 55 | x = kstrdup(string, GFP_KERNEL); | 56 | x = kstrdup(string, GFP_KERNEL); |
| 56 | if (x == NULL) { | 57 | if (x == NULL) { |
| 57 | up(&strings); | 58 | mutex_unlock(&strings); |
| 58 | return -ENOMEM; | 59 | return -ENOMEM; |
| 59 | } | 60 | } |
| 60 | } | 61 | } |
| 61 | snd_sndstat_strings[num][dev] = x; | 62 | snd_sndstat_strings[num][dev] = x; |
| 62 | up(&strings); | 63 | mutex_unlock(&strings); |
| 63 | return 0; | 64 | return 0; |
| 64 | } | 65 | } |
| 65 | 66 | ||
| @@ -71,7 +72,7 @@ static int snd_sndstat_show_strings(struct snd_info_buffer *buf, char *id, int d | |||
| 71 | char *str; | 72 | char *str; |
| 72 | 73 | ||
| 73 | snd_iprintf(buf, "\n%s:", id); | 74 | snd_iprintf(buf, "\n%s:", id); |
| 74 | down(&strings); | 75 | mutex_lock(&strings); |
| 75 | for (idx = 0; idx < SNDRV_CARDS; idx++) { | 76 | for (idx = 0; idx < SNDRV_CARDS; idx++) { |
| 76 | str = snd_sndstat_strings[idx][dev]; | 77 | str = snd_sndstat_strings[idx][dev]; |
| 77 | if (str) { | 78 | if (str) { |
| @@ -82,7 +83,7 @@ static int snd_sndstat_show_strings(struct snd_info_buffer *buf, char *id, int d | |||
| 82 | snd_iprintf(buf, "%i: %s\n", idx, str); | 83 | snd_iprintf(buf, "%i: %s\n", idx, str); |
| 83 | } | 84 | } |
| 84 | } | 85 | } |
| 85 | up(&strings); | 86 | mutex_unlock(&strings); |
| 86 | if (ok < 0) | 87 | if (ok < 0) |
| 87 | snd_iprintf(buf, " NOT ENABLED IN CONFIG\n"); | 88 | snd_iprintf(buf, " NOT ENABLED IN CONFIG\n"); |
| 88 | return ok; | 89 | return ok; |
