summaryrefslogtreecommitdiff
path: root/sound/core/seq
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-16 16:29:08 +0100
committerJaroslav Kysela <perex@suse.cz>2006-03-22 10:24:50 +0100
commit1a60d4c5a0c4028559585a74e48593b16e1ca9b2 (patch)
treef03f8dfcd554f8ebbb295522dc46dfe4d110a484 /sound/core/seq
parentf0283f45a04d5cf31512e5e390a38504d97e7a97 (diff)
[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 <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/seq')
-rw-r--r--sound/core/seq/oss/seq_oss.c27
-rw-r--r--sound/core/seq/seq_clientmgr.c40
-rw-r--r--sound/core/seq/seq_clientmgr.h2
-rw-r--r--sound/core/seq/seq_device.c53
-rw-r--r--sound/core/seq/seq_instr.c6
-rw-r--r--sound/core/seq/seq_midi.c20
-rw-r--r--sound/core/seq/seq_ports.c12
-rw-r--r--sound/core/seq/seq_queue.c6
-rw-r--r--sound/core/seq/seq_queue.h2
9 files changed, 85 insertions, 83 deletions
diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c
index c98f0ba13810..b9919785180b 100644
--- a/sound/core/seq/oss/seq_oss.c
+++ b/sound/core/seq/oss/seq_oss.c
@@ -24,6 +24,7 @@
#include <linux/init.h>
#include <linux/smp_lock.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/minors.h>
#include <sound/initval.h>
@@ -124,7 +125,7 @@ module_exit(alsa_seq_oss_exit)
* ALSA minor device interface
*/
-static DECLARE_MUTEX(register_mutex);
+static DEFINE_MUTEX(register_mutex);
static int
odev_open(struct inode *inode, struct file *file)
@@ -136,9 +137,9 @@ odev_open(struct inode *inode, struct file *file)
else
level = SNDRV_SEQ_OSS_MODE_SYNTH;
- down(&register_mutex);
+ mutex_lock(&register_mutex);
rc = snd_seq_oss_open(file, level);
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
return rc;
}
@@ -153,9 +154,9 @@ odev_release(struct inode *inode, struct file *file)
snd_seq_oss_drain_write(dp);
- down(&register_mutex);
+ mutex_lock(&register_mutex);
snd_seq_oss_release(dp);
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
return 0;
}
@@ -224,13 +225,13 @@ register_device(void)
{
int rc;
- down(&register_mutex);
+ mutex_lock(&register_mutex);
if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER,
NULL, 0,
&seq_oss_f_ops, NULL,
SNDRV_SEQ_OSS_DEVNAME)) < 0) {
snd_printk(KERN_ERR "can't register device seq\n");
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
return rc;
}
if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC,
@@ -239,24 +240,24 @@ register_device(void)
SNDRV_SEQ_OSS_DEVNAME)) < 0) {
snd_printk(KERN_ERR "can't register device music\n");
snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0);
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
return rc;
}
debug_printk(("device registered\n"));
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
return 0;
}
static void
unregister_device(void)
{
- down(&register_mutex);
+ mutex_lock(&register_mutex);
debug_printk(("device unregistered\n"));
if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC, NULL, 0) < 0)
snd_printk(KERN_ERR "error unregister device music\n");
if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0) < 0)
snd_printk(KERN_ERR "error unregister device seq\n");
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
}
/*
@@ -270,12 +271,12 @@ static struct snd_info_entry *info_entry;
static void
info_read(struct snd_info_entry *entry, struct snd_info_buffer *buf)
{
- down(&register_mutex);
+ mutex_lock(&register_mutex);
snd_iprintf(buf, "OSS sequencer emulation version %s\n", SNDRV_SEQ_OSS_VERSION_STR);
snd_seq_oss_system_info_read(buf);
snd_seq_oss_synth_info_read(buf);
snd_seq_oss_midi_info_read(buf);
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
}
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index fd2032eae214..aae6420f5948 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -67,7 +67,7 @@
#define SNDRV_SEQ_LFLG_OPEN (SNDRV_SEQ_LFLG_INPUT|SNDRV_SEQ_LFLG_OUTPUT)
static DEFINE_SPINLOCK(clients_lock);
-static DECLARE_MUTEX(register_mutex);
+static DEFINE_MUTEX(register_mutex);
/*
* client table
@@ -237,7 +237,7 @@ static struct snd_seq_client *seq_create_client1(int client_index, int poolsize)
client->type = NO_CLIENT;
snd_use_lock_init(&client->use_lock);
rwlock_init(&client->ports_lock);
- init_MUTEX(&client->ports_mutex);
+ mutex_init(&client->ports_mutex);
INIT_LIST_HEAD(&client->ports_list_head);
/* find free slot in the client table */
@@ -290,7 +290,7 @@ static int seq_free_client1(struct snd_seq_client *client)
static void seq_free_client(struct snd_seq_client * client)
{
- down(&register_mutex);
+ mutex_lock(&register_mutex);
switch (client->type) {
case NO_CLIENT:
snd_printk(KERN_WARNING "Seq: Trying to free unused client %d\n",
@@ -306,7 +306,7 @@ static void seq_free_client(struct snd_seq_client * client)
snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n",
client->number, client->type);
}
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
snd_seq_system_client_ev_client_exit(client->number);
}
@@ -322,11 +322,11 @@ static int snd_seq_open(struct inode *inode, struct file *file)
struct snd_seq_client *client;
struct snd_seq_user_client *user;
- if (down_interruptible(&register_mutex))
+ if (mutex_lock_interruptible(&register_mutex))
return -ERESTARTSYS;
client = seq_create_client1(-1, SNDRV_SEQ_DEFAULT_EVENTS);
if (client == NULL) {
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
return -ENOMEM; /* failure code */
}
@@ -346,14 +346,14 @@ static int snd_seq_open(struct inode *inode, struct file *file)
if (user->fifo == NULL) {
seq_free_client1(client);
kfree(client);
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
return -ENOMEM;
}
}
usage_alloc(&client_usage, 1);
client->type = USER_CLIENT;
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
c = client->number;
file->private_data = client;
@@ -1743,7 +1743,7 @@ static int snd_seq_ioctl_get_queue_timer(struct snd_seq_client *client,
if (queue == NULL)
return -EINVAL;
- if (down_interruptible(&queue->timer_mutex)) {
+ if (mutex_lock_interruptible(&queue->timer_mutex)) {
queuefree(queue);
return -ERESTARTSYS;
}
@@ -1756,7 +1756,7 @@ static int snd_seq_ioctl_get_queue_timer(struct snd_seq_client *client,
timer.u.alsa.id = tmr->alsa_id;
timer.u.alsa.resolution = tmr->preferred_resolution;
}
- up(&queue->timer_mutex);
+ mutex_unlock(&queue->timer_mutex);
queuefree(queue);
if (copy_to_user(arg, &timer, sizeof(timer)))
@@ -1785,7 +1785,7 @@ static int snd_seq_ioctl_set_queue_timer(struct snd_seq_client *client,
q = queueptr(timer.queue);
if (q == NULL)
return -ENXIO;
- if (down_interruptible(&q->timer_mutex)) {
+ if (mutex_lock_interruptible(&q->timer_mutex)) {
queuefree(q);
return -ERESTARTSYS;
}
@@ -1797,7 +1797,7 @@ static int snd_seq_ioctl_set_queue_timer(struct snd_seq_client *client,
tmr->preferred_resolution = timer.u.alsa.resolution;
}
result = snd_seq_queue_timer_open(timer.queue);
- up(&q->timer_mutex);
+ mutex_unlock(&q->timer_mutex);
queuefree(q);
} else {
return -EPERM;
@@ -2230,7 +2230,7 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
if (card == NULL && client_index >= SNDRV_SEQ_GLOBAL_CLIENTS)
return -EINVAL;
- if (down_interruptible(&register_mutex))
+ if (mutex_lock_interruptible(&register_mutex))
return -ERESTARTSYS;
if (card) {
@@ -2243,7 +2243,7 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
/* empty write queue as default */
client = seq_create_client1(client_index, 0);
if (client == NULL) {
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
return -EBUSY; /* failure code */
}
usage_alloc(&client_usage, 1);
@@ -2256,7 +2256,7 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
va_end(args);
client->type = KERNEL_CLIENT;
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
/* make others aware this new client */
snd_seq_system_client_ev_client_start(client->number);
@@ -2464,7 +2464,7 @@ static void snd_seq_info_dump_ports(struct snd_info_buffer *buffer,
{
struct list_head *l;
- down(&client->ports_mutex);
+ mutex_lock(&client->ports_mutex);
list_for_each(l, &client->ports_list_head) {
struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
snd_iprintf(buffer, " Port %3d : \"%s\" (%c%c%c%c)\n",
@@ -2476,7 +2476,7 @@ static void snd_seq_info_dump_ports(struct snd_info_buffer *buffer,
snd_seq_info_dump_subscribers(buffer, &p->c_src, 1, " Connecting To: ");
snd_seq_info_dump_subscribers(buffer, &p->c_dest, 0, " Connected From: ");
}
- up(&client->ports_mutex);
+ mutex_unlock(&client->ports_mutex);
}
@@ -2550,16 +2550,16 @@ int __init snd_sequencer_device_init(void)
{
int err;
- if (down_interruptible(&register_mutex))
+ if (mutex_lock_interruptible(&register_mutex))
return -ERESTARTSYS;
if ((err = snd_register_device(SNDRV_DEVICE_TYPE_SEQUENCER, NULL, 0,
&snd_seq_f_ops, NULL, "seq")) < 0) {
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
return err;
}
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
return 0;
}
diff --git a/sound/core/seq/seq_clientmgr.h b/sound/core/seq/seq_clientmgr.h
index 450091ca153d..5e04e20e239f 100644
--- a/sound/core/seq/seq_clientmgr.h
+++ b/sound/core/seq/seq_clientmgr.h
@@ -58,7 +58,7 @@ struct snd_seq_client {
int num_ports; /* number of ports */
struct list_head ports_list_head;
rwlock_t ports_lock;
- struct semaphore ports_mutex;
+ struct mutex ports_mutex;
int convert32; /* convert 32->64bit */
/* output pool */
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c
index 9ece443fba55..d9a3e5a18d6a 100644
--- a/sound/core/seq/seq_device.c
+++ b/sound/core/seq/seq_device.c
@@ -45,6 +45,7 @@
#include <sound/initval.h>
#include <linux/kmod.h>
#include <linux/slab.h>
+#include <linux/mutex.h>
MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
MODULE_DESCRIPTION("ALSA sequencer device management");
@@ -69,7 +70,7 @@ struct ops_list {
struct list_head dev_list; /* list of devices */
int num_devices; /* number of associated devices */
int num_init_devices; /* number of initialized devices */
- struct semaphore reg_mutex;
+ struct mutex reg_mutex;
struct list_head list; /* next driver */
};
@@ -77,7 +78,7 @@ struct ops_list {
static LIST_HEAD(opslist);
static int num_ops;
-static DECLARE_MUTEX(ops_mutex);
+static DEFINE_MUTEX(ops_mutex);
#ifdef CONFIG_PROC_FS
static struct snd_info_entry *info_entry = NULL;
#endif
@@ -108,7 +109,7 @@ static void snd_seq_device_info(struct snd_info_entry *entry,
{
struct list_head *head;
- down(&ops_mutex);
+ mutex_lock(&ops_mutex);
list_for_each(head, &opslist) {
struct ops_list *ops = list_entry(head, struct ops_list, list);
snd_iprintf(buffer, "snd-%s%s%s%s,%d\n",
@@ -118,7 +119,7 @@ static void snd_seq_device_info(struct snd_info_entry *entry,
ops->driver & DRIVER_LOCKED ? ",locked" : "",
ops->num_devices);
}
- up(&ops_mutex);
+ mutex_unlock(&ops_mutex);
}
#endif
@@ -154,20 +155,20 @@ void snd_seq_device_load_drivers(void)
if (! current->fs->root)
return;
- down(&ops_mutex);
+ mutex_lock(&ops_mutex);
list_for_each(head, &opslist) {
struct ops_list *ops = list_entry(head, struct ops_list, list);
if (! (ops->driver & DRIVER_LOADED) &&
! (ops->driver & DRIVER_REQUESTED)) {
ops->used++;
- up(&ops_mutex);
+ mutex_unlock(&ops_mutex);
ops->driver |= DRIVER_REQUESTED;
request_module("snd-%s", ops->id);
- down(&ops_mutex);
+ mutex_lock(&ops_mutex);
ops->used--;
}
}
- up(&ops_mutex);
+ mutex_unlock(&ops_mutex);
#endif
}
@@ -214,10 +215,10 @@ int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize,
dev->status = SNDRV_SEQ_DEVICE_FREE;
/* add this device to the list */
- down(&ops->reg_mutex);
+ mutex_lock(&ops->reg_mutex);
list_add_tail(&dev->list, &ops->dev_list);
ops->num_devices++;
- up(&ops->reg_mutex);
+ mutex_unlock(&ops->reg_mutex);
unlock_driver(ops);
@@ -246,10 +247,10 @@ static int snd_seq_device_free(struct snd_seq_device *dev)
return -ENXIO;
/* remove the device from the list */
- down(&ops->reg_mutex);
+ mutex_lock(&ops->reg_mutex);
list_del(&dev->list);
ops->num_devices--;
- up(&ops->reg_mutex);
+ mutex_unlock(&ops->reg_mutex);
free_device(dev, ops);
if (dev->private_free)
@@ -344,7 +345,7 @@ int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry,
return -EBUSY;
}
- down(&ops->reg_mutex);
+ mutex_lock(&ops->reg_mutex);
/* copy driver operators */
ops->ops = *entry;
ops->driver |= DRIVER_LOADED;
@@ -355,7 +356,7 @@ int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry,
struct snd_seq_device *dev = list_entry(head, struct snd_seq_device, list);
init_device(dev, ops);
}
- up(&ops->reg_mutex);
+ mutex_unlock(&ops->reg_mutex);
unlock_driver(ops);
snd_seq_autoload_unlock();
@@ -378,17 +379,17 @@ static struct ops_list * create_driver(char *id)
/* set up driver entry */
strlcpy(ops->id, id, sizeof(ops->id));
- init_MUTEX(&ops->reg_mutex);
+ mutex_init(&ops->reg_mutex);
ops->driver = DRIVER_EMPTY;
INIT_LIST_HEAD(&ops->dev_list);
/* lock this instance */
ops->used = 1;
/* register driver entry */
- down(&ops_mutex);
+ mutex_lock(&ops_mutex);
list_add_tail(&ops->list, &opslist);
num_ops++;
- up(&ops_mutex);
+ mutex_unlock(&ops_mutex);
return ops;
}
@@ -414,7 +415,7 @@ int snd_seq_device_unregister_driver(char *id)
}
/* close and release all devices associated with this driver */
- down(&ops->reg_mutex);
+ mutex_lock(&ops->reg_mutex);
ops->driver |= DRIVER_LOCKED; /* do not remove this driver recursively */
list_for_each(head, &ops->dev_list) {
struct snd_seq_device *dev = list_entry(head, struct snd_seq_device, list);
@@ -425,7 +426,7 @@ int snd_seq_device_unregister_driver(char *id)
if (ops->num_init_devices > 0)
snd_printk(KERN_ERR "free_driver: init_devices > 0!! (%d)\n",
ops->num_init_devices);
- up(&ops->reg_mutex);
+ mutex_unlock(&ops->reg_mutex);
unlock_driver(ops);
@@ -443,7 +444,7 @@ static void remove_drivers(void)
{
struct list_head *head;
- down(&ops_mutex);
+ mutex_lock(&ops_mutex);
head = opslist.next;
while (head != &opslist) {
struct ops_list *ops = list_entry(head, struct ops_list, list);
@@ -456,7 +457,7 @@ static void remove_drivers(void)
} else
head = head->next;
}
- up(&ops_mutex);
+ mutex_unlock(&ops_mutex);
}
/*
@@ -519,16 +520,16 @@ static struct ops_list * find_driver(char *id, int create_if_empty)
{
struct list_head *head;
- down(&ops_mutex);
+ mutex_lock(&ops_mutex);
list_for_each(head, &opslist) {
struct ops_list *ops = list_entry(head, struct ops_list, list);
if (strcmp(ops->id, id) == 0) {
ops->used++;
- up(&ops_mutex);
+ mutex_unlock(&ops_mutex);
return ops;
}
}
- up(&ops_mutex);
+ mutex_unlock(&ops_mutex);
if (create_if_empty)
return create_driver(id);
return NULL;
@@ -536,9 +537,9 @@ static struct ops_list * find_driver(char *id, int create_if_empty)
static void unlock_driver(struct ops_list *ops)
{
- down(&ops_mutex);
+ mutex_lock(&ops_mutex);
ops->used--;
- up(&ops_mutex);
+ mutex_unlock(&ops_mutex);
}
diff --git a/sound/core/seq/seq_instr.c b/sound/core/seq/seq_instr.c
index 487452063965..f30d171b6d96 100644
--- a/sound/core/seq/seq_instr.c
+++ b/sound/core/seq/seq_instr.c
@@ -36,7 +36,7 @@ static void snd_instr_lock_ops(struct snd_seq_kinstr_list *list)
if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) {
spin_lock_irqsave(&list->ops_lock, list->ops_flags);
} else {
- down(&list->ops_mutex);
+ mutex_lock(&list->ops_mutex);
}
}
@@ -45,7 +45,7 @@ static void snd_instr_unlock_ops(struct snd_seq_kinstr_list *list)
if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) {
spin_unlock_irqrestore(&list->ops_lock, list->ops_flags);
} else {
- up(&list->ops_mutex);
+ mutex_unlock(&list->ops_mutex);
}
}
@@ -82,7 +82,7 @@ struct snd_seq_kinstr_list *snd_seq_instr_list_new(void)
return NULL;
spin_lock_init(&list->lock);
spin_lock_init(&list->ops_lock);
- init_MUTEX(&list->ops_mutex);
+ mutex_init(&list->ops_mutex);
list->owner = -1;
return list;
}
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c
index ce0df86157de..9caa1372bece 100644
--- a/sound/core/seq/seq_midi.c
+++ b/sound/core/seq/seq_midi.c
@@ -32,7 +32,7 @@ Possible options for midisynth module:
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/moduleparam.h>
-#include <asm/semaphore.h>
+#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/rawmidi.h>
#include <sound/seq_kernel.h>
@@ -70,7 +70,7 @@ struct seq_midisynth_client {
};
static struct seq_midisynth_client *synths[SNDRV_CARDS];
-static DECLARE_MUTEX(register_mutex);
+static DEFINE_MUTEX(register_mutex);
/* handle rawmidi input event (MIDI v1.0 stream) */
static void snd_midi_input_event(struct snd_rawmidi_substream *substream)
@@ -308,13 +308,13 @@ snd_seq_midisynth_register_port(struct snd_seq_device *dev)
if (ports > (256 / SNDRV_RAWMIDI_DEVICES))
ports = 256 / SNDRV_RAWMIDI_DEVICES;
- down(&register_mutex);
+ mutex_lock(&register_mutex);
client = synths[card->number];
if (client == NULL) {
newclient = 1;
client = kzalloc(sizeof(*client), GFP_KERNEL);
if (client == NULL) {
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
kfree(info);
return -ENOMEM;
}
@@ -324,7 +324,7 @@ snd_seq_midisynth_register_port(struct snd_seq_device *dev)
(const char *)info->name : "External MIDI");
if (client->seq_client < 0) {
kfree(client);
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
kfree(info);
return -ENOMEM;
}
@@ -397,7 +397,7 @@ snd_seq_midisynth_register_port(struct snd_seq_device *dev)
client->num_ports++;
if (newclient)
synths[card->number] = client;
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
kfree(info);
kfree(port);
return 0; /* success */
@@ -414,7 +414,7 @@ snd_seq_midisynth_register_port(struct snd_seq_device *dev)
}
kfree(info);
kfree(port);
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
return -ENOMEM;
}
@@ -427,10 +427,10 @@ snd_seq_midisynth_unregister_port(struct snd_seq_device *dev)
struct snd_card *card = dev->card;
int device = dev->device, p, ports;
- down(&register_mutex);
+ mutex_lock(&register_mutex);
client = synths[card->number];
if (client == NULL || client->ports[device] == NULL) {
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
return -ENODEV;
}
ports = client->ports_per_device[device];
@@ -446,7 +446,7 @@ snd_seq_midisynth_unregister_port(struct snd_seq_device *dev)
synths[card->number] = NULL;
kfree(client);
}
- up(&register_mutex);
+ mutex_unlock(&register_mutex);
return 0;
}
diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c
index 2b384fd7967f..41e078c938cd 100644
--- a/sound/core/seq/seq_ports.c
+++ b/sound/core/seq/seq_ports.c
@@ -159,7 +159,7 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client,
port_subs_info_init(&new_port->c_dest);
num = port >= 0 ? port : 0;
- down(&client->ports_mutex);
+ mutex_lock(&client->ports_mutex);
write_lock_irqsave(&client->ports_lock, flags);
list_for_each(l, &client->ports_list_head) {
struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
@@ -173,7 +173,7 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client,
client->num_ports++;
new_port->addr.port = num; /* store the port number in the port */
write_unlock_irqrestore(&client->ports_lock, flags);
- up(&client->ports_mutex);
+ mutex_unlock(&client->ports_mutex);
sprintf(new_port->name, "port-%d", num);
return new_port;
@@ -292,7 +292,7 @@ int snd_seq_delete_port(struct snd_seq_client *client, int port)
struct list_head *l;
struct snd_seq_client_port *found = NULL;
- down(&client->ports_mutex);
+ mutex_lock(&client->ports_mutex);
write_lock_irqsave(&client->ports_lock, flags);
list_for_each(l, &client->ports_list_head) {
struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
@@ -305,7 +305,7 @@ int snd_seq_delete_port(struct snd_seq_client *client, int port)
}
}
write_unlock_irqrestore(&client->ports_lock, flags);
- up(&client->ports_mutex);
+ mutex_unlock(&client->ports_mutex);
if (found)
return port_delete(client, found);
else
@@ -321,7 +321,7 @@ int snd_seq_delete_all_ports(struct snd_seq_client *client)
/* move the port list to deleted_list, and
* clear the port list in the client data.
*/
- down(&client->ports_mutex);
+ mutex_lock(&client->ports_mutex);
write_lock_irqsave(&client->ports_lock, flags);
if (! list_empty(&client->ports_list_head)) {
__list_add(&deleted_list,
@@ -341,7 +341,7 @@ int snd_seq_delete_all_ports(struct snd_seq_client *client)
snd_seq_system_client_ev_port_exit(port->addr.client, port->addr.port);
port_delete(client, port);
}
- up(&client->ports_mutex);
+ mutex_unlock(&client->ports_mutex);
return 0;
}
diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
index 9cf20f045542..9b87bb0c7f33 100644
--- a/sound/core/seq/seq_queue.c
+++ b/sound/core/seq/seq_queue.c
@@ -119,7 +119,7 @@ static struct snd_seq_queue *queue_new(int owner, int locked)
spin_lock_init(&q->owner_lock);
spin_lock_init(&q->check_lock);
- init_MUTEX(&q->timer_mutex);
+ mutex_init(&q->timer_mutex);
snd_use_lock_init(&q->use_lock);
q->queue = -1;
@@ -516,7 +516,7 @@ int snd_seq_queue_use(int queueid, int client, int use)
queue = queueptr(queueid);
if (queue == NULL)
return -EINVAL;
- down(&queue->timer_mutex);
+ mutex_lock(&queue->timer_mutex);
if (use) {
if (!test_and_set_bit(client, queue->clients_bitmap))
queue->clients++;
@@ -531,7 +531,7 @@ int snd_seq_queue_use(int queueid, int client, int use)
} else {
snd_seq_timer_close(queue);
}
- up(&queue->timer_mutex);
+ mutex_unlock(&queue->timer_mutex);
queuefree(queue);
return 0;
}
diff --git a/sound/core/seq/seq_queue.h b/sound/core/seq/seq_queue.h
index 888438599387..30c8111477f6 100644
--- a/sound/core/seq/seq_queue.h
+++ b/sound/core/seq/seq_queue.h
@@ -54,7 +54,7 @@ struct snd_seq_queue {
/* clients which uses this queue (bitmap) */
DECLARE_BITMAP(clients_bitmap, SNDRV_SEQ_MAX_CLIENTS);
unsigned int clients; /* users of this queue */
- struct semaphore timer_mutex;
+ struct mutex timer_mutex;
snd_use_lock_t use_lock;
};