aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/init.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /sound/core/init.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'sound/core/init.c')
-rw-r--r--sound/core/init.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index ec4a50ce5656..2c041bb36ab3 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -342,7 +342,6 @@ static const struct file_operations snd_shutdown_f_ops =
342int snd_card_disconnect(struct snd_card *card) 342int snd_card_disconnect(struct snd_card *card)
343{ 343{
344 struct snd_monitor_file *mfile; 344 struct snd_monitor_file *mfile;
345 struct file *file;
346 int err; 345 int err;
347 346
348 if (!card) 347 if (!card)
@@ -366,8 +365,6 @@ int snd_card_disconnect(struct snd_card *card)
366 365
367 spin_lock(&card->files_lock); 366 spin_lock(&card->files_lock);
368 list_for_each_entry(mfile, &card->files_list, list) { 367 list_for_each_entry(mfile, &card->files_list, list) {
369 file = mfile->file;
370
371 /* it's critical part, use endless loop */ 368 /* it's critical part, use endless loop */
372 /* we have no room to fail */ 369 /* we have no room to fail */
373 mfile->disconnected_f_op = mfile->file->f_op; 370 mfile->disconnected_f_op = mfile->file->f_op;
@@ -395,12 +392,10 @@ int snd_card_disconnect(struct snd_card *card)
395 snd_printk(KERN_ERR "not all devices for card %i can be disconnected\n", card->number); 392 snd_printk(KERN_ERR "not all devices for card %i can be disconnected\n", card->number);
396 393
397 snd_info_card_disconnect(card); 394 snd_info_card_disconnect(card);
398#ifndef CONFIG_SYSFS_DEPRECATED
399 if (card->card_dev) { 395 if (card->card_dev) {
400 device_unregister(card->card_dev); 396 device_unregister(card->card_dev);
401 card->card_dev = NULL; 397 card->card_dev = NULL;
402 } 398 }
403#endif
404#ifdef CONFIG_PM 399#ifdef CONFIG_PM
405 wake_up(&card->power_sleep); 400 wake_up(&card->power_sleep);
406#endif 401#endif
@@ -516,7 +511,7 @@ static void snd_card_set_id_no_lock(struct snd_card *card, const char *nid)
516 id = card->id; 511 id = card->id;
517 512
518 if (*id == '\0') 513 if (*id == '\0')
519 strcpy(id, "default"); 514 strcpy(id, "Default");
520 515
521 while (1) { 516 while (1) {
522 if (loops-- == 0) { 517 if (loops-- == 0) {
@@ -573,7 +568,6 @@ void snd_card_set_id(struct snd_card *card, const char *nid)
573} 568}
574EXPORT_SYMBOL(snd_card_set_id); 569EXPORT_SYMBOL(snd_card_set_id);
575 570
576#ifndef CONFIG_SYSFS_DEPRECATED
577static ssize_t 571static ssize_t
578card_id_show_attr(struct device *dev, 572card_id_show_attr(struct device *dev,
579 struct device_attribute *attr, char *buf) 573 struct device_attribute *attr, char *buf)
@@ -607,11 +601,16 @@ card_id_store_attr(struct device *dev, struct device_attribute *attr,
607 return -EEXIST; 601 return -EEXIST;
608 } 602 }
609 for (idx = 0; idx < snd_ecards_limit; idx++) { 603 for (idx = 0; idx < snd_ecards_limit; idx++) {
610 if (snd_cards[idx] && !strcmp(snd_cards[idx]->id, buf1)) 604 if (snd_cards[idx] && !strcmp(snd_cards[idx]->id, buf1)) {
611 goto __exist; 605 if (card == snd_cards[idx])
606 goto __ok;
607 else
608 goto __exist;
609 }
612 } 610 }
613 strcpy(card->id, buf1); 611 strcpy(card->id, buf1);
614 snd_info_card_id_change(card); 612 snd_info_card_id_change(card);
613__ok:
615 mutex_unlock(&snd_card_mutex); 614 mutex_unlock(&snd_card_mutex);
616 615
617 return count; 616 return count;
@@ -630,7 +629,6 @@ card_number_show_attr(struct device *dev,
630 629
631static struct device_attribute card_number_attrs = 630static struct device_attribute card_number_attrs =
632 __ATTR(number, S_IRUGO, card_number_show_attr, NULL); 631 __ATTR(number, S_IRUGO, card_number_show_attr, NULL);
633#endif /* CONFIG_SYSFS_DEPRECATED */
634 632
635/** 633/**
636 * snd_card_register - register the soundcard 634 * snd_card_register - register the soundcard
@@ -641,7 +639,7 @@ static struct device_attribute card_number_attrs =
641 * external accesses. Thus, you should call this function at the end 639 * external accesses. Thus, you should call this function at the end
642 * of the initialization of the card. 640 * of the initialization of the card.
643 * 641 *
644 * Returns zero otherwise a negative error code if the registrain failed. 642 * Returns zero otherwise a negative error code if the registration failed.
645 */ 643 */
646int snd_card_register(struct snd_card *card) 644int snd_card_register(struct snd_card *card)
647{ 645{
@@ -649,7 +647,7 @@ int snd_card_register(struct snd_card *card)
649 647
650 if (snd_BUG_ON(!card)) 648 if (snd_BUG_ON(!card))
651 return -EINVAL; 649 return -EINVAL;
652#ifndef CONFIG_SYSFS_DEPRECATED 650
653 if (!card->card_dev) { 651 if (!card->card_dev) {
654 card->card_dev = device_create(sound_class, card->dev, 652 card->card_dev = device_create(sound_class, card->dev,
655 MKDEV(0, 0), card, 653 MKDEV(0, 0), card,
@@ -657,7 +655,7 @@ int snd_card_register(struct snd_card *card)
657 if (IS_ERR(card->card_dev)) 655 if (IS_ERR(card->card_dev))
658 card->card_dev = NULL; 656 card->card_dev = NULL;
659 } 657 }
660#endif 658
661 if ((err = snd_device_register_all(card)) < 0) 659 if ((err = snd_device_register_all(card)) < 0)
662 return err; 660 return err;
663 mutex_lock(&snd_card_mutex); 661 mutex_lock(&snd_card_mutex);
@@ -674,7 +672,6 @@ int snd_card_register(struct snd_card *card)
674 if (snd_mixer_oss_notify_callback) 672 if (snd_mixer_oss_notify_callback)
675 snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_REGISTER); 673 snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_REGISTER);
676#endif 674#endif
677#ifndef CONFIG_SYSFS_DEPRECATED
678 if (card->card_dev) { 675 if (card->card_dev) {
679 err = device_create_file(card->card_dev, &card_id_attrs); 676 err = device_create_file(card->card_dev, &card_id_attrs);
680 if (err < 0) 677 if (err < 0)
@@ -683,7 +680,7 @@ int snd_card_register(struct snd_card *card)
683 if (err < 0) 680 if (err < 0)
684 return err; 681 return err;
685 } 682 }
686#endif 683
687 return 0; 684 return 0;
688} 685}
689 686
@@ -848,6 +845,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file)
848 return -ENOMEM; 845 return -ENOMEM;
849 mfile->file = file; 846 mfile->file = file;
850 mfile->disconnected_f_op = NULL; 847 mfile->disconnected_f_op = NULL;
848 INIT_LIST_HEAD(&mfile->shutdown_list);
851 spin_lock(&card->files_lock); 849 spin_lock(&card->files_lock);
852 if (card->shutdown) { 850 if (card->shutdown) {
853 spin_unlock(&card->files_lock); 851 spin_unlock(&card->files_lock);
@@ -883,6 +881,9 @@ int snd_card_file_remove(struct snd_card *card, struct file *file)
883 list_for_each_entry(mfile, &card->files_list, list) { 881 list_for_each_entry(mfile, &card->files_list, list) {
884 if (mfile->file == file) { 882 if (mfile->file == file) {
885 list_del(&mfile->list); 883 list_del(&mfile->list);
884 spin_lock(&shutdown_lock);
885 list_del(&mfile->shutdown_list);
886 spin_unlock(&shutdown_lock);
886 if (mfile->disconnected_f_op) 887 if (mfile->disconnected_f_op)
887 fops_put(mfile->disconnected_f_op); 888 fops_put(mfile->disconnected_f_op);
888 found = mfile; 889 found = mfile;