From 1a60d4c5a0c4028559585a74e48593b16e1ca9b2 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Mon, 16 Jan 2006 16:29:08 +0100 Subject: [ALSA] semaphore -> mutex (core part) Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai --- sound/core/info.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'sound/core/info.c') diff --git a/sound/core/info.c b/sound/core/info.c index af123e3bdb2..2582b74d319 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -31,6 +31,7 @@ #include #include #include +#include #include /* @@ -68,7 +69,7 @@ int snd_info_check_reserved_words(const char *str) return 1; } -static DECLARE_MUTEX(info_mutex); +static DEFINE_MUTEX(info_mutex); struct snd_info_private_data { struct snd_info_buffer *rbuffer; @@ -265,11 +266,11 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) struct proc_dir_entry *p; int mode, err; - down(&info_mutex); + mutex_lock(&info_mutex); p = PDE(inode); entry = p == NULL ? NULL : (struct snd_info_entry *)p->data; if (entry == NULL || entry->disconnected) { - up(&info_mutex); + mutex_unlock(&info_mutex); return -ENODEV; } if (!try_module_get(entry->module)) { @@ -361,13 +362,13 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) break; } file->private_data = data; - up(&info_mutex); + mutex_unlock(&info_mutex); if (entry->content == SNDRV_INFO_CONTENT_TEXT && (mode == O_RDONLY || mode == O_RDWR)) { if (entry->c.text.read) { - down(&entry->access); + mutex_lock(&entry->access); entry->c.text.read(entry, data->rbuffer); - up(&entry->access); + mutex_unlock(&entry->access); } } return 0; @@ -375,7 +376,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) __error: module_put(entry->module); __error1: - up(&info_mutex); + mutex_unlock(&info_mutex); return err; } @@ -747,7 +748,7 @@ static struct snd_info_entry *snd_info_create_entry(const char *name) } entry->mode = S_IFREG | S_IRUGO; entry->content = SNDRV_INFO_CONTENT_TEXT; - init_MUTEX(&entry->access); + mutex_init(&entry->access); return entry; } @@ -896,10 +897,10 @@ int snd_info_register(struct snd_info_entry * entry) snd_assert(entry != NULL, return -ENXIO); root = entry->parent == NULL ? snd_proc_root : entry->parent->p; - down(&info_mutex); + mutex_lock(&info_mutex); p = snd_create_proc_entry(entry->name, entry->mode, root); if (!p) { - up(&info_mutex); + mutex_unlock(&info_mutex); return -ENOMEM; } p->owner = entry->module; @@ -908,7 +909,7 @@ int snd_info_register(struct snd_info_entry * entry) p->size = entry->size; p->data = entry; entry->p = p; - up(&info_mutex); + mutex_unlock(&info_mutex); return 0; } @@ -929,9 +930,9 @@ int snd_info_unregister(struct snd_info_entry * entry) snd_assert(entry->p != NULL, return -ENXIO); root = entry->parent == NULL ? snd_proc_root : entry->parent->p; snd_assert(root, return -ENXIO); - down(&info_mutex); + mutex_lock(&info_mutex); snd_remove_proc_entry(root, entry->p); - up(&info_mutex); + mutex_unlock(&info_mutex); snd_info_free_entry(entry); return 0; } -- cgit v1.2.3