Skip to content

Commit 04702e8

Browse files
committed
ALSA: seq: Use no intrruptible mutex_lock
All usages of mutex in ALSA sequencer core would take too long, hence we don't have to care about the user interruption that makes things complicated. Let's replace them with simpler mutex_lock(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 00976ad commit 04702e8

1 file changed

Lines changed: 7 additions & 19 deletions

File tree

‎sound/core/seq/seq_clientmgr.c‎

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,9 @@ static int snd_seq_open(struct inode *inode, struct file *file)
311311
if (err < 0)
312312
return err;
313313

314-
if (mutex_lock_interruptible(&register_mutex))
315-
return -ERESTARTSYS;
314+
mutex_lock(&register_mutex);
316315
client = seq_create_client1(-1, SNDRV_SEQ_DEFAULT_EVENTS);
317-
if (client == NULL) {
316+
if (!client) {
318317
mutex_unlock(&register_mutex);
319318
return -ENOMEM; /* failure code */
320319
}
@@ -1704,10 +1703,7 @@ static int snd_seq_ioctl_get_queue_timer(struct snd_seq_client *client,
17041703
if (queue == NULL)
17051704
return -EINVAL;
17061705

1707-
if (mutex_lock_interruptible(&queue->timer_mutex)) {
1708-
queuefree(queue);
1709-
return -ERESTARTSYS;
1710-
}
1706+
mutex_lock(&queue->timer_mutex);
17111707
tmr = queue->timer;
17121708
memset(timer, 0, sizeof(*timer));
17131709
timer->queue = queue->queue;
@@ -1741,10 +1737,7 @@ static int snd_seq_ioctl_set_queue_timer(struct snd_seq_client *client,
17411737
q = queueptr(timer->queue);
17421738
if (q == NULL)
17431739
return -ENXIO;
1744-
if (mutex_lock_interruptible(&q->timer_mutex)) {
1745-
queuefree(q);
1746-
return -ERESTARTSYS;
1747-
}
1740+
mutex_lock(&q->timer_mutex);
17481741
tmr = q->timer;
17491742
snd_seq_queue_timer_close(timer->queue);
17501743
tmr->type = timer->type;
@@ -2180,8 +2173,7 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
21802173
if (card == NULL && client_index >= SNDRV_SEQ_GLOBAL_CLIENTS)
21812174
return -EINVAL;
21822175

2183-
if (mutex_lock_interruptible(&register_mutex))
2184-
return -ERESTARTSYS;
2176+
mutex_lock(&register_mutex);
21852177

21862178
if (card) {
21872179
client_index += SNDRV_SEQ_GLOBAL_CLIENTS
@@ -2522,19 +2514,15 @@ int __init snd_sequencer_device_init(void)
25222514
snd_device_initialize(&seq_dev, NULL);
25232515
dev_set_name(&seq_dev, "seq");
25242516

2525-
if (mutex_lock_interruptible(&register_mutex))
2526-
return -ERESTARTSYS;
2527-
2517+
mutex_lock(&register_mutex);
25282518
err = snd_register_device(SNDRV_DEVICE_TYPE_SEQUENCER, NULL, 0,
25292519
&snd_seq_f_ops, NULL, &seq_dev);
2520+
mutex_unlock(&register_mutex);
25302521
if (err < 0) {
2531-
mutex_unlock(&register_mutex);
25322522
put_device(&seq_dev);
25332523
return err;
25342524
}
25352525

2536-
mutex_unlock(&register_mutex);
2537-
25382526
return 0;
25392527
}
25402528

0 commit comments

Comments
 (0)