ALSA: seq: Define driver object in each driver
[firefly-linux-kernel-4.4.55.git] / sound / isa / sb / emu8000_synth.c
index 72332dfada9a3f2d089cecd7d257ae0121223a8d..4aa719cad331915bb4e9d34d3ee28fe1253b8514 100644 (file)
@@ -34,8 +34,9 @@ MODULE_LICENSE("GPL");
 /*
  * create a new hardware dependent device for Emu8000
  */
-static int snd_emu8000_new_device(struct snd_seq_device *dev)
+static int snd_emu8000_probe(struct device *_dev)
 {
+       struct snd_seq_device *dev = to_seq_dev(_dev);
        struct snd_emu8000 *hw;
        struct snd_emux *emu;
 
@@ -93,8 +94,9 @@ static int snd_emu8000_new_device(struct snd_seq_device *dev)
 /*
  * free all resources
  */
-static int snd_emu8000_delete_device(struct snd_seq_device *dev)
+static int snd_emu8000_remove(struct device *_dev)
 {
+       struct snd_seq_device *dev = to_seq_dev(_dev);
        struct snd_emu8000 *hw;
 
        if (dev->driver_data == NULL)
@@ -114,21 +116,14 @@ static int snd_emu8000_delete_device(struct snd_seq_device *dev)
  *  INIT part
  */
 
-static int __init alsa_emu8000_init(void)
-{
-       
-       static struct snd_seq_dev_ops ops = {
-               snd_emu8000_new_device,
-               snd_emu8000_delete_device,
-       };
-       return snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_EMU8000, &ops,
-                                             sizeof(struct snd_emu8000*));
-}
-
-static void __exit alsa_emu8000_exit(void)
-{
-       snd_seq_device_unregister_driver(SNDRV_SEQ_DEV_ID_EMU8000);
-}
-
-module_init(alsa_emu8000_init)
-module_exit(alsa_emu8000_exit)
+static struct snd_seq_driver emu8000_driver = {
+       .driver = {
+               .name = KBUILD_MODNAME,
+               .probe = snd_emu8000_probe,
+               .remove = snd_emu8000_remove,
+       },
+       .id = SNDRV_SEQ_DEV_ID_EMU8000,
+       .argsize = sizeof(struct snd_emu8000 *),
+};
+
+module_snd_seq_driver(emu8000_driver);