summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/device.c2
-rw-r--r--sound/core/sound.c11
2 files changed, 10 insertions, 3 deletions
diff --git a/sound/core/device.c b/sound/core/device.c
index b1cf6ec..478264c 100644
--- a/sound/core/device.c
+++ b/sound/core/device.c
@@ -193,7 +193,7 @@ int snd_device_register_all(struct snd_card *card)
int err;
snd_assert(card != NULL, return -ENXIO);
- list_for_each(list, &card->devices) {
+ list_for_each_prev(list, &card->devices) {
dev = snd_device(list);
if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) {
if ((err = dev->ops->dev_register(dev)) < 0)
diff --git a/sound/core/sound.c b/sound/core/sound.c
index a8eda02..2f6108d 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;
OpenPOWER on IntegriCloud