diff options
Diffstat (limited to 'sound/core/seq/seq_clientmgr.c')
-rw-r--r-- | sound/core/seq/seq_clientmgr.c | 40 |
1 files changed, 20 insertions, 20 deletions
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 @@ | |||
67 | #define SNDRV_SEQ_LFLG_OPEN (SNDRV_SEQ_LFLG_INPUT|SNDRV_SEQ_LFLG_OUTPUT) | 67 | #define SNDRV_SEQ_LFLG_OPEN (SNDRV_SEQ_LFLG_INPUT|SNDRV_SEQ_LFLG_OUTPUT) |
68 | 68 | ||
69 | static DEFINE_SPINLOCK(clients_lock); | 69 | static DEFINE_SPINLOCK(clients_lock); |
70 | static DECLARE_MUTEX(register_mutex); | 70 | static DEFINE_MUTEX(register_mutex); |
71 | 71 | ||
72 | /* | 72 | /* |
73 | * client table | 73 | * client table |
@@ -237,7 +237,7 @@ static struct snd_seq_client *seq_create_client1(int client_index, int poolsize) | |||
237 | client->type = NO_CLIENT; | 237 | client->type = NO_CLIENT; |
238 | snd_use_lock_init(&client->use_lock); | 238 | snd_use_lock_init(&client->use_lock); |
239 | rwlock_init(&client->ports_lock); | 239 | rwlock_init(&client->ports_lock); |
240 | init_MUTEX(&client->ports_mutex); | 240 | mutex_init(&client->ports_mutex); |
241 | INIT_LIST_HEAD(&client->ports_list_head); | 241 | INIT_LIST_HEAD(&client->ports_list_head); |
242 | 242 | ||
243 | /* find free slot in the client table */ | 243 | /* find free slot in the client table */ |
@@ -290,7 +290,7 @@ static int seq_free_client1(struct snd_seq_client *client) | |||
290 | 290 | ||
291 | static void seq_free_client(struct snd_seq_client * client) | 291 | static void seq_free_client(struct snd_seq_client * client) |
292 | { | 292 | { |
293 | down(®ister_mutex); | 293 | mutex_lock(®ister_mutex); |
294 | switch (client->type) { | 294 | switch (client->type) { |
295 | case NO_CLIENT: | 295 | case NO_CLIENT: |
296 | snd_printk(KERN_WARNING "Seq: Trying to free unused client %d\n", | 296 | 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) | |||
306 | snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n", | 306 | snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n", |
307 | client->number, client->type); | 307 | client->number, client->type); |
308 | } | 308 | } |
309 | up(®ister_mutex); | 309 | mutex_unlock(®ister_mutex); |
310 | 310 | ||
311 | snd_seq_system_client_ev_client_exit(client->number); | 311 | snd_seq_system_client_ev_client_exit(client->number); |
312 | } | 312 | } |
@@ -322,11 +322,11 @@ static int snd_seq_open(struct inode *inode, struct file *file) | |||
322 | struct snd_seq_client *client; | 322 | struct snd_seq_client *client; |
323 | struct snd_seq_user_client *user; | 323 | struct snd_seq_user_client *user; |
324 | 324 | ||
325 | if (down_interruptible(®ister_mutex)) | 325 | if (mutex_lock_interruptible(®ister_mutex)) |
326 | return -ERESTARTSYS; | 326 | return -ERESTARTSYS; |
327 | client = seq_create_client1(-1, SNDRV_SEQ_DEFAULT_EVENTS); | 327 | client = seq_create_client1(-1, SNDRV_SEQ_DEFAULT_EVENTS); |
328 | if (client == NULL) { | 328 | if (client == NULL) { |
329 | up(®ister_mutex); | 329 | mutex_unlock(®ister_mutex); |
330 | return -ENOMEM; /* failure code */ | 330 | return -ENOMEM; /* failure code */ |
331 | } | 331 | } |
332 | 332 | ||
@@ -346,14 +346,14 @@ static int snd_seq_open(struct inode *inode, struct file *file) | |||
346 | if (user->fifo == NULL) { | 346 | if (user->fifo == NULL) { |
347 | seq_free_client1(client); | 347 | seq_free_client1(client); |
348 | kfree(client); | 348 | kfree(client); |
349 | up(®ister_mutex); | 349 | mutex_unlock(®ister_mutex); |
350 | return -ENOMEM; | 350 | return -ENOMEM; |
351 | } | 351 | } |
352 | } | 352 | } |
353 | 353 | ||
354 | usage_alloc(&client_usage, 1); | 354 | usage_alloc(&client_usage, 1); |
355 | client->type = USER_CLIENT; | 355 | client->type = USER_CLIENT; |
356 | up(®ister_mutex); | 356 | mutex_unlock(®ister_mutex); |
357 | 357 | ||
358 | c = client->number; | 358 | c = client->number; |
359 | file->private_data = client; | 359 | file->private_data = client; |
@@ -1743,7 +1743,7 @@ static int snd_seq_ioctl_get_queue_timer(struct snd_seq_client *client, | |||
1743 | if (queue == NULL) | 1743 | if (queue == NULL) |
1744 | return -EINVAL; | 1744 | return -EINVAL; |
1745 | 1745 | ||
1746 | if (down_interruptible(&queue->timer_mutex)) { | 1746 | if (mutex_lock_interruptible(&queue->timer_mutex)) { |
1747 | queuefree(queue); | 1747 | queuefree(queue); |
1748 | return -ERESTARTSYS; | 1748 | return -ERESTARTSYS; |
1749 | } | 1749 | } |
@@ -1756,7 +1756,7 @@ static int snd_seq_ioctl_get_queue_timer(struct snd_seq_client *client, | |||
1756 | timer.u.alsa.id = tmr->alsa_id; | 1756 | timer.u.alsa.id = tmr->alsa_id; |
1757 | timer.u.alsa.resolution = tmr->preferred_resolution; | 1757 | timer.u.alsa.resolution = tmr->preferred_resolution; |
1758 | } | 1758 | } |
1759 | up(&queue->timer_mutex); | 1759 | mutex_unlock(&queue->timer_mutex); |
1760 | queuefree(queue); | 1760 | queuefree(queue); |
1761 | 1761 | ||
1762 | if (copy_to_user(arg, &timer, sizeof(timer))) | 1762 | 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, | |||
1785 | q = queueptr(timer.queue); | 1785 | q = queueptr(timer.queue); |
1786 | if (q == NULL) | 1786 | if (q == NULL) |
1787 | return -ENXIO; | 1787 | return -ENXIO; |
1788 | if (down_interruptible(&q->timer_mutex)) { | 1788 | if (mutex_lock_interruptible(&q->timer_mutex)) { |
1789 | queuefree(q); | 1789 | queuefree(q); |
1790 | return -ERESTARTSYS; | 1790 | return -ERESTARTSYS; |
1791 | } | 1791 | } |
@@ -1797,7 +1797,7 @@ static int snd_seq_ioctl_set_queue_timer(struct snd_seq_client *client, | |||
1797 | tmr->preferred_resolution = timer.u.alsa.resolution; | 1797 | tmr->preferred_resolution = timer.u.alsa.resolution; |
1798 | } | 1798 | } |
1799 | result = snd_seq_queue_timer_open(timer.queue); | 1799 | result = snd_seq_queue_timer_open(timer.queue); |
1800 | up(&q->timer_mutex); | 1800 | mutex_unlock(&q->timer_mutex); |
1801 | queuefree(q); | 1801 | queuefree(q); |
1802 | } else { | 1802 | } else { |
1803 | return -EPERM; | 1803 | return -EPERM; |
@@ -2230,7 +2230,7 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index, | |||
2230 | if (card == NULL && client_index >= SNDRV_SEQ_GLOBAL_CLIENTS) | 2230 | if (card == NULL && client_index >= SNDRV_SEQ_GLOBAL_CLIENTS) |
2231 | return -EINVAL; | 2231 | return -EINVAL; |
2232 | 2232 | ||
2233 | if (down_interruptible(®ister_mutex)) | 2233 | if (mutex_lock_interruptible(®ister_mutex)) |
2234 | return -ERESTARTSYS; | 2234 | return -ERESTARTSYS; |
2235 | 2235 | ||
2236 | if (card) { | 2236 | if (card) { |
@@ -2243,7 +2243,7 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index, | |||
2243 | /* empty write queue as default */ | 2243 | /* empty write queue as default */ |
2244 | client = seq_create_client1(client_index, 0); | 2244 | client = seq_create_client1(client_index, 0); |
2245 | if (client == NULL) { | 2245 | if (client == NULL) { |
2246 | up(®ister_mutex); | 2246 | mutex_unlock(®ister_mutex); |
2247 | return -EBUSY; /* failure code */ | 2247 | return -EBUSY; /* failure code */ |
2248 | } | 2248 | } |
2249 | usage_alloc(&client_usage, 1); | 2249 | usage_alloc(&client_usage, 1); |
@@ -2256,7 +2256,7 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index, | |||
2256 | va_end(args); | 2256 | va_end(args); |
2257 | 2257 | ||
2258 | client->type = KERNEL_CLIENT; | 2258 | client->type = KERNEL_CLIENT; |
2259 | up(®ister_mutex); | 2259 | mutex_unlock(®ister_mutex); |
2260 | 2260 | ||
2261 | /* make others aware this new client */ | 2261 | /* make others aware this new client */ |
2262 | snd_seq_system_client_ev_client_start(client->number); | 2262 | 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, | |||
2464 | { | 2464 | { |
2465 | struct list_head *l; | 2465 | struct list_head *l; |
2466 | 2466 | ||
2467 | down(&client->ports_mutex); | 2467 | mutex_lock(&client->ports_mutex); |
2468 | list_for_each(l, &client->ports_list_head) { | 2468 | list_for_each(l, &client->ports_list_head) { |
2469 | struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list); | 2469 | struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list); |
2470 | snd_iprintf(buffer, " Port %3d : \"%s\" (%c%c%c%c)\n", | 2470 | 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, | |||
2476 | snd_seq_info_dump_subscribers(buffer, &p->c_src, 1, " Connecting To: "); | 2476 | snd_seq_info_dump_subscribers(buffer, &p->c_src, 1, " Connecting To: "); |
2477 | snd_seq_info_dump_subscribers(buffer, &p->c_dest, 0, " Connected From: "); | 2477 | snd_seq_info_dump_subscribers(buffer, &p->c_dest, 0, " Connected From: "); |
2478 | } | 2478 | } |
2479 | up(&client->ports_mutex); | 2479 | mutex_unlock(&client->ports_mutex); |
2480 | } | 2480 | } |
2481 | 2481 | ||
2482 | 2482 | ||
@@ -2550,16 +2550,16 @@ int __init snd_sequencer_device_init(void) | |||
2550 | { | 2550 | { |
2551 | int err; | 2551 | int err; |
2552 | 2552 | ||
2553 | if (down_interruptible(®ister_mutex)) | 2553 | if (mutex_lock_interruptible(®ister_mutex)) |
2554 | return -ERESTARTSYS; | 2554 | return -ERESTARTSYS; |
2555 | 2555 | ||
2556 | if ((err = snd_register_device(SNDRV_DEVICE_TYPE_SEQUENCER, NULL, 0, | 2556 | if ((err = snd_register_device(SNDRV_DEVICE_TYPE_SEQUENCER, NULL, 0, |
2557 | &snd_seq_f_ops, NULL, "seq")) < 0) { | 2557 | &snd_seq_f_ops, NULL, "seq")) < 0) { |
2558 | up(®ister_mutex); | 2558 | mutex_unlock(®ister_mutex); |
2559 | return err; | 2559 | return err; |
2560 | } | 2560 | } |
2561 | 2561 | ||
2562 | up(®ister_mutex); | 2562 | mutex_unlock(®ister_mutex); |
2563 | 2563 | ||
2564 | return 0; | 2564 | return 0; |
2565 | } | 2565 | } |