Skip to content

Commit 5205388

Browse files
committed
ALSA: seq: Handle the device directly
Like the previous change for the timer device, this patch changes the device management for the ALSA sequencer device using the struct device directly. Reviewed-by: Jaroslav Kysela <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 89da061 commit 5205388

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

sound/core/seq/seq_clientmgr.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2571,19 +2571,27 @@ static const struct file_operations snd_seq_f_ops =
25712571
.compat_ioctl = snd_seq_ioctl_compat,
25722572
};
25732573

2574+
static struct device seq_dev;
2575+
25742576
/*
25752577
* register sequencer device
25762578
*/
25772579
int __init snd_sequencer_device_init(void)
25782580
{
25792581
int err;
25802582

2583+
snd_device_initialize(&seq_dev, NULL);
2584+
dev_set_name(&seq_dev, "seq");
2585+
25812586
if (mutex_lock_interruptible(&register_mutex))
25822587
return -ERESTARTSYS;
25832588

2584-
if ((err = snd_register_device(SNDRV_DEVICE_TYPE_SEQUENCER, NULL, 0,
2585-
&snd_seq_f_ops, NULL, "seq")) < 0) {
2589+
err = snd_register_device_for_dev(SNDRV_DEVICE_TYPE_SEQUENCER, NULL, 0,
2590+
&snd_seq_f_ops, NULL,
2591+
&seq_dev, NULL, NULL);
2592+
if (err < 0) {
25862593
mutex_unlock(&register_mutex);
2594+
put_device(&seq_dev);
25872595
return err;
25882596
}
25892597

@@ -2600,4 +2608,5 @@ int __init snd_sequencer_device_init(void)
26002608
void __exit snd_sequencer_device_done(void)
26012609
{
26022610
snd_unregister_device(SNDRV_DEVICE_TYPE_SEQUENCER, NULL, 0);
2611+
put_device(&seq_dev);
26032612
}

0 commit comments

Comments
 (0)