From 2af677fc884fc6dc79e65c99050ea607ac8bab9b Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 20 Nov 2005 14:03:48 +0100 Subject: [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 --- sound/core/control.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'sound/core/control.c') diff --git a/sound/core/control.c b/sound/core/control.c index f8f98cc52417..23561e74712b 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -1264,12 +1264,6 @@ static struct file_operations snd_ctl_f_ops = .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 @@ static int snd_ctl_dev_register(struct snd_device *device) 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 @@ static int snd_ctl_dev_unregister(struct snd_device *device) 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); } -- cgit v1.2.3