mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 09:31:14 +00:00
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>
This commit is contained in:
parent
ebf644c462
commit
d80f19fab8
6 changed files with 37 additions and 30 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue