[ALSA] dynamic minors (1/6): store device type in struct snd_minor
Instead of a comment string, store the device type in the snd_minor
structure. This makes snd_minor more flexible, and has the nice side
effect that we don't need anymore to create a separate snd_minor
template for registering a device but can pass the file_operations
directly to snd_register_device().
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
diff --git a/sound/core/control.c b/sound/core/control.c
index f8f98cc..23561e7 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1264,12 +1264,6 @@
.fasync = snd_ctl_fasync,
};
-static struct snd_minor snd_ctl_reg =
-{
- .comment = "ctl",
- .f_ops = &snd_ctl_f_ops,
-};
-
/*
* registration of the control device
*/
@@ -1284,7 +1278,7 @@
snd_assert(cardnum >= 0 && cardnum < SNDRV_CARDS, return -ENXIO);
sprintf(name, "controlC%i", cardnum);
if ((err = snd_register_device(SNDRV_DEVICE_TYPE_CONTROL,
- card, 0, &snd_ctl_reg, name)) < 0)
+ card, -1, &snd_ctl_f_ops, name)) < 0)
return err;
return 0;
}
@@ -1336,7 +1330,8 @@
snd_assert(card != NULL, return -ENXIO);
cardnum = card->number;
snd_assert(cardnum >= 0 && cardnum < SNDRV_CARDS, return -ENXIO);
- if ((err = snd_unregister_device(SNDRV_DEVICE_TYPE_CONTROL, card, 0)) < 0)
+ if ((err = snd_unregister_device(SNDRV_DEVICE_TYPE_CONTROL,
+ card, -1)) < 0)
return err;
return snd_ctl_dev_free(device);
}