aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/core.h1
-rw-r--r--sound/core/device.c2
-rw-r--r--sound/core/sound.c11
3 files changed, 11 insertions, 3 deletions
diff --git a/include/sound/core.h b/include/sound/core.h
index 90ac6132ea3b..dbe7a2c30272 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -134,6 +134,7 @@ struct snd_card {
134 wait_queue_head_t shutdown_sleep; 134 wait_queue_head_t shutdown_sleep;
135 struct work_struct free_workq; /* for free in workqueue */ 135 struct work_struct free_workq; /* for free in workqueue */
136 struct device *dev; 136 struct device *dev;
137 struct class_device *parent_device;
137 138
138#ifdef CONFIG_PM 139#ifdef CONFIG_PM
139 unsigned int power_state; /* power state */ 140 unsigned int power_state; /* power state */
diff --git a/sound/core/device.c b/sound/core/device.c
index b1cf6ec56784..478264cab67e 100644
--- a/sound/core/device.c
+++ b/sound/core/device.c
@@ -193,7 +193,7 @@ int snd_device_register_all(struct snd_card *card)
193 int err; 193 int err;
194 194
195 snd_assert(card != NULL, return -ENXIO); 195 snd_assert(card != NULL, return -ENXIO);
196 list_for_each(list, &card->devices) { 196 list_for_each_prev(list, &card->devices) {
197 dev = snd_device(list); 197 dev = snd_device(list);
198 if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) { 198 if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) {
199 if ((err = dev->ops->dev_register(dev)) < 0) 199 if ((err = dev->ops->dev_register(dev)) < 0)
diff --git a/sound/core/sound.c b/sound/core/sound.c
index a8eda02bcf1c..2f6108deb211 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,
245 int minor; 245 int minor;
246 struct snd_minor *preg; 246 struct snd_minor *preg;
247 struct device *device = NULL; 247 struct device *device = NULL;
248 struct class_device *class_device = NULL;
248 249
249 snd_assert(name, return -EINVAL); 250 snd_assert(name, return -EINVAL);
250 preg = kmalloc(sizeof(struct snd_minor) + strlen(name) + 1, GFP_KERNEL); 251 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,
272 snd_minors[minor] = preg; 273 snd_minors[minor] = preg;
273 if (type != SNDRV_DEVICE_TYPE_CONTROL || preg->card >= cards_limit) 274 if (type != SNDRV_DEVICE_TYPE_CONTROL || preg->card >= cards_limit)
274 devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name); 275 devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name);
275 if (card) 276 if (card) {
276 device = card->dev; 277 device = card->dev;
277 class_device_create(sound_class, NULL, MKDEV(major, minor), device, "%s", name); 278 class_device = card->parent_device;
279 }
280 class_device = class_device_create(sound_class, class_device,
281 MKDEV(major, minor), device,
282 "%s", name);
283 if (type == SNDRV_DEVICE_TYPE_CONTROL)
284 card->parent_device = class_device;
278 285
279 up(&sound_mutex); 286 up(&sound_mutex);
280 return 0; 287 return 0;