diff options
Diffstat (limited to 'sound/core/info.c')
| -rw-r--r-- | sound/core/info.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/sound/core/info.c b/sound/core/info.c index af123e3bdb24..2582b74d3199 100644 --- a/sound/core/info.c +++ b/sound/core/info.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <sound/version.h> | 31 | #include <sound/version.h> |
| 32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
| 33 | #include <linux/devfs_fs_kernel.h> | 33 | #include <linux/devfs_fs_kernel.h> |
| 34 | #include <linux/mutex.h> | ||
| 34 | #include <stdarg.h> | 35 | #include <stdarg.h> |
| 35 | 36 | ||
| 36 | /* | 37 | /* |
| @@ -68,7 +69,7 @@ int snd_info_check_reserved_words(const char *str) | |||
| 68 | return 1; | 69 | return 1; |
| 69 | } | 70 | } |
| 70 | 71 | ||
| 71 | static DECLARE_MUTEX(info_mutex); | 72 | static DEFINE_MUTEX(info_mutex); |
| 72 | 73 | ||
| 73 | struct snd_info_private_data { | 74 | struct snd_info_private_data { |
| 74 | struct snd_info_buffer *rbuffer; | 75 | struct snd_info_buffer *rbuffer; |
| @@ -265,11 +266,11 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) | |||
| 265 | struct proc_dir_entry *p; | 266 | struct proc_dir_entry *p; |
| 266 | int mode, err; | 267 | int mode, err; |
| 267 | 268 | ||
| 268 | down(&info_mutex); | 269 | mutex_lock(&info_mutex); |
| 269 | p = PDE(inode); | 270 | p = PDE(inode); |
| 270 | entry = p == NULL ? NULL : (struct snd_info_entry *)p->data; | 271 | entry = p == NULL ? NULL : (struct snd_info_entry *)p->data; |
| 271 | if (entry == NULL || entry->disconnected) { | 272 | if (entry == NULL || entry->disconnected) { |
| 272 | up(&info_mutex); | 273 | mutex_unlock(&info_mutex); |
| 273 | return -ENODEV; | 274 | return -ENODEV; |
| 274 | } | 275 | } |
| 275 | if (!try_module_get(entry->module)) { | 276 | if (!try_module_get(entry->module)) { |
| @@ -361,13 +362,13 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) | |||
| 361 | break; | 362 | break; |
| 362 | } | 363 | } |
| 363 | file->private_data = data; | 364 | file->private_data = data; |
| 364 | up(&info_mutex); | 365 | mutex_unlock(&info_mutex); |
| 365 | if (entry->content == SNDRV_INFO_CONTENT_TEXT && | 366 | if (entry->content == SNDRV_INFO_CONTENT_TEXT && |
| 366 | (mode == O_RDONLY || mode == O_RDWR)) { | 367 | (mode == O_RDONLY || mode == O_RDWR)) { |
| 367 | if (entry->c.text.read) { | 368 | if (entry->c.text.read) { |
| 368 | down(&entry->access); | 369 | mutex_lock(&entry->access); |
| 369 | entry->c.text.read(entry, data->rbuffer); | 370 | entry->c.text.read(entry, data->rbuffer); |
| 370 | up(&entry->access); | 371 | mutex_unlock(&entry->access); |
| 371 | } | 372 | } |
| 372 | } | 373 | } |
| 373 | return 0; | 374 | return 0; |
| @@ -375,7 +376,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) | |||
| 375 | __error: | 376 | __error: |
| 376 | module_put(entry->module); | 377 | module_put(entry->module); |
| 377 | __error1: | 378 | __error1: |
| 378 | up(&info_mutex); | 379 | mutex_unlock(&info_mutex); |
| 379 | return err; | 380 | return err; |
| 380 | } | 381 | } |
| 381 | 382 | ||
| @@ -747,7 +748,7 @@ static struct snd_info_entry *snd_info_create_entry(const char *name) | |||
| 747 | } | 748 | } |
| 748 | entry->mode = S_IFREG | S_IRUGO; | 749 | entry->mode = S_IFREG | S_IRUGO; |
| 749 | entry->content = SNDRV_INFO_CONTENT_TEXT; | 750 | entry->content = SNDRV_INFO_CONTENT_TEXT; |
| 750 | init_MUTEX(&entry->access); | 751 | mutex_init(&entry->access); |
| 751 | return entry; | 752 | return entry; |
| 752 | } | 753 | } |
| 753 | 754 | ||
| @@ -896,10 +897,10 @@ int snd_info_register(struct snd_info_entry * entry) | |||
| 896 | 897 | ||
| 897 | snd_assert(entry != NULL, return -ENXIO); | 898 | snd_assert(entry != NULL, return -ENXIO); |
| 898 | root = entry->parent == NULL ? snd_proc_root : entry->parent->p; | 899 | root = entry->parent == NULL ? snd_proc_root : entry->parent->p; |
| 899 | down(&info_mutex); | 900 | mutex_lock(&info_mutex); |
| 900 | p = snd_create_proc_entry(entry->name, entry->mode, root); | 901 | p = snd_create_proc_entry(entry->name, entry->mode, root); |
| 901 | if (!p) { | 902 | if (!p) { |
| 902 | up(&info_mutex); | 903 | mutex_unlock(&info_mutex); |
| 903 | return -ENOMEM; | 904 | return -ENOMEM; |
| 904 | } | 905 | } |
| 905 | p->owner = entry->module; | 906 | p->owner = entry->module; |
| @@ -908,7 +909,7 @@ int snd_info_register(struct snd_info_entry * entry) | |||
| 908 | p->size = entry->size; | 909 | p->size = entry->size; |
| 909 | p->data = entry; | 910 | p->data = entry; |
| 910 | entry->p = p; | 911 | entry->p = p; |
| 911 | up(&info_mutex); | 912 | mutex_unlock(&info_mutex); |
| 912 | return 0; | 913 | return 0; |
| 913 | } | 914 | } |
| 914 | 915 | ||
| @@ -929,9 +930,9 @@ int snd_info_unregister(struct snd_info_entry * entry) | |||
| 929 | snd_assert(entry->p != NULL, return -ENXIO); | 930 | snd_assert(entry->p != NULL, return -ENXIO); |
| 930 | root = entry->parent == NULL ? snd_proc_root : entry->parent->p; | 931 | root = entry->parent == NULL ? snd_proc_root : entry->parent->p; |
| 931 | snd_assert(root, return -ENXIO); | 932 | snd_assert(root, return -ENXIO); |
| 932 | down(&info_mutex); | 933 | mutex_lock(&info_mutex); |
| 933 | snd_remove_proc_entry(root, entry->p); | 934 | snd_remove_proc_entry(root, entry->p); |
| 934 | up(&info_mutex); | 935 | mutex_unlock(&info_mutex); |
| 935 | snd_info_free_entry(entry); | 936 | snd_info_free_entry(entry); |
| 936 | return 0; | 937 | return 0; |
| 937 | } | 938 | } |
