diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2005-12-07 09:11:05 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 12:30:36 +0100 |
commit | 416c1079d30f1a52399b96f6772e993274b774ae (patch) | |
tree | cac70f2afaa88469db6e2ca231e4566046e0c363 /sound/core/sound.c | |
parent | [ALSA] ens1371: fix compilation without SUPPORT_JOYSTICK (diff) | |
download | linux-416c1079d30f1a52399b96f6772e993274b774ae.tar.xz linux-416c1079d30f1a52399b96f6772e993274b774ae.zip |
[ALSA] Nest sound devices
Modules: ALSA Core
Make the control device parent of all other ALSA devices of a card.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/core/sound.c')
-rw-r--r-- | sound/core/sound.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sound/core/sound.c b/sound/core/sound.c index a8eda02bcf1c..2f6108deb211 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c @@ -245,6 +245,7 @@ int snd_register_device(int type, struct snd_card *card, int dev, int minor; struct snd_minor *preg; struct device *device = NULL; + struct class_device *class_device = NULL; snd_assert(name, return -EINVAL); preg = kmalloc(sizeof(struct snd_minor) + strlen(name) + 1, GFP_KERNEL); @@ -272,9 +273,15 @@ int snd_register_device(int type, struct snd_card *card, int dev, snd_minors[minor] = preg; if (type != SNDRV_DEVICE_TYPE_CONTROL || preg->card >= cards_limit) devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name); - if (card) + if (card) { device = card->dev; - class_device_create(sound_class, NULL, MKDEV(major, minor), device, "%s", name); + class_device = card->parent_device; + } + class_device = class_device_create(sound_class, class_device, + MKDEV(major, minor), device, + "%s", name); + if (type == SNDRV_DEVICE_TYPE_CONTROL) + card->parent_device = class_device; up(&sound_mutex); return 0; |