Commit 5205388d authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarJaroslav Kysela <perex@perex.cz>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 89da061f
...@@ -2571,6 +2571,8 @@ static const struct file_operations snd_seq_f_ops = ...@@ -2571,6 +2571,8 @@ static const struct file_operations snd_seq_f_ops =
.compat_ioctl = snd_seq_ioctl_compat, .compat_ioctl = snd_seq_ioctl_compat,
}; };
static struct device seq_dev;
/* /*
* register sequencer device * register sequencer device
*/ */
...@@ -2578,12 +2580,18 @@ int __init snd_sequencer_device_init(void) ...@@ -2578,12 +2580,18 @@ int __init snd_sequencer_device_init(void)
{ {
int err; int err;
snd_device_initialize(&seq_dev, NULL);
dev_set_name(&seq_dev, "seq");
if (mutex_lock_interruptible(&register_mutex)) if (mutex_lock_interruptible(&register_mutex))
return -ERESTARTSYS; return -ERESTARTSYS;
if ((err = snd_register_device(SNDRV_DEVICE_TYPE_SEQUENCER, NULL, 0, err = snd_register_device_for_dev(SNDRV_DEVICE_TYPE_SEQUENCER, NULL, 0,
&snd_seq_f_ops, NULL, "seq")) < 0) { &snd_seq_f_ops, NULL,
&seq_dev, NULL, NULL);
if (err < 0) {
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
put_device(&seq_dev);
return err; return err;
} }
...@@ -2600,4 +2608,5 @@ int __init snd_sequencer_device_init(void) ...@@ -2600,4 +2608,5 @@ int __init snd_sequencer_device_init(void)
void __exit snd_sequencer_device_done(void) void __exit snd_sequencer_device_done(void)
{ {
snd_unregister_device(SNDRV_DEVICE_TYPE_SEQUENCER, NULL, 0); snd_unregister_device(SNDRV_DEVICE_TYPE_SEQUENCER, NULL, 0);
put_device(&seq_dev);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment