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/sound.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/sound.c')
-rw-r--r-- | sound/core/sound.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/sound/core/sound.c b/sound/core/sound.c index efa476c5210a..282742022de6 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -61,9 +61,6 @@ EXPORT_SYMBOL(snd_ecards_limit); | |||
61 | static struct snd_minor *snd_minors[SNDRV_OS_MINORS]; | 61 | static struct snd_minor *snd_minors[SNDRV_OS_MINORS]; |
62 | static DEFINE_MUTEX(sound_mutex); | 62 | static DEFINE_MUTEX(sound_mutex); |
63 | 63 | ||
64 | extern struct class *sound_class; | ||
65 | |||
66 | |||
67 | #ifdef CONFIG_KMOD | 64 | #ifdef CONFIG_KMOD |
68 | 65 | ||
69 | /** | 66 | /** |
@@ -268,11 +265,10 @@ int snd_register_device(int type, struct snd_card *card, int dev, | |||
268 | snd_minors[minor] = preg; | 265 | snd_minors[minor] = preg; |
269 | if (card) | 266 | if (card) |
270 | device = card->dev; | 267 | device = card->dev; |
271 | preg->class_dev = class_device_create(sound_class, NULL, | 268 | preg->dev = device_create(sound_class, device, MKDEV(major, minor), |
272 | MKDEV(major, minor), | 269 | "%s", name); |
273 | device, "%s", name); | 270 | if (preg->dev) |
274 | if (preg->class_dev) | 271 | dev_set_drvdata(preg->dev, private_data); |
275 | class_set_devdata(preg->class_dev, private_data); | ||
276 | 272 | ||
277 | mutex_unlock(&sound_mutex); | 273 | mutex_unlock(&sound_mutex); |
278 | return 0; | 274 | return 0; |
@@ -320,7 +316,7 @@ int snd_unregister_device(int type, struct snd_card *card, int dev) | |||
320 | return -EINVAL; | 316 | return -EINVAL; |
321 | } | 317 | } |
322 | 318 | ||
323 | class_device_destroy(sound_class, MKDEV(major, minor)); | 319 | device_destroy(sound_class, MKDEV(major, minor)); |
324 | 320 | ||
325 | kfree(snd_minors[minor]); | 321 | kfree(snd_minors[minor]); |
326 | snd_minors[minor] = NULL; | 322 | snd_minors[minor] = NULL; |
@@ -331,15 +327,15 @@ int snd_unregister_device(int type, struct snd_card *card, int dev) | |||
331 | EXPORT_SYMBOL(snd_unregister_device); | 327 | EXPORT_SYMBOL(snd_unregister_device); |
332 | 328 | ||
333 | int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, | 329 | int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, |
334 | const struct class_device_attribute *attr) | 330 | struct device_attribute *attr) |
335 | { | 331 | { |
336 | int minor, ret = -EINVAL; | 332 | int minor, ret = -EINVAL; |
337 | struct class_device *cdev; | 333 | struct device *d; |
338 | 334 | ||
339 | mutex_lock(&sound_mutex); | 335 | mutex_lock(&sound_mutex); |
340 | minor = find_snd_minor(type, card, dev); | 336 | minor = find_snd_minor(type, card, dev); |
341 | if (minor >= 0 && (cdev = snd_minors[minor]->class_dev) != NULL) | 337 | if (minor >= 0 && (d = snd_minors[minor]->dev) != NULL) |
342 | ret = class_device_create_file(cdev, attr); | 338 | ret = device_create_file(d, attr); |
343 | mutex_unlock(&sound_mutex); | 339 | mutex_unlock(&sound_mutex); |
344 | return ret; | 340 | return ret; |
345 | 341 | ||