diff options
-rw-r--r-- | include/sound/core.h | 8 | ||||
-rw-r--r-- | sound/core/init.c | 8 | ||||
-rw-r--r-- | sound/core/pcm.c | 7 | ||||
-rw-r--r-- | sound/core/sound.c | 22 | ||||
-rw-r--r-- | sound/oss/soundcard.c | 16 | ||||
-rw-r--r-- | sound/sound_core.c | 6 |
6 files changed, 37 insertions, 30 deletions
diff --git a/include/sound/core.h b/include/sound/core.h index fa1ca0127bab..a994bea09cd6 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -132,6 +132,7 @@ struct snd_card { | |||
132 | int shutdown; /* this card is going down */ | 132 | int shutdown; /* this card is going down */ |
133 | int free_on_last_close; /* free in context of file_release */ | 133 | int free_on_last_close; /* free in context of file_release */ |
134 | wait_queue_head_t shutdown_sleep; | 134 | wait_queue_head_t shutdown_sleep; |
135 | struct device *parent; | ||
135 | struct device *dev; | 136 | struct device *dev; |
136 | 137 | ||
137 | #ifdef CONFIG_PM | 138 | #ifdef CONFIG_PM |
@@ -187,13 +188,14 @@ struct snd_minor { | |||
187 | int device; /* device number */ | 188 | int device; /* device number */ |
188 | const struct file_operations *f_ops; /* file operations */ | 189 | const struct file_operations *f_ops; /* file operations */ |
189 | void *private_data; /* private data for f_ops->open */ | 190 | void *private_data; /* private data for f_ops->open */ |
190 | struct class_device *class_dev; /* class device for sysfs */ | 191 | struct device *dev; /* device for sysfs */ |
191 | }; | 192 | }; |
192 | 193 | ||
193 | /* sound.c */ | 194 | /* sound.c */ |
194 | 195 | ||
195 | extern int snd_major; | 196 | extern int snd_major; |
196 | extern int snd_ecards_limit; | 197 | extern int snd_ecards_limit; |
198 | extern struct class *sound_class; | ||
197 | 199 | ||
198 | void snd_request_card(int card); | 200 | void snd_request_card(int card); |
199 | 201 | ||
@@ -203,7 +205,7 @@ int snd_register_device(int type, struct snd_card *card, int dev, | |||
203 | int snd_unregister_device(int type, struct snd_card *card, int dev); | 205 | int snd_unregister_device(int type, struct snd_card *card, int dev); |
204 | void *snd_lookup_minor_data(unsigned int minor, int type); | 206 | void *snd_lookup_minor_data(unsigned int minor, int type); |
205 | int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, | 207 | int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, |
206 | const struct class_device_attribute *attr); | 208 | struct device_attribute *attr); |
207 | 209 | ||
208 | #ifdef CONFIG_SND_OSSEMUL | 210 | #ifdef CONFIG_SND_OSSEMUL |
209 | int snd_register_oss_device(int type, struct snd_card *card, int dev, | 211 | int snd_register_oss_device(int type, struct snd_card *card, int dev, |
@@ -255,7 +257,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file); | |||
255 | int snd_card_file_remove(struct snd_card *card, struct file *file); | 257 | int snd_card_file_remove(struct snd_card *card, struct file *file); |
256 | 258 | ||
257 | #ifndef snd_card_set_dev | 259 | #ifndef snd_card_set_dev |
258 | #define snd_card_set_dev(card,devptr) ((card)->dev = (devptr)) | 260 | #define snd_card_set_dev(card,devptr) ((card)->parent = (devptr)) |
259 | #endif | 261 | #endif |
260 | 262 | ||
261 | /* device.c */ | 263 | /* device.c */ |
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); |
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index fbbbcd20c4cc..5ac6e19ccb41 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -910,7 +910,8 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream) | |||
910 | substream->pstr->substream_opened--; | 910 | substream->pstr->substream_opened--; |
911 | } | 911 | } |
912 | 912 | ||
913 | static ssize_t show_pcm_class(struct class_device *class_device, char *buf) | 913 | static ssize_t show_pcm_class(struct device *dev, |
914 | struct device_attribute *attr, char *buf) | ||
914 | { | 915 | { |
915 | struct snd_pcm *pcm; | 916 | struct snd_pcm *pcm; |
916 | const char *str; | 917 | const char *str; |
@@ -921,7 +922,7 @@ static ssize_t show_pcm_class(struct class_device *class_device, char *buf) | |||
921 | [SNDRV_PCM_CLASS_DIGITIZER] = "digitizer", | 922 | [SNDRV_PCM_CLASS_DIGITIZER] = "digitizer", |
922 | }; | 923 | }; |
923 | 924 | ||
924 | if (! (pcm = class_get_devdata(class_device)) || | 925 | if (! (pcm = dev_get_drvdata(dev)) || |
925 | pcm->dev_class > SNDRV_PCM_CLASS_LAST) | 926 | pcm->dev_class > SNDRV_PCM_CLASS_LAST) |
926 | str = "none"; | 927 | str = "none"; |
927 | else | 928 | else |
@@ -929,7 +930,7 @@ static ssize_t show_pcm_class(struct class_device *class_device, char *buf) | |||
929 | return snprintf(buf, PAGE_SIZE, "%s\n", str); | 930 | return snprintf(buf, PAGE_SIZE, "%s\n", str); |
930 | } | 931 | } |
931 | 932 | ||
932 | static struct class_device_attribute pcm_attrs = | 933 | static struct device_attribute pcm_attrs = |
933 | __ATTR(pcm_class, S_IRUGO, show_pcm_class, NULL); | 934 | __ATTR(pcm_class, S_IRUGO, show_pcm_class, NULL); |
934 | 935 | ||
935 | static int snd_pcm_dev_register(struct snd_device *device) | 936 | static int snd_pcm_dev_register(struct snd_device *device) |
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 | ||
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index 2344d09c7114..75c5e745705f 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -557,17 +557,17 @@ static int __init oss_init(void) | |||
557 | sound_dmap_flag = (dmabuf > 0 ? 1 : 0); | 557 | sound_dmap_flag = (dmabuf > 0 ? 1 : 0); |
558 | 558 | ||
559 | for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { | 559 | for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { |
560 | class_device_create(sound_class, NULL, | 560 | device_create(sound_class, NULL, |
561 | MKDEV(SOUND_MAJOR, dev_list[i].minor), | 561 | MKDEV(SOUND_MAJOR, dev_list[i].minor), |
562 | NULL, "%s", dev_list[i].name); | 562 | "%s", dev_list[i].name); |
563 | 563 | ||
564 | if (!dev_list[i].num) | 564 | if (!dev_list[i].num) |
565 | continue; | 565 | continue; |
566 | 566 | ||
567 | for (j = 1; j < *dev_list[i].num; j++) | 567 | for (j = 1; j < *dev_list[i].num; j++) |
568 | class_device_create(sound_class, NULL, | 568 | device_create(sound_class, NULL, |
569 | MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)), | 569 | MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)), |
570 | NULL, "%s%d", dev_list[i].name, j); | 570 | "%s%d", dev_list[i].name, j); |
571 | } | 571 | } |
572 | 572 | ||
573 | if (sound_nblocks >= 1024) | 573 | if (sound_nblocks >= 1024) |
@@ -581,11 +581,11 @@ static void __exit oss_cleanup(void) | |||
581 | int i, j; | 581 | int i, j; |
582 | 582 | ||
583 | for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { | 583 | for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { |
584 | class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor)); | 584 | device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor)); |
585 | if (!dev_list[i].num) | 585 | if (!dev_list[i].num) |
586 | continue; | 586 | continue; |
587 | for (j = 1; j < *dev_list[i].num; j++) | 587 | for (j = 1; j < *dev_list[i].num; j++) |
588 | class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10))); | 588 | device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10))); |
589 | } | 589 | } |
590 | 590 | ||
591 | unregister_sound_special(1); | 591 | unregister_sound_special(1); |
diff --git a/sound/sound_core.c b/sound/sound_core.c index 5322c50c9617..8f1ced4ab34c 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c | |||
@@ -170,8 +170,8 @@ static int sound_insert_unit(struct sound_unit **list, const struct file_operati | |||
170 | else | 170 | else |
171 | sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP); | 171 | sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP); |
172 | 172 | ||
173 | class_device_create(sound_class, NULL, MKDEV(SOUND_MAJOR, s->unit_minor), | 173 | device_create(sound_class, dev, MKDEV(SOUND_MAJOR, s->unit_minor), |
174 | dev, s->name+6); | 174 | s->name+6); |
175 | return r; | 175 | return r; |
176 | 176 | ||
177 | fail: | 177 | fail: |
@@ -193,7 +193,7 @@ static void sound_remove_unit(struct sound_unit **list, int unit) | |||
193 | p = __sound_remove_unit(list, unit); | 193 | p = __sound_remove_unit(list, unit); |
194 | spin_unlock(&sound_loader_lock); | 194 | spin_unlock(&sound_loader_lock); |
195 | if (p) { | 195 | if (p) { |
196 | class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, p->unit_minor)); | 196 | device_destroy(sound_class, MKDEV(SOUND_MAJOR, p->unit_minor)); |
197 | kfree(p); | 197 | kfree(p); |
198 | } | 198 | } |
199 | } | 199 | } |