summaryrefslogtreecommitdiffstats
path: root/sound/core/init.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-08-07 22:19:37 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2006-12-01 14:52:01 -0800
commitd80f19fab89cba8a6d16193154c8ff3edab00942 (patch)
tree5d6b567a45ca4cc014bf5a1d10622c91ece2f63e /sound/core/init.c
parentebf644c4623bc3eb57683199cd2b9080028b0f6f (diff)
downloadop-kernel-dev-d80f19fab89cba8a6d16193154c8ff3edab00942.zip
op-kernel-dev-d80f19fab89cba8a6d16193154c8ff3edab00942.tar.gz
Driver core: convert sound core to use struct device
Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. It also makes the struct sound_card to show up as a "real" device where all the different sound class devices are placed as childs and different card attribute files can hang off of. /sys/class/sound is still a flat directory, but the symlink targets of all devices belonging to the same card, point the the /sys/devices tree below the new card device object. Thanks to Kay for the updates to this patch. Signed-off-by: Kay Sievers <kay.sievers@novell.com> Acked-by: Jaroslav Kysela <perex@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'sound/core/init.c')
-rw-r--r--sound/core/init.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index 3058d62..6152a75 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -361,6 +361,8 @@ static int snd_card_do_free(struct snd_card *card)
snd_printk(KERN_WARNING "unable to free card info\n");
/* Not fatal error */
}
+ if (card->dev)
+ device_unregister(card->dev);
kfree(card);
return 0;
}
@@ -495,6 +497,12 @@ int snd_card_register(struct snd_card *card)
int err;
snd_assert(card != NULL, return -EINVAL);
+ if (!card->dev) {
+ card->dev = device_create(sound_class, card->parent, 0,
+ "card%i", card->number);
+ if (IS_ERR(card->dev))
+ card->dev = NULL;
+ }
if ((err = snd_device_register_all(card)) < 0)
return err;
mutex_lock(&snd_card_mutex);
OpenPOWER on IntegriCloud