diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-08-08 01:19:37 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-12-01 17:52:01 -0500 |
commit | d80f19fab89cba8a6d16193154c8ff3edab00942 (patch) | |
tree | 5d6b567a45ca4cc014bf5a1d10622c91ece2f63e /sound/core/init.c | |
parent | ebf644c4623bc3eb57683199cd2b9080028b0f6f (diff) |
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.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/core/init.c b/sound/core/init.c index 3058d626a90a..6152a7554dfd 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) | |||
361 | snd_printk(KERN_WARNING "unable to free card info\n"); | 361 | snd_printk(KERN_WARNING "unable to free card info\n"); |
362 | /* Not fatal error */ | 362 | /* Not fatal error */ |
363 | } | 363 | } |
364 | if (card->dev) | ||
365 | device_unregister(card->dev); | ||
364 | kfree(card); | 366 | kfree(card); |
365 | return 0; | 367 | return 0; |
366 | } | 368 | } |
@@ -495,6 +497,12 @@ int snd_card_register(struct snd_card *card) | |||
495 | int err; | 497 | int err; |
496 | 498 | ||
497 | snd_assert(card != NULL, return -EINVAL); | 499 | snd_assert(card != NULL, return -EINVAL); |
500 | if (!card->dev) { | ||
501 | card->dev = device_create(sound_class, card->parent, 0, | ||
502 | "card%i", card->number); | ||
503 | if (IS_ERR(card->dev)) | ||
504 | card->dev = NULL; | ||
505 | } | ||
498 | if ((err = snd_device_register_all(card)) < 0) | 506 | if ((err = snd_device_register_all(card)) < 0) |
499 | return err; | 507 | return err; |
500 | mutex_lock(&snd_card_mutex); | 508 | mutex_lock(&snd_card_mutex); |