diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-02-22 06:50:54 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-05-11 10:55:40 -0400 |
commit | 5e24c1c1c496c4603395d6e9cc320f85008fc891 (patch) | |
tree | 3bc2d3797f632d99c7f31a49346d4e77b56520aa /sound/isa | |
parent | 442f4f36bed8bcadcbda299c615c12fae95eda99 (diff) |
[ALSA] Port the rest of ALSA ISA drivers to isa_driver
Port the rest of ALSA ISA drivers to use isa_driver framework
instead of platform_driver.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/isa')
-rw-r--r-- | sound/isa/cmi8330.c | 111 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4236.c | 125 | ||||
-rw-r--r-- | sound/isa/es18xx.c | 106 | ||||
-rw-r--r-- | sound/isa/gus/gusmax.c | 67 | ||||
-rw-r--r-- | sound/isa/gus/interwave.c | 101 | ||||
-rw-r--r-- | sound/isa/opl3sa2.c | 123 | ||||
-rw-r--r-- | sound/isa/opti9xx/miro.c | 74 | ||||
-rw-r--r-- | sound/isa/opti9xx/opti92x-ad1848.c | 94 | ||||
-rw-r--r-- | sound/isa/sb/sb16.c | 107 | ||||
-rw-r--r-- | sound/isa/sb/sb8.c | 86 | ||||
-rw-r--r-- | sound/isa/sgalaxy.c | 103 | ||||
-rw-r--r-- | sound/isa/sscape.c | 116 | ||||
-rw-r--r-- | sound/isa/wavefront/wavefront.c | 107 |
13 files changed, 483 insertions, 837 deletions
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index c09a8009d2fa..456156de0791 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <sound/driver.h> | 46 | #include <sound/driver.h> |
47 | #include <linux/init.h> | 47 | #include <linux/init.h> |
48 | #include <linux/err.h> | 48 | #include <linux/err.h> |
49 | #include <linux/platform_device.h> | 49 | #include <linux/isa.h> |
50 | #include <linux/slab.h> | 50 | #include <linux/slab.h> |
51 | #include <linux/pnp.h> | 51 | #include <linux/pnp.h> |
52 | #include <linux/moduleparam.h> | 52 | #include <linux/moduleparam.h> |
@@ -108,7 +108,6 @@ MODULE_PARM_DESC(wssirq, "IRQ # for CMI8330 WSS driver."); | |||
108 | module_param_array(wssdma, int, NULL, 0444); | 108 | module_param_array(wssdma, int, NULL, 0444); |
109 | MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver."); | 109 | MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver."); |
110 | 110 | ||
111 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
112 | #ifdef CONFIG_PNP | 111 | #ifdef CONFIG_PNP |
113 | static int pnp_registered; | 112 | static int pnp_registered; |
114 | #endif | 113 | #endif |
@@ -547,60 +546,70 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) | |||
547 | return snd_card_register(card); | 546 | return snd_card_register(card); |
548 | } | 547 | } |
549 | 548 | ||
550 | static int __devinit snd_cmi8330_nonpnp_probe(struct platform_device *pdev) | 549 | static int __devinit snd_cmi8330_isa_match(struct device *pdev, |
550 | unsigned int dev) | ||
551 | { | 551 | { |
552 | struct snd_card *card; | 552 | if (!enable[dev] || is_isapnp_selected(dev)) |
553 | int err; | 553 | return 0; |
554 | int dev = pdev->id; | ||
555 | |||
556 | if (wssport[dev] == SNDRV_AUTO_PORT) { | 554 | if (wssport[dev] == SNDRV_AUTO_PORT) { |
557 | snd_printk(KERN_ERR PFX "specify wssport\n"); | 555 | snd_printk(KERN_ERR PFX "specify wssport\n"); |
558 | return -EINVAL; | 556 | return 0; |
559 | } | 557 | } |
560 | if (sbport[dev] == SNDRV_AUTO_PORT) { | 558 | if (sbport[dev] == SNDRV_AUTO_PORT) { |
561 | snd_printk(KERN_ERR PFX "specify sbport\n"); | 559 | snd_printk(KERN_ERR PFX "specify sbport\n"); |
562 | return -EINVAL; | 560 | return 0; |
563 | } | 561 | } |
562 | return 1; | ||
563 | } | ||
564 | |||
565 | static int __devinit snd_cmi8330_isa_probe(struct device *pdev, | ||
566 | unsigned int dev) | ||
567 | { | ||
568 | struct snd_card *card; | ||
569 | int err; | ||
564 | 570 | ||
565 | card = snd_cmi8330_card_new(dev); | 571 | card = snd_cmi8330_card_new(dev); |
566 | if (! card) | 572 | if (! card) |
567 | return -ENOMEM; | 573 | return -ENOMEM; |
568 | snd_card_set_dev(card, &pdev->dev); | 574 | snd_card_set_dev(card, pdev); |
569 | if ((err = snd_cmi8330_probe(card, dev)) < 0) { | 575 | if ((err = snd_cmi8330_probe(card, dev)) < 0) { |
570 | snd_card_free(card); | 576 | snd_card_free(card); |
571 | return err; | 577 | return err; |
572 | } | 578 | } |
573 | platform_set_drvdata(pdev, card); | 579 | dev_set_drvdata(pdev, card); |
574 | return 0; | 580 | return 0; |
575 | } | 581 | } |
576 | 582 | ||
577 | static int __devexit snd_cmi8330_nonpnp_remove(struct platform_device *devptr) | 583 | static int __devexit snd_cmi8330_isa_remove(struct device *devptr, |
584 | unsigned int dev) | ||
578 | { | 585 | { |
579 | snd_card_free(platform_get_drvdata(devptr)); | 586 | snd_card_free(dev_get_drvdata(devptr)); |
580 | platform_set_drvdata(devptr, NULL); | 587 | dev_set_drvdata(devptr, NULL); |
581 | return 0; | 588 | return 0; |
582 | } | 589 | } |
583 | 590 | ||
584 | #ifdef CONFIG_PM | 591 | #ifdef CONFIG_PM |
585 | static int snd_cmi8330_nonpnp_suspend(struct platform_device *dev, pm_message_t state) | 592 | static int snd_cmi8330_isa_suspend(struct device *dev, unsigned int n, |
593 | pm_message_t state) | ||
586 | { | 594 | { |
587 | return snd_cmi8330_suspend(platform_get_drvdata(dev)); | 595 | return snd_cmi8330_suspend(dev_get_drvdata(dev)); |
588 | } | 596 | } |
589 | 597 | ||
590 | static int snd_cmi8330_nonpnp_resume(struct platform_device *dev) | 598 | static int snd_cmi8330_isa_resume(struct device *dev, unsigned int n) |
591 | { | 599 | { |
592 | return snd_cmi8330_resume(platform_get_drvdata(dev)); | 600 | return snd_cmi8330_resume(dev_get_drvdata(dev)); |
593 | } | 601 | } |
594 | #endif | 602 | #endif |
595 | 603 | ||
596 | #define CMI8330_DRIVER "snd_cmi8330" | 604 | #define CMI8330_DRIVER "snd_cmi8330" |
597 | 605 | ||
598 | static struct platform_driver snd_cmi8330_driver = { | 606 | static struct isa_driver snd_cmi8330_driver = { |
599 | .probe = snd_cmi8330_nonpnp_probe, | 607 | .match = snd_cmi8330_isa_match, |
600 | .remove = __devexit_p(snd_cmi8330_nonpnp_remove), | 608 | .probe = snd_cmi8330_isa_probe, |
609 | .remove = __devexit_p(snd_cmi8330_isa_remove), | ||
601 | #ifdef CONFIG_PM | 610 | #ifdef CONFIG_PM |
602 | .suspend = snd_cmi8330_nonpnp_suspend, | 611 | .suspend = snd_cmi8330_isa_suspend, |
603 | .resume = snd_cmi8330_nonpnp_resume, | 612 | .resume = snd_cmi8330_isa_resume, |
604 | #endif | 613 | #endif |
605 | .driver = { | 614 | .driver = { |
606 | .name = CMI8330_DRIVER | 615 | .name = CMI8330_DRIVER |
@@ -609,8 +618,6 @@ static struct platform_driver snd_cmi8330_driver = { | |||
609 | 618 | ||
610 | 619 | ||
611 | #ifdef CONFIG_PNP | 620 | #ifdef CONFIG_PNP |
612 | static unsigned int __devinitdata cmi8330_pnp_devices; | ||
613 | |||
614 | static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, | 621 | static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, |
615 | const struct pnp_card_device_id *pid) | 622 | const struct pnp_card_device_id *pid) |
616 | { | 623 | { |
@@ -640,7 +647,6 @@ static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, | |||
640 | } | 647 | } |
641 | pnp_set_card_drvdata(pcard, card); | 648 | pnp_set_card_drvdata(pcard, card); |
642 | dev++; | 649 | dev++; |
643 | cmi8330_pnp_devices++; | ||
644 | return 0; | 650 | return 0; |
645 | } | 651 | } |
646 | 652 | ||
@@ -675,63 +681,28 @@ static struct pnp_card_driver cmi8330_pnpc_driver = { | |||
675 | }; | 681 | }; |
676 | #endif /* CONFIG_PNP */ | 682 | #endif /* CONFIG_PNP */ |
677 | 683 | ||
678 | static void __init_or_module snd_cmi8330_unregister_all(void) | ||
679 | { | ||
680 | int i; | ||
681 | |||
682 | #ifdef CONFIG_PNP | ||
683 | if (pnp_registered) | ||
684 | pnp_unregister_card_driver(&cmi8330_pnpc_driver); | ||
685 | #endif | ||
686 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
687 | platform_device_unregister(platform_devices[i]); | ||
688 | platform_driver_unregister(&snd_cmi8330_driver); | ||
689 | } | ||
690 | |||
691 | static int __init alsa_card_cmi8330_init(void) | 684 | static int __init alsa_card_cmi8330_init(void) |
692 | { | 685 | { |
693 | int i, err, cards = 0; | 686 | int err; |
694 | 687 | ||
695 | if ((err = platform_driver_register(&snd_cmi8330_driver)) < 0) | 688 | err = isa_register_driver(&snd_cmi8330_driver, SNDRV_CARDS); |
689 | if (err < 0) | ||
696 | return err; | 690 | return err; |
697 | |||
698 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
699 | struct platform_device *device; | ||
700 | if (! enable[i] || is_isapnp_selected(i)) | ||
701 | continue; | ||
702 | device = platform_device_register_simple(CMI8330_DRIVER, | ||
703 | i, NULL, 0); | ||
704 | if (IS_ERR(device)) | ||
705 | continue; | ||
706 | if (!platform_get_drvdata(device)) { | ||
707 | platform_device_unregister(device); | ||
708 | continue; | ||
709 | } | ||
710 | platform_devices[i] = device; | ||
711 | cards++; | ||
712 | } | ||
713 | |||
714 | #ifdef CONFIG_PNP | 691 | #ifdef CONFIG_PNP |
715 | err = pnp_register_card_driver(&cmi8330_pnpc_driver); | 692 | err = pnp_register_card_driver(&cmi8330_pnpc_driver); |
716 | if (!err) { | 693 | if (!err) |
717 | pnp_registered = 1; | 694 | pnp_registered = 1; |
718 | cards += cmi8330_pnp_devices; | ||
719 | } | ||
720 | #endif | 695 | #endif |
721 | |||
722 | if (!cards) { | ||
723 | #ifdef MODULE | ||
724 | snd_printk(KERN_ERR "CMI8330 not found or device busy\n"); | ||
725 | #endif | ||
726 | snd_cmi8330_unregister_all(); | ||
727 | return -ENODEV; | ||
728 | } | ||
729 | return 0; | 696 | return 0; |
730 | } | 697 | } |
731 | 698 | ||
732 | static void __exit alsa_card_cmi8330_exit(void) | 699 | static void __exit alsa_card_cmi8330_exit(void) |
733 | { | 700 | { |
734 | snd_cmi8330_unregister_all(); | 701 | #ifdef CONFIG_PNP |
702 | if (pnp_registered) | ||
703 | pnp_unregister_card_driver(&cmi8330_pnpc_driver); | ||
704 | #endif | ||
705 | isa_unregister_driver(&snd_cmi8330_driver); | ||
735 | } | 706 | } |
736 | 707 | ||
737 | module_init(alsa_card_cmi8330_init) | 708 | module_init(alsa_card_cmi8330_init) |
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 07ffd5c22e81..7d9d4d562e90 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/isa.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/pnp.h> | 27 | #include <linux/pnp.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
@@ -126,14 +126,12 @@ MODULE_PARM_DESC(dma1, "DMA1 # for " IDENT " driver."); | |||
126 | module_param_array(dma2, int, NULL, 0444); | 126 | module_param_array(dma2, int, NULL, 0444); |
127 | MODULE_PARM_DESC(dma2, "DMA2 # for " IDENT " driver."); | 127 | MODULE_PARM_DESC(dma2, "DMA2 # for " IDENT " driver."); |
128 | 128 | ||
129 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
130 | #ifdef CONFIG_PNP | 129 | #ifdef CONFIG_PNP |
131 | static int pnpc_registered; | 130 | static int pnpc_registered; |
132 | #ifdef CS4232 | 131 | #ifdef CS4232 |
133 | static int pnp_registered; | 132 | static int pnp_registered; |
134 | #endif | 133 | #endif |
135 | #endif /* CONFIG_PNP */ | 134 | #endif /* CONFIG_PNP */ |
136 | static unsigned int snd_cs423x_devices; | ||
137 | 135 | ||
138 | struct snd_card_cs4236 { | 136 | struct snd_card_cs4236 { |
139 | struct snd_cs4231 *chip; | 137 | struct snd_cs4231 *chip; |
@@ -542,38 +540,55 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) | |||
542 | return snd_card_register(card); | 540 | return snd_card_register(card); |
543 | } | 541 | } |
544 | 542 | ||
545 | static int __init snd_cs423x_nonpnp_probe(struct platform_device *pdev) | 543 | static int __devinit snd_cs423x_isa_match(struct device *pdev, |
544 | unsigned int dev) | ||
546 | { | 545 | { |
547 | int dev = pdev->id; | 546 | if (!enable[dev] || is_isapnp_selected(dev)) |
548 | struct snd_card *card; | 547 | return 0; |
549 | int err; | ||
550 | 548 | ||
551 | if (port[dev] == SNDRV_AUTO_PORT) { | 549 | if (port[dev] == SNDRV_AUTO_PORT) { |
552 | snd_printk(KERN_ERR "specify port\n"); | 550 | snd_printk(KERN_ERR "%s: please specify port\n", pdev->bus_id); |
553 | return -EINVAL; | 551 | return 0; |
554 | } | 552 | } |
555 | if (cport[dev] == SNDRV_AUTO_PORT) { | 553 | if (cport[dev] == SNDRV_AUTO_PORT) { |
556 | snd_printk(KERN_ERR "specify cport\n"); | 554 | snd_printk(KERN_ERR "%s: please specify cport\n", pdev->bus_id); |
557 | return -EINVAL; | 555 | return 0; |
556 | } | ||
557 | if (irq[dev] == SNDRV_AUTO_IRQ) { | ||
558 | snd_printk(KERN_ERR "%s: please specify irq\n", pdev->bus_id); | ||
559 | return 0; | ||
558 | } | 560 | } |
561 | if (dma1[dev] == SNDRV_AUTO_DMA) { | ||
562 | snd_printk(KERN_ERR "%s: please specify dma1\n", pdev->bus_id); | ||
563 | return 0; | ||
564 | } | ||
565 | return 1; | ||
566 | } | ||
567 | |||
568 | static int __devinit snd_cs423x_isa_probe(struct device *pdev, | ||
569 | unsigned int dev) | ||
570 | { | ||
571 | struct snd_card *card; | ||
572 | int err; | ||
559 | 573 | ||
560 | card = snd_cs423x_card_new(dev); | 574 | card = snd_cs423x_card_new(dev); |
561 | if (! card) | 575 | if (! card) |
562 | return -ENOMEM; | 576 | return -ENOMEM; |
563 | snd_card_set_dev(card, &pdev->dev); | 577 | snd_card_set_dev(card, pdev); |
564 | if ((err = snd_cs423x_probe(card, dev)) < 0) { | 578 | if ((err = snd_cs423x_probe(card, dev)) < 0) { |
565 | snd_card_free(card); | 579 | snd_card_free(card); |
566 | return err; | 580 | return err; |
567 | } | 581 | } |
568 | 582 | ||
569 | platform_set_drvdata(pdev, card); | 583 | dev_set_drvdata(pdev, card); |
570 | return 0; | 584 | return 0; |
571 | } | 585 | } |
572 | 586 | ||
573 | static int __devexit snd_cs423x_nonpnp_remove(struct platform_device *devptr) | 587 | static int __devexit snd_cs423x_isa_remove(struct device *pdev, |
588 | unsigned int dev) | ||
574 | { | 589 | { |
575 | snd_card_free(platform_get_drvdata(devptr)); | 590 | snd_card_free(dev_get_drvdata(pdev)); |
576 | platform_set_drvdata(devptr, NULL); | 591 | dev_set_drvdata(pdev, NULL); |
577 | return 0; | 592 | return 0; |
578 | } | 593 | } |
579 | 594 | ||
@@ -594,23 +609,25 @@ static int snd_cs423x_resume(struct snd_card *card) | |||
594 | return 0; | 609 | return 0; |
595 | } | 610 | } |
596 | 611 | ||
597 | static int snd_cs423x_nonpnp_suspend(struct platform_device *dev, pm_message_t state) | 612 | static int snd_cs423x_isa_suspend(struct device *dev, unsigned int n, |
613 | pm_message_t state) | ||
598 | { | 614 | { |
599 | return snd_cs423x_suspend(platform_get_drvdata(dev)); | 615 | return snd_cs423x_suspend(dev_get_drvdata(dev)); |
600 | } | 616 | } |
601 | 617 | ||
602 | static int snd_cs423x_nonpnp_resume(struct platform_device *dev) | 618 | static int snd_cs423x_isa_resume(struct device *dev, unsigned int n) |
603 | { | 619 | { |
604 | return snd_cs423x_resume(platform_get_drvdata(dev)); | 620 | return snd_cs423x_resume(dev_get_drvdata(dev)); |
605 | } | 621 | } |
606 | #endif | 622 | #endif |
607 | 623 | ||
608 | static struct platform_driver cs423x_nonpnp_driver = { | 624 | static struct isa_driver cs423x_isa_driver = { |
609 | .probe = snd_cs423x_nonpnp_probe, | 625 | .match = snd_cs423x_isa_match, |
610 | .remove = __devexit_p(snd_cs423x_nonpnp_remove), | 626 | .probe = snd_cs423x_isa_probe, |
627 | .remove = __devexit_p(snd_cs423x_isa_remove), | ||
611 | #ifdef CONFIG_PM | 628 | #ifdef CONFIG_PM |
612 | .suspend = snd_cs423x_nonpnp_suspend, | 629 | .suspend = snd_cs423x_isa_suspend, |
613 | .resume = snd_cs423x_nonpnp_resume, | 630 | .resume = snd_cs423x_isa_resume, |
614 | #endif | 631 | #endif |
615 | .driver = { | 632 | .driver = { |
616 | .name = CS423X_DRIVER | 633 | .name = CS423X_DRIVER |
@@ -651,7 +668,6 @@ static int __devinit snd_cs4232_pnpbios_detect(struct pnp_dev *pdev, | |||
651 | } | 668 | } |
652 | pnp_set_drvdata(pdev, card); | 669 | pnp_set_drvdata(pdev, card); |
653 | dev++; | 670 | dev++; |
654 | snd_cs423x_devices++; | ||
655 | return 0; | 671 | return 0; |
656 | } | 672 | } |
657 | 673 | ||
@@ -715,7 +731,6 @@ static int __devinit snd_cs423x_pnpc_detect(struct pnp_card_link *pcard, | |||
715 | } | 731 | } |
716 | pnp_set_card_drvdata(pcard, card); | 732 | pnp_set_card_drvdata(pcard, card); |
717 | dev++; | 733 | dev++; |
718 | snd_cs423x_devices++; | ||
719 | return 0; | 734 | return 0; |
720 | } | 735 | } |
721 | 736 | ||
@@ -750,45 +765,13 @@ static struct pnp_card_driver cs423x_pnpc_driver = { | |||
750 | }; | 765 | }; |
751 | #endif /* CONFIG_PNP */ | 766 | #endif /* CONFIG_PNP */ |
752 | 767 | ||
753 | static void __init_or_module snd_cs423x_unregister_all(void) | ||
754 | { | ||
755 | int i; | ||
756 | |||
757 | #ifdef CONFIG_PNP | ||
758 | if (pnpc_registered) | ||
759 | pnp_unregister_card_driver(&cs423x_pnpc_driver); | ||
760 | #ifdef CS4232 | ||
761 | if (pnp_registered) | ||
762 | pnp_unregister_driver(&cs4232_pnp_driver); | ||
763 | #endif | ||
764 | #endif /* CONFIG_PNP */ | ||
765 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
766 | platform_device_unregister(platform_devices[i]); | ||
767 | platform_driver_unregister(&cs423x_nonpnp_driver); | ||
768 | } | ||
769 | |||
770 | static int __init alsa_card_cs423x_init(void) | 768 | static int __init alsa_card_cs423x_init(void) |
771 | { | 769 | { |
772 | int i, err; | 770 | int err; |
773 | 771 | ||
774 | if ((err = platform_driver_register(&cs423x_nonpnp_driver)) < 0) | 772 | err = isa_register_driver(&cs423x_isa_driver, SNDRV_CARDS); |
773 | if (err < 0) | ||
775 | return err; | 774 | return err; |
776 | |||
777 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
778 | struct platform_device *device; | ||
779 | if (! enable[i] || is_isapnp_selected(i)) | ||
780 | continue; | ||
781 | device = platform_device_register_simple(CS423X_DRIVER, | ||
782 | i, NULL, 0); | ||
783 | if (IS_ERR(device)) | ||
784 | continue; | ||
785 | if (!platform_get_drvdata(device)) { | ||
786 | platform_device_unregister(device); | ||
787 | continue; | ||
788 | } | ||
789 | platform_devices[i] = device; | ||
790 | snd_cs423x_devices++; | ||
791 | } | ||
792 | #ifdef CONFIG_PNP | 775 | #ifdef CONFIG_PNP |
793 | #ifdef CS4232 | 776 | #ifdef CS4232 |
794 | err = pnp_register_driver(&cs4232_pnp_driver); | 777 | err = pnp_register_driver(&cs4232_pnp_driver); |
@@ -799,20 +782,20 @@ static int __init alsa_card_cs423x_init(void) | |||
799 | if (!err) | 782 | if (!err) |
800 | pnpc_registered = 1; | 783 | pnpc_registered = 1; |
801 | #endif /* CONFIG_PNP */ | 784 | #endif /* CONFIG_PNP */ |
802 | |||
803 | if (!snd_cs423x_devices) { | ||
804 | #ifdef MODULE | ||
805 | printk(KERN_ERR IDENT " soundcard not found or device busy\n"); | ||
806 | #endif | ||
807 | snd_cs423x_unregister_all(); | ||
808 | return -ENODEV; | ||
809 | } | ||
810 | return 0; | 785 | return 0; |
811 | } | 786 | } |
812 | 787 | ||
813 | static void __exit alsa_card_cs423x_exit(void) | 788 | static void __exit alsa_card_cs423x_exit(void) |
814 | { | 789 | { |
815 | snd_cs423x_unregister_all(); | 790 | #ifdef CONFIG_PNP |
791 | if (pnpc_registered) | ||
792 | pnp_unregister_card_driver(&cs423x_pnpc_driver); | ||
793 | #ifdef CS4232 | ||
794 | if (pnp_registered) | ||
795 | pnp_unregister_driver(&cs4232_pnp_driver); | ||
796 | #endif | ||
797 | #endif /* CONFIG_PNP */ | ||
798 | isa_unregister_driver(&cs423x_isa_driver); | ||
816 | } | 799 | } |
817 | 800 | ||
818 | module_init(alsa_card_cs423x_init) | 801 | module_init(alsa_card_cs423x_init) |
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 725c115ff97d..12b61af1a4ef 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c | |||
@@ -80,7 +80,7 @@ | |||
80 | #include <sound/driver.h> | 80 | #include <sound/driver.h> |
81 | #include <linux/init.h> | 81 | #include <linux/init.h> |
82 | #include <linux/err.h> | 82 | #include <linux/err.h> |
83 | #include <linux/platform_device.h> | 83 | #include <linux/isa.h> |
84 | #include <linux/slab.h> | 84 | #include <linux/slab.h> |
85 | #include <linux/pnp.h> | 85 | #include <linux/pnp.h> |
86 | #include <linux/isapnp.h> | 86 | #include <linux/isapnp.h> |
@@ -2035,8 +2035,6 @@ MODULE_PARM_DESC(dma1, "DMA 1 # for ES18xx driver."); | |||
2035 | module_param_array(dma2, int, NULL, 0444); | 2035 | module_param_array(dma2, int, NULL, 0444); |
2036 | MODULE_PARM_DESC(dma2, "DMA 2 # for ES18xx driver."); | 2036 | MODULE_PARM_DESC(dma2, "DMA 2 # for ES18xx driver."); |
2037 | 2037 | ||
2038 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
2039 | |||
2040 | #ifdef CONFIG_PNP | 2038 | #ifdef CONFIG_PNP |
2041 | static int pnp_registered, pnpc_registered; | 2039 | static int pnp_registered, pnpc_registered; |
2042 | 2040 | ||
@@ -2237,7 +2235,12 @@ static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) | |||
2237 | return snd_card_register(card); | 2235 | return snd_card_register(card); |
2238 | } | 2236 | } |
2239 | 2237 | ||
2240 | static int __devinit snd_es18xx_nonpnp_probe1(int dev, struct platform_device *devptr) | 2238 | static int __devinit snd_es18xx_isa_match(struct device *pdev, unsigned int dev) |
2239 | { | ||
2240 | return enable[dev] && !is_isapnp_selected(dev); | ||
2241 | } | ||
2242 | |||
2243 | static int __devinit snd_es18xx_isa_probe1(int dev, struct device *devptr) | ||
2241 | { | 2244 | { |
2242 | struct snd_card *card; | 2245 | struct snd_card *card; |
2243 | int err; | 2246 | int err; |
@@ -2245,18 +2248,17 @@ static int __devinit snd_es18xx_nonpnp_probe1(int dev, struct platform_device *d | |||
2245 | card = snd_es18xx_card_new(dev); | 2248 | card = snd_es18xx_card_new(dev); |
2246 | if (! card) | 2249 | if (! card) |
2247 | return -ENOMEM; | 2250 | return -ENOMEM; |
2248 | snd_card_set_dev(card, &devptr->dev); | 2251 | snd_card_set_dev(card, devptr); |
2249 | if ((err = snd_audiodrive_probe(card, dev)) < 0) { | 2252 | if ((err = snd_audiodrive_probe(card, dev)) < 0) { |
2250 | snd_card_free(card); | 2253 | snd_card_free(card); |
2251 | return err; | 2254 | return err; |
2252 | } | 2255 | } |
2253 | platform_set_drvdata(devptr, card); | 2256 | dev_set_drvdata(devptr, card); |
2254 | return 0; | 2257 | return 0; |
2255 | } | 2258 | } |
2256 | 2259 | ||
2257 | static int __devinit snd_es18xx_nonpnp_probe(struct platform_device *pdev) | 2260 | static int __devinit snd_es18xx_isa_probe(struct device *pdev, unsigned int dev) |
2258 | { | 2261 | { |
2259 | int dev = pdev->id; | ||
2260 | int err; | 2262 | int err; |
2261 | static int possible_irqs[] = {5, 9, 10, 7, 11, 12, -1}; | 2263 | static int possible_irqs[] = {5, 9, 10, 7, 11, 12, -1}; |
2262 | static int possible_dmas[] = {1, 0, 3, 5, -1}; | 2264 | static int possible_dmas[] = {1, 0, 3, 5, -1}; |
@@ -2281,13 +2283,13 @@ static int __devinit snd_es18xx_nonpnp_probe(struct platform_device *pdev) | |||
2281 | } | 2283 | } |
2282 | 2284 | ||
2283 | if (port[dev] != SNDRV_AUTO_PORT) { | 2285 | if (port[dev] != SNDRV_AUTO_PORT) { |
2284 | return snd_es18xx_nonpnp_probe1(dev, pdev); | 2286 | return snd_es18xx_isa_probe1(dev, pdev); |
2285 | } else { | 2287 | } else { |
2286 | static unsigned long possible_ports[] = {0x220, 0x240, 0x260, 0x280}; | 2288 | static unsigned long possible_ports[] = {0x220, 0x240, 0x260, 0x280}; |
2287 | int i; | 2289 | int i; |
2288 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { | 2290 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { |
2289 | port[dev] = possible_ports[i]; | 2291 | port[dev] = possible_ports[i]; |
2290 | err = snd_es18xx_nonpnp_probe1(dev, pdev); | 2292 | err = snd_es18xx_isa_probe1(dev, pdev); |
2291 | if (! err) | 2293 | if (! err) |
2292 | return 0; | 2294 | return 0; |
2293 | } | 2295 | } |
@@ -2295,33 +2297,36 @@ static int __devinit snd_es18xx_nonpnp_probe(struct platform_device *pdev) | |||
2295 | } | 2297 | } |
2296 | } | 2298 | } |
2297 | 2299 | ||
2298 | static int __devexit snd_es18xx_nonpnp_remove(struct platform_device *devptr) | 2300 | static int __devexit snd_es18xx_isa_remove(struct device *devptr, |
2301 | unsigned int dev) | ||
2299 | { | 2302 | { |
2300 | snd_card_free(platform_get_drvdata(devptr)); | 2303 | snd_card_free(dev_get_drvdata(devptr)); |
2301 | platform_set_drvdata(devptr, NULL); | 2304 | dev_set_drvdata(devptr, NULL); |
2302 | return 0; | 2305 | return 0; |
2303 | } | 2306 | } |
2304 | 2307 | ||
2305 | #ifdef CONFIG_PM | 2308 | #ifdef CONFIG_PM |
2306 | static int snd_es18xx_nonpnp_suspend(struct platform_device *dev, pm_message_t state) | 2309 | static int snd_es18xx_isa_suspend(struct device *dev, unsigned int n, |
2310 | pm_message_t state) | ||
2307 | { | 2311 | { |
2308 | return snd_es18xx_suspend(platform_get_drvdata(dev), state); | 2312 | return snd_es18xx_suspend(dev_get_drvdata(dev), state); |
2309 | } | 2313 | } |
2310 | 2314 | ||
2311 | static int snd_es18xx_nonpnp_resume(struct platform_device *dev) | 2315 | static int snd_es18xx_isa_resume(struct device *dev, unsigned int n) |
2312 | { | 2316 | { |
2313 | return snd_es18xx_resume(platform_get_drvdata(dev)); | 2317 | return snd_es18xx_resume(dev_get_drvdata(dev)); |
2314 | } | 2318 | } |
2315 | #endif | 2319 | #endif |
2316 | 2320 | ||
2317 | #define ES18XX_DRIVER "snd_es18xx" | 2321 | #define ES18XX_DRIVER "snd_es18xx" |
2318 | 2322 | ||
2319 | static struct platform_driver snd_es18xx_nonpnp_driver = { | 2323 | static struct isa_driver snd_es18xx_isa_driver = { |
2320 | .probe = snd_es18xx_nonpnp_probe, | 2324 | .match = snd_es18xx_isa_match, |
2321 | .remove = __devexit_p(snd_es18xx_nonpnp_remove), | 2325 | .probe = snd_es18xx_isa_probe, |
2326 | .remove = __devexit_p(snd_es18xx_isa_remove), | ||
2322 | #ifdef CONFIG_PM | 2327 | #ifdef CONFIG_PM |
2323 | .suspend = snd_es18xx_nonpnp_suspend, | 2328 | .suspend = snd_es18xx_isa_suspend, |
2324 | .resume = snd_es18xx_nonpnp_resume, | 2329 | .resume = snd_es18xx_isa_resume, |
2325 | #endif | 2330 | #endif |
2326 | .driver = { | 2331 | .driver = { |
2327 | .name = ES18XX_DRIVER | 2332 | .name = ES18XX_DRIVER |
@@ -2330,8 +2335,6 @@ static struct platform_driver snd_es18xx_nonpnp_driver = { | |||
2330 | 2335 | ||
2331 | 2336 | ||
2332 | #ifdef CONFIG_PNP | 2337 | #ifdef CONFIG_PNP |
2333 | static unsigned int __devinitdata es18xx_pnp_devices; | ||
2334 | |||
2335 | static int __devinit snd_audiodrive_pnp_detect(struct pnp_dev *pdev, | 2338 | static int __devinit snd_audiodrive_pnp_detect(struct pnp_dev *pdev, |
2336 | const struct pnp_device_id *id) | 2339 | const struct pnp_device_id *id) |
2337 | { | 2340 | { |
@@ -2362,7 +2365,6 @@ static int __devinit snd_audiodrive_pnp_detect(struct pnp_dev *pdev, | |||
2362 | } | 2365 | } |
2363 | pnp_set_drvdata(pdev, card); | 2366 | pnp_set_drvdata(pdev, card); |
2364 | dev++; | 2367 | dev++; |
2365 | es18xx_pnp_devices++; | ||
2366 | return 0; | 2368 | return 0; |
2367 | } | 2369 | } |
2368 | 2370 | ||
@@ -2424,7 +2426,6 @@ static int __devinit snd_audiodrive_pnpc_detect(struct pnp_card_link *pcard, | |||
2424 | 2426 | ||
2425 | pnp_set_card_drvdata(pcard, card); | 2427 | pnp_set_card_drvdata(pcard, card); |
2426 | dev++; | 2428 | dev++; |
2427 | es18xx_pnp_devices++; | ||
2428 | return 0; | 2429 | return 0; |
2429 | } | 2430 | } |
2430 | 2431 | ||
@@ -2460,44 +2461,14 @@ static struct pnp_card_driver es18xx_pnpc_driver = { | |||
2460 | }; | 2461 | }; |
2461 | #endif /* CONFIG_PNP */ | 2462 | #endif /* CONFIG_PNP */ |
2462 | 2463 | ||
2463 | static void __init_or_module snd_es18xx_unregister_all(void) | ||
2464 | { | ||
2465 | int i; | ||
2466 | |||
2467 | #ifdef CONFIG_PNP | ||
2468 | if (pnpc_registered) | ||
2469 | pnp_unregister_card_driver(&es18xx_pnpc_driver); | ||
2470 | if (pnp_registered) | ||
2471 | pnp_unregister_driver(&es18xx_pnp_driver); | ||
2472 | #endif | ||
2473 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
2474 | platform_device_unregister(platform_devices[i]); | ||
2475 | platform_driver_unregister(&snd_es18xx_nonpnp_driver); | ||
2476 | } | ||
2477 | |||
2478 | static int __init alsa_card_es18xx_init(void) | 2464 | static int __init alsa_card_es18xx_init(void) |
2479 | { | 2465 | { |
2480 | int i, err, cards = 0; | 2466 | int err; |
2481 | 2467 | ||
2482 | if ((err = platform_driver_register(&snd_es18xx_nonpnp_driver)) < 0) | 2468 | err = isa_register_driver(&snd_es18xx_isa_driver, SNDRV_CARDS); |
2469 | if (err < 0) | ||
2483 | return err; | 2470 | return err; |
2484 | 2471 | ||
2485 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
2486 | struct platform_device *device; | ||
2487 | if (! enable[i] || is_isapnp_selected(i)) | ||
2488 | continue; | ||
2489 | device = platform_device_register_simple(ES18XX_DRIVER, | ||
2490 | i, NULL, 0); | ||
2491 | if (IS_ERR(device)) | ||
2492 | continue; | ||
2493 | if (!platform_get_drvdata(device)) { | ||
2494 | platform_device_unregister(device); | ||
2495 | continue; | ||
2496 | } | ||
2497 | platform_devices[i] = device; | ||
2498 | cards++; | ||
2499 | } | ||
2500 | |||
2501 | #ifdef CONFIG_PNP | 2472 | #ifdef CONFIG_PNP |
2502 | err = pnp_register_driver(&es18xx_pnp_driver); | 2473 | err = pnp_register_driver(&es18xx_pnp_driver); |
2503 | if (!err) | 2474 | if (!err) |
@@ -2505,22 +2476,19 @@ static int __init alsa_card_es18xx_init(void) | |||
2505 | err = pnp_register_card_driver(&es18xx_pnpc_driver); | 2476 | err = pnp_register_card_driver(&es18xx_pnpc_driver); |
2506 | if (!err) | 2477 | if (!err) |
2507 | pnpc_registered = 1; | 2478 | pnpc_registered = 1; |
2508 | cards += es18xx_pnp_devices; | ||
2509 | #endif | ||
2510 | |||
2511 | if(!cards) { | ||
2512 | #ifdef MODULE | ||
2513 | snd_printk(KERN_ERR "ESS AudioDrive ES18xx soundcard not found or device busy\n"); | ||
2514 | #endif | 2479 | #endif |
2515 | snd_es18xx_unregister_all(); | ||
2516 | return -ENODEV; | ||
2517 | } | ||
2518 | return 0; | 2480 | return 0; |
2519 | } | 2481 | } |
2520 | 2482 | ||
2521 | static void __exit alsa_card_es18xx_exit(void) | 2483 | static void __exit alsa_card_es18xx_exit(void) |
2522 | { | 2484 | { |
2523 | snd_es18xx_unregister_all(); | 2485 | #ifdef CONFIG_PNP |
2486 | if (pnpc_registered) | ||
2487 | pnp_unregister_card_driver(&es18xx_pnpc_driver); | ||
2488 | if (pnp_registered) | ||
2489 | pnp_unregister_driver(&es18xx_pnp_driver); | ||
2490 | #endif | ||
2491 | isa_unregister_driver(&snd_es18xx_isa_driver); | ||
2524 | } | 2492 | } |
2525 | 2493 | ||
2526 | module_init(alsa_card_es18xx_init) | 2494 | module_init(alsa_card_es18xx_init) |
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index d1ad90ca035d..a0d2f8fc2738 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/isa.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
@@ -72,8 +72,6 @@ MODULE_PARM_DESC(channels, "Used GF1 channels for GUS MAX driver."); | |||
72 | module_param_array(pcm_channels, int, NULL, 0444); | 72 | module_param_array(pcm_channels, int, NULL, 0444); |
73 | MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS MAX driver."); | 73 | MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS MAX driver."); |
74 | 74 | ||
75 | static struct platform_device *devices[SNDRV_CARDS]; | ||
76 | |||
77 | struct snd_gusmax { | 75 | struct snd_gusmax { |
78 | int irq; | 76 | int irq; |
79 | struct snd_card *card; | 77 | struct snd_card *card; |
@@ -205,9 +203,13 @@ static void snd_gusmax_free(struct snd_card *card) | |||
205 | free_irq(maxcard->irq, (void *)maxcard); | 203 | free_irq(maxcard->irq, (void *)maxcard); |
206 | } | 204 | } |
207 | 205 | ||
208 | static int __devinit snd_gusmax_probe(struct platform_device *pdev) | 206 | static int __devinit snd_gusmax_match(struct device *pdev, unsigned int dev) |
207 | { | ||
208 | return enable[dev]; | ||
209 | } | ||
210 | |||
211 | static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev) | ||
209 | { | 212 | { |
210 | int dev = pdev->id; | ||
211 | static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; | 213 | static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; |
212 | static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; | 214 | static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; |
213 | int xirq, xdma1, xdma2, err; | 215 | int xirq, xdma1, xdma2, err; |
@@ -333,7 +335,7 @@ static int __devinit snd_gusmax_probe(struct platform_device *pdev) | |||
333 | if (xdma2 >= 0) | 335 | if (xdma2 >= 0) |
334 | sprintf(card->longname + strlen(card->longname), "&%i", xdma2); | 336 | sprintf(card->longname + strlen(card->longname), "&%i", xdma2); |
335 | 337 | ||
336 | snd_card_set_dev(card, &pdev->dev); | 338 | snd_card_set_dev(card, pdev); |
337 | 339 | ||
338 | if ((err = snd_card_register(card)) < 0) | 340 | if ((err = snd_card_register(card)) < 0) |
339 | goto _err; | 341 | goto _err; |
@@ -341,7 +343,7 @@ static int __devinit snd_gusmax_probe(struct platform_device *pdev) | |||
341 | maxcard->gus = gus; | 343 | maxcard->gus = gus; |
342 | maxcard->cs4231 = cs4231; | 344 | maxcard->cs4231 = cs4231; |
343 | 345 | ||
344 | platform_set_drvdata(pdev, card); | 346 | dev_set_drvdata(pdev, card); |
345 | return 0; | 347 | return 0; |
346 | 348 | ||
347 | _err: | 349 | _err: |
@@ -349,16 +351,17 @@ static int __devinit snd_gusmax_probe(struct platform_device *pdev) | |||
349 | return err; | 351 | return err; |
350 | } | 352 | } |
351 | 353 | ||
352 | static int __devexit snd_gusmax_remove(struct platform_device *devptr) | 354 | static int __devexit snd_gusmax_remove(struct device *devptr, unsigned int dev) |
353 | { | 355 | { |
354 | snd_card_free(platform_get_drvdata(devptr)); | 356 | snd_card_free(dev_get_drvdata(devptr)); |
355 | platform_set_drvdata(devptr, NULL); | 357 | dev_set_drvdata(devptr, NULL); |
356 | return 0; | 358 | return 0; |
357 | } | 359 | } |
358 | 360 | ||
359 | #define GUSMAX_DRIVER "snd_gusmax" | 361 | #define GUSMAX_DRIVER "snd_gusmax" |
360 | 362 | ||
361 | static struct platform_driver snd_gusmax_driver = { | 363 | static struct isa_driver snd_gusmax_driver = { |
364 | .match = snd_gusmax_match, | ||
362 | .probe = snd_gusmax_probe, | 365 | .probe = snd_gusmax_probe, |
363 | .remove = __devexit_p(snd_gusmax_remove), | 366 | .remove = __devexit_p(snd_gusmax_remove), |
364 | /* FIXME: suspend/resume */ | 367 | /* FIXME: suspend/resume */ |
@@ -367,52 +370,14 @@ static struct platform_driver snd_gusmax_driver = { | |||
367 | }, | 370 | }, |
368 | }; | 371 | }; |
369 | 372 | ||
370 | static void __init_or_module snd_gusmax_unregister_all(void) | ||
371 | { | ||
372 | int i; | ||
373 | |||
374 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
375 | platform_device_unregister(devices[i]); | ||
376 | platform_driver_unregister(&snd_gusmax_driver); | ||
377 | } | ||
378 | |||
379 | static int __init alsa_card_gusmax_init(void) | 373 | static int __init alsa_card_gusmax_init(void) |
380 | { | 374 | { |
381 | int i, cards, err; | 375 | return isa_register_driver(&snd_gusmax_driver, SNDRV_CARDS); |
382 | |||
383 | err = platform_driver_register(&snd_gusmax_driver); | ||
384 | if (err < 0) | ||
385 | return err; | ||
386 | |||
387 | cards = 0; | ||
388 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
389 | struct platform_device *device; | ||
390 | if (! enable[i]) | ||
391 | continue; | ||
392 | device = platform_device_register_simple(GUSMAX_DRIVER, | ||
393 | i, NULL, 0); | ||
394 | if (IS_ERR(device)) | ||
395 | continue; | ||
396 | if (!platform_get_drvdata(device)) { | ||
397 | platform_device_unregister(device); | ||
398 | continue; | ||
399 | } | ||
400 | devices[i] = device; | ||
401 | cards++; | ||
402 | } | ||
403 | if (!cards) { | ||
404 | #ifdef MODULE | ||
405 | printk(KERN_ERR "GUS MAX soundcard not found or device busy\n"); | ||
406 | #endif | ||
407 | snd_gusmax_unregister_all(); | ||
408 | return -ENODEV; | ||
409 | } | ||
410 | return 0; | ||
411 | } | 376 | } |
412 | 377 | ||
413 | static void __exit alsa_card_gusmax_exit(void) | 378 | static void __exit alsa_card_gusmax_exit(void) |
414 | { | 379 | { |
415 | snd_gusmax_unregister_all(); | 380 | isa_unregister_driver(&snd_gusmax_driver); |
416 | } | 381 | } |
417 | 382 | ||
418 | module_init(alsa_card_gusmax_init) | 383 | module_init(alsa_card_gusmax_init) |
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 4ec2d79431fc..3e4657255536 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <sound/driver.h> | 25 | #include <sound/driver.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/err.h> | 27 | #include <linux/err.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/isa.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/pnp.h> | 31 | #include <linux/pnp.h> |
@@ -115,9 +115,6 @@ MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for InterWave driver."); | |||
115 | module_param_array(effect, int, NULL, 0444); | 115 | module_param_array(effect, int, NULL, 0444); |
116 | MODULE_PARM_DESC(effect, "Effects enable for InterWave driver."); | 116 | MODULE_PARM_DESC(effect, "Effects enable for InterWave driver."); |
117 | 117 | ||
118 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
119 | static int pnp_registered; | ||
120 | |||
121 | struct snd_interwave { | 118 | struct snd_interwave { |
122 | int irq; | 119 | int irq; |
123 | struct snd_card *card; | 120 | struct snd_card *card; |
@@ -138,6 +135,7 @@ struct snd_interwave { | |||
138 | 135 | ||
139 | 136 | ||
140 | #ifdef CONFIG_PNP | 137 | #ifdef CONFIG_PNP |
138 | static int pnp_registered; | ||
141 | 139 | ||
142 | static struct pnp_card_device_id snd_interwave_pnpids[] = { | 140 | static struct pnp_card_device_id snd_interwave_pnpids[] = { |
143 | #ifndef SNDRV_STB | 141 | #ifndef SNDRV_STB |
@@ -793,7 +791,7 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev) | |||
793 | return 0; | 791 | return 0; |
794 | } | 792 | } |
795 | 793 | ||
796 | static int __devinit snd_interwave_nonpnp_probe1(int dev, struct platform_device *devptr) | 794 | static int __devinit snd_interwave_isa_probe1(int dev, struct device *devptr) |
797 | { | 795 | { |
798 | struct snd_card *card; | 796 | struct snd_card *card; |
799 | int err; | 797 | int err; |
@@ -802,18 +800,30 @@ static int __devinit snd_interwave_nonpnp_probe1(int dev, struct platform_device | |||
802 | if (! card) | 800 | if (! card) |
803 | return -ENOMEM; | 801 | return -ENOMEM; |
804 | 802 | ||
805 | snd_card_set_dev(card, &devptr->dev); | 803 | snd_card_set_dev(card, devptr); |
806 | if ((err = snd_interwave_probe(card, dev)) < 0) { | 804 | if ((err = snd_interwave_probe(card, dev)) < 0) { |
807 | snd_card_free(card); | 805 | snd_card_free(card); |
808 | return err; | 806 | return err; |
809 | } | 807 | } |
810 | platform_set_drvdata(devptr, card); | 808 | dev_set_drvdata(devptr, card); |
811 | return 0; | 809 | return 0; |
812 | } | 810 | } |
813 | 811 | ||
814 | static int __devinit snd_interwave_nonpnp_probe(struct platform_device *pdev) | 812 | static int __devinit snd_interwave_isa_match(struct device *pdev, |
813 | unsigned int dev) | ||
814 | { | ||
815 | if (!enable[dev]) | ||
816 | return 0; | ||
817 | #ifdef CONFIG_PNP | ||
818 | if (isapnp[dev]) | ||
819 | return 0; | ||
820 | #endif | ||
821 | return 1; | ||
822 | } | ||
823 | |||
824 | static int __devinit snd_interwave_isa_probe(struct device *pdev, | ||
825 | unsigned int dev) | ||
815 | { | 826 | { |
816 | int dev = pdev->id; | ||
817 | int err; | 827 | int err; |
818 | static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; | 828 | static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; |
819 | static int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1}; | 829 | static int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1}; |
@@ -838,13 +848,13 @@ static int __devinit snd_interwave_nonpnp_probe(struct platform_device *pdev) | |||
838 | } | 848 | } |
839 | 849 | ||
840 | if (port[dev] != SNDRV_AUTO_PORT) | 850 | if (port[dev] != SNDRV_AUTO_PORT) |
841 | return snd_interwave_nonpnp_probe1(dev, pdev); | 851 | return snd_interwave_isa_probe1(dev, pdev); |
842 | else { | 852 | else { |
843 | static long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260}; | 853 | static long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260}; |
844 | int i; | 854 | int i; |
845 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { | 855 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { |
846 | port[dev] = possible_ports[i]; | 856 | port[dev] = possible_ports[i]; |
847 | err = snd_interwave_nonpnp_probe1(dev, pdev); | 857 | err = snd_interwave_isa_probe1(dev, pdev); |
848 | if (! err) | 858 | if (! err) |
849 | return 0; | 859 | return 0; |
850 | } | 860 | } |
@@ -852,16 +862,17 @@ static int __devinit snd_interwave_nonpnp_probe(struct platform_device *pdev) | |||
852 | } | 862 | } |
853 | } | 863 | } |
854 | 864 | ||
855 | static int __devexit snd_interwave_nonpnp_remove(struct platform_device *devptr) | 865 | static int __devexit snd_interwave_isa_remove(struct device *devptr, unsigned int dev) |
856 | { | 866 | { |
857 | snd_card_free(platform_get_drvdata(devptr)); | 867 | snd_card_free(dev_get_drvdata(devptr)); |
858 | platform_set_drvdata(devptr, NULL); | 868 | dev_set_drvdata(devptr, NULL); |
859 | return 0; | 869 | return 0; |
860 | } | 870 | } |
861 | 871 | ||
862 | static struct platform_driver snd_interwave_driver = { | 872 | static struct isa_driver snd_interwave_driver = { |
863 | .probe = snd_interwave_nonpnp_probe, | 873 | .match = snd_interwave_isa_match, |
864 | .remove = __devexit_p(snd_interwave_nonpnp_remove), | 874 | .probe = snd_interwave_isa_probe, |
875 | .remove = __devexit_p(snd_interwave_isa_remove), | ||
865 | /* FIXME: suspend,resume */ | 876 | /* FIXME: suspend,resume */ |
866 | .driver = { | 877 | .driver = { |
867 | .name = INTERWAVE_DRIVER | 878 | .name = INTERWAVE_DRIVER |
@@ -869,8 +880,6 @@ static struct platform_driver snd_interwave_driver = { | |||
869 | }; | 880 | }; |
870 | 881 | ||
871 | #ifdef CONFIG_PNP | 882 | #ifdef CONFIG_PNP |
872 | static unsigned int __devinitdata interwave_pnp_devices; | ||
873 | |||
874 | static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, | 883 | static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, |
875 | const struct pnp_card_device_id *pid) | 884 | const struct pnp_card_device_id *pid) |
876 | { | 885 | { |
@@ -900,7 +909,6 @@ static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, | |||
900 | } | 909 | } |
901 | pnp_set_card_drvdata(pcard, card); | 910 | pnp_set_card_drvdata(pcard, card); |
902 | dev++; | 911 | dev++; |
903 | interwave_pnp_devices++; | ||
904 | return 0; | 912 | return 0; |
905 | } | 913 | } |
906 | 914 | ||
@@ -921,64 +929,29 @@ static struct pnp_card_driver interwave_pnpc_driver = { | |||
921 | 929 | ||
922 | #endif /* CONFIG_PNP */ | 930 | #endif /* CONFIG_PNP */ |
923 | 931 | ||
924 | static void __init_or_module snd_interwave_unregister_all(void) | ||
925 | { | ||
926 | int i; | ||
927 | |||
928 | if (pnp_registered) | ||
929 | pnp_unregister_card_driver(&interwave_pnpc_driver); | ||
930 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
931 | platform_device_unregister(platform_devices[i]); | ||
932 | platform_driver_unregister(&snd_interwave_driver); | ||
933 | } | ||
934 | |||
935 | static int __init alsa_card_interwave_init(void) | 932 | static int __init alsa_card_interwave_init(void) |
936 | { | 933 | { |
937 | int i, err, cards = 0; | 934 | int err; |
938 | 935 | ||
939 | if ((err = platform_driver_register(&snd_interwave_driver)) < 0) | 936 | err = isa_register_driver(&snd_interwave_driver, SNDRV_CARDS); |
937 | if (err < 0) | ||
940 | return err; | 938 | return err; |
941 | |||
942 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
943 | struct platform_device *device; | ||
944 | if (! enable[i]) | ||
945 | continue; | ||
946 | #ifdef CONFIG_PNP | 939 | #ifdef CONFIG_PNP |
947 | if (isapnp[i]) | ||
948 | continue; | ||
949 | #endif | ||
950 | device = platform_device_register_simple(INTERWAVE_DRIVER, | ||
951 | i, NULL, 0); | ||
952 | if (IS_ERR(device)) | ||
953 | continue; | ||
954 | if (!platform_get_drvdata(device)) { | ||
955 | platform_device_unregister(device); | ||
956 | continue; | ||
957 | } | ||
958 | platform_devices[i] = device; | ||
959 | cards++; | ||
960 | } | ||
961 | |||
962 | /* ISA PnP cards */ | 940 | /* ISA PnP cards */ |
963 | err = pnp_register_card_driver(&interwave_pnpc_driver); | 941 | err = pnp_register_card_driver(&interwave_pnpc_driver); |
964 | if (!err) { | 942 | if (!err) |
965 | pnp_registered = 1; | 943 | pnp_registered = 1; |
966 | cards += interwave_pnp_devices;; | ||
967 | } | ||
968 | |||
969 | if (!cards) { | ||
970 | #ifdef MODULE | ||
971 | printk(KERN_ERR "InterWave soundcard not found or device busy\n"); | ||
972 | #endif | 944 | #endif |
973 | snd_interwave_unregister_all(); | ||
974 | return -ENODEV; | ||
975 | } | ||
976 | return 0; | 945 | return 0; |
977 | } | 946 | } |
978 | 947 | ||
979 | static void __exit alsa_card_interwave_exit(void) | 948 | static void __exit alsa_card_interwave_exit(void) |
980 | { | 949 | { |
981 | snd_interwave_unregister_all(); | 950 | #ifdef CONFIG_PNP |
951 | if (pnp_registered) | ||
952 | pnp_unregister_card_driver(&interwave_pnpc_driver); | ||
953 | #endif | ||
954 | isa_unregister_driver(&snd_interwave_driver); | ||
982 | } | 955 | } |
983 | 956 | ||
984 | module_init(alsa_card_interwave_init) | 957 | module_init(alsa_card_interwave_init) |
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index f3db686b1c0c..50a812f1c804 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/isa.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/pm.h> | 27 | #include <linux/pm.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
@@ -91,12 +91,10 @@ MODULE_PARM_DESC(dma2, "DMA2 # for OPL3-SA driver."); | |||
91 | module_param_array(opl3sa3_ymode, int, NULL, 0444); | 91 | module_param_array(opl3sa3_ymode, int, NULL, 0444); |
92 | MODULE_PARM_DESC(opl3sa3_ymode, "Speaker size selection for 3D Enhancement mode: Desktop/Large Notebook/Small Notebook/HiFi."); | 92 | MODULE_PARM_DESC(opl3sa3_ymode, "Speaker size selection for 3D Enhancement mode: Desktop/Large Notebook/Small Notebook/HiFi."); |
93 | 93 | ||
94 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
95 | #ifdef CONFIG_PNP | 94 | #ifdef CONFIG_PNP |
96 | static int pnp_registered; | 95 | static int pnp_registered; |
97 | static int pnpc_registered; | 96 | static int pnpc_registered; |
98 | #endif | 97 | #endif |
99 | static unsigned int snd_opl3sa2_devices; | ||
100 | 98 | ||
101 | /* control ports */ | 99 | /* control ports */ |
102 | #define OPL3SA2_PM_CTRL 0x01 | 100 | #define OPL3SA2_PM_CTRL 0x01 |
@@ -783,7 +781,6 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev, | |||
783 | } | 781 | } |
784 | pnp_set_drvdata(pdev, card); | 782 | pnp_set_drvdata(pdev, card); |
785 | dev++; | 783 | dev++; |
786 | snd_opl3sa2_devices++; | ||
787 | return 0; | 784 | return 0; |
788 | } | 785 | } |
789 | 786 | ||
@@ -850,7 +847,6 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard, | |||
850 | } | 847 | } |
851 | pnp_set_card_drvdata(pcard, card); | 848 | pnp_set_card_drvdata(pcard, card); |
852 | dev++; | 849 | dev++; |
853 | snd_opl3sa2_devices++; | ||
854 | return 0; | 850 | return 0; |
855 | } | 851 | } |
856 | 852 | ||
@@ -884,116 +880,95 @@ static struct pnp_card_driver opl3sa2_pnpc_driver = { | |||
884 | }; | 880 | }; |
885 | #endif /* CONFIG_PNP */ | 881 | #endif /* CONFIG_PNP */ |
886 | 882 | ||
887 | static int __devinit snd_opl3sa2_nonpnp_probe(struct platform_device *pdev) | 883 | static int __devinit snd_opl3sa2_isa_match(struct device *pdev, |
884 | unsigned int dev) | ||
888 | { | 885 | { |
889 | struct snd_card *card; | 886 | if (!enable[dev]) |
890 | int err; | 887 | return 0; |
891 | int dev = pdev->id; | 888 | #ifdef CONFIG_PNP |
892 | 889 | if (isapnp[dev]) | |
890 | return 0; | ||
891 | #endif | ||
893 | if (port[dev] == SNDRV_AUTO_PORT) { | 892 | if (port[dev] == SNDRV_AUTO_PORT) { |
894 | snd_printk(KERN_ERR PFX "specify port\n"); | 893 | snd_printk(KERN_ERR PFX "specify port\n"); |
895 | return -EINVAL; | 894 | return 0; |
896 | } | 895 | } |
897 | if (wss_port[dev] == SNDRV_AUTO_PORT) { | 896 | if (wss_port[dev] == SNDRV_AUTO_PORT) { |
898 | snd_printk(KERN_ERR PFX "specify wss_port\n"); | 897 | snd_printk(KERN_ERR PFX "specify wss_port\n"); |
899 | return -EINVAL; | 898 | return 0; |
900 | } | 899 | } |
901 | if (fm_port[dev] == SNDRV_AUTO_PORT) { | 900 | if (fm_port[dev] == SNDRV_AUTO_PORT) { |
902 | snd_printk(KERN_ERR PFX "specify fm_port\n"); | 901 | snd_printk(KERN_ERR PFX "specify fm_port\n"); |
903 | return -EINVAL; | 902 | return 0; |
904 | } | 903 | } |
905 | if (midi_port[dev] == SNDRV_AUTO_PORT) { | 904 | if (midi_port[dev] == SNDRV_AUTO_PORT) { |
906 | snd_printk(KERN_ERR PFX "specify midi_port\n"); | 905 | snd_printk(KERN_ERR PFX "specify midi_port\n"); |
907 | return -EINVAL; | 906 | return 0; |
908 | } | 907 | } |
908 | return 1; | ||
909 | } | ||
910 | |||
911 | static int __devinit snd_opl3sa2_isa_probe(struct device *pdev, | ||
912 | unsigned int dev) | ||
913 | { | ||
914 | struct snd_card *card; | ||
915 | int err; | ||
909 | 916 | ||
910 | card = snd_opl3sa2_card_new(dev); | 917 | card = snd_opl3sa2_card_new(dev); |
911 | if (! card) | 918 | if (! card) |
912 | return -ENOMEM; | 919 | return -ENOMEM; |
913 | snd_card_set_dev(card, &pdev->dev); | 920 | snd_card_set_dev(card, pdev); |
914 | if ((err = snd_opl3sa2_probe(card, dev)) < 0) { | 921 | if ((err = snd_opl3sa2_probe(card, dev)) < 0) { |
915 | snd_card_free(card); | 922 | snd_card_free(card); |
916 | return err; | 923 | return err; |
917 | } | 924 | } |
918 | platform_set_drvdata(pdev, card); | 925 | dev_set_drvdata(pdev, card); |
919 | return 0; | 926 | return 0; |
920 | } | 927 | } |
921 | 928 | ||
922 | static int __devexit snd_opl3sa2_nonpnp_remove(struct platform_device *devptr) | 929 | static int __devexit snd_opl3sa2_isa_remove(struct device *devptr, |
930 | unsigned int dev) | ||
923 | { | 931 | { |
924 | snd_card_free(platform_get_drvdata(devptr)); | 932 | snd_card_free(dev_get_drvdata(devptr)); |
925 | platform_set_drvdata(devptr, NULL); | 933 | dev_set_drvdata(devptr, NULL); |
926 | return 0; | 934 | return 0; |
927 | } | 935 | } |
928 | 936 | ||
929 | #ifdef CONFIG_PM | 937 | #ifdef CONFIG_PM |
930 | static int snd_opl3sa2_nonpnp_suspend(struct platform_device *dev, pm_message_t state) | 938 | static int snd_opl3sa2_isa_suspend(struct device *dev, unsigned int n, |
939 | pm_message_t state) | ||
931 | { | 940 | { |
932 | return snd_opl3sa2_suspend(platform_get_drvdata(dev), state); | 941 | return snd_opl3sa2_suspend(dev_get_drvdata(dev), state); |
933 | } | 942 | } |
934 | 943 | ||
935 | static int snd_opl3sa2_nonpnp_resume(struct platform_device *dev) | 944 | static int snd_opl3sa2_isa_resume(struct device *dev, unsigned int n) |
936 | { | 945 | { |
937 | return snd_opl3sa2_resume(platform_get_drvdata(dev)); | 946 | return snd_opl3sa2_resume(dev_get_drvdata(dev)); |
938 | } | 947 | } |
939 | #endif | 948 | #endif |
940 | 949 | ||
941 | #define OPL3SA2_DRIVER "snd_opl3sa2" | 950 | #define OPL3SA2_DRIVER "snd_opl3sa2" |
942 | 951 | ||
943 | static struct platform_driver snd_opl3sa2_nonpnp_driver = { | 952 | static struct isa_driver snd_opl3sa2_isa_driver = { |
944 | .probe = snd_opl3sa2_nonpnp_probe, | 953 | .match = snd_opl3sa2_isa_match, |
945 | .remove = __devexit( snd_opl3sa2_nonpnp_remove), | 954 | .probe = snd_opl3sa2_isa_probe, |
955 | .remove = __devexit( snd_opl3sa2_isa_remove), | ||
946 | #ifdef CONFIG_PM | 956 | #ifdef CONFIG_PM |
947 | .suspend = snd_opl3sa2_nonpnp_suspend, | 957 | .suspend = snd_opl3sa2_isa_suspend, |
948 | .resume = snd_opl3sa2_nonpnp_resume, | 958 | .resume = snd_opl3sa2_isa_resume, |
949 | #endif | 959 | #endif |
950 | .driver = { | 960 | .driver = { |
951 | .name = OPL3SA2_DRIVER | 961 | .name = OPL3SA2_DRIVER |
952 | }, | 962 | }, |
953 | }; | 963 | }; |
954 | 964 | ||
955 | static void __init_or_module snd_opl3sa2_unregister_all(void) | ||
956 | { | ||
957 | int i; | ||
958 | |||
959 | #ifdef CONFIG_PNP | ||
960 | if (pnpc_registered) | ||
961 | pnp_unregister_card_driver(&opl3sa2_pnpc_driver); | ||
962 | if (pnp_registered) | ||
963 | pnp_unregister_driver(&opl3sa2_pnp_driver); | ||
964 | #endif | ||
965 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
966 | platform_device_unregister(platform_devices[i]); | ||
967 | platform_driver_unregister(&snd_opl3sa2_nonpnp_driver); | ||
968 | } | ||
969 | |||
970 | static int __init alsa_card_opl3sa2_init(void) | 965 | static int __init alsa_card_opl3sa2_init(void) |
971 | { | 966 | { |
972 | int i, err; | 967 | int err; |
973 | 968 | ||
974 | if ((err = platform_driver_register(&snd_opl3sa2_nonpnp_driver)) < 0) | 969 | err = isa_register_driver(&snd_opl3sa2_isa_driver, SNDRV_CARDS); |
970 | if (err < 0) | ||
975 | return err; | 971 | return err; |
976 | |||
977 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
978 | struct platform_device *device; | ||
979 | if (! enable[i]) | ||
980 | continue; | ||
981 | #ifdef CONFIG_PNP | ||
982 | if (isapnp[i]) | ||
983 | continue; | ||
984 | #endif | ||
985 | device = platform_device_register_simple(OPL3SA2_DRIVER, | ||
986 | i, NULL, 0); | ||
987 | if (IS_ERR(device)) | ||
988 | continue; | ||
989 | if (!platform_get_drvdata(device)) { | ||
990 | platform_device_unregister(device); | ||
991 | continue; | ||
992 | } | ||
993 | platform_devices[i] = device; | ||
994 | snd_opl3sa2_devices++; | ||
995 | } | ||
996 | |||
997 | #ifdef CONFIG_PNP | 972 | #ifdef CONFIG_PNP |
998 | err = pnp_register_driver(&opl3sa2_pnp_driver); | 973 | err = pnp_register_driver(&opl3sa2_pnp_driver); |
999 | if (!err) | 974 | if (!err) |
@@ -1002,20 +977,18 @@ static int __init alsa_card_opl3sa2_init(void) | |||
1002 | if (!err) | 977 | if (!err) |
1003 | pnpc_registered = 1; | 978 | pnpc_registered = 1; |
1004 | #endif | 979 | #endif |
1005 | |||
1006 | if (!snd_opl3sa2_devices) { | ||
1007 | #ifdef MODULE | ||
1008 | snd_printk(KERN_ERR "Yamaha OPL3-SA soundcard not found or device busy\n"); | ||
1009 | #endif | ||
1010 | snd_opl3sa2_unregister_all(); | ||
1011 | return -ENODEV; | ||
1012 | } | ||
1013 | return 0; | 980 | return 0; |
1014 | } | 981 | } |
1015 | 982 | ||
1016 | static void __exit alsa_card_opl3sa2_exit(void) | 983 | static void __exit alsa_card_opl3sa2_exit(void) |
1017 | { | 984 | { |
1018 | snd_opl3sa2_unregister_all(); | 985 | #ifdef CONFIG_PNP |
986 | if (pnpc_registered) | ||
987 | pnp_unregister_card_driver(&opl3sa2_pnpc_driver); | ||
988 | if (pnp_registered) | ||
989 | pnp_unregister_driver(&opl3sa2_pnp_driver); | ||
990 | #endif | ||
991 | isa_unregister_driver(&snd_opl3sa2_isa_driver); | ||
1019 | } | 992 | } |
1020 | 993 | ||
1021 | module_init(alsa_card_opl3sa2_init) | 994 | module_init(alsa_card_opl3sa2_init) |
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index 1dd98375ac85..33471bdbe269 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <sound/driver.h> | 25 | #include <sound/driver.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/err.h> | 27 | #include <linux/err.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/isa.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/ioport.h> | 31 | #include <linux/ioport.h> |
@@ -139,8 +139,6 @@ static void snd_miro_proc_init(struct snd_miro * miro); | |||
139 | 139 | ||
140 | #define DRIVER_NAME "snd-miro" | 140 | #define DRIVER_NAME "snd-miro" |
141 | 141 | ||
142 | static struct platform_device *device; | ||
143 | |||
144 | static char * snd_opti9xx_names[] = { | 142 | static char * snd_opti9xx_names[] = { |
145 | "unkown", | 143 | "unkown", |
146 | "82C928", "82C929", | 144 | "82C928", "82C929", |
@@ -558,7 +556,7 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol, | |||
558 | return change; | 556 | return change; |
559 | } | 557 | } |
560 | 558 | ||
561 | static struct snd_kcontrol_new snd_miro_controls[] = { | 559 | static struct snd_kcontrol_new snd_miro_controls[] __devinitdata = { |
562 | MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER, ACI_SET_MASTER), | 560 | MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER, ACI_SET_MASTER), |
563 | MIRO_DOUBLE("Mic Playback Volume", 1, ACI_GET_MIC, ACI_SET_MIC), | 561 | MIRO_DOUBLE("Mic Playback Volume", 1, ACI_GET_MIC, ACI_SET_MIC), |
564 | MIRO_DOUBLE("Line Playback Volume", 1, ACI_GET_LINE, ACI_SET_LINE), | 562 | MIRO_DOUBLE("Line Playback Volume", 1, ACI_GET_LINE, ACI_SET_LINE), |
@@ -570,7 +568,7 @@ MIRO_DOUBLE("Aux Playback Volume", 2, ACI_GET_LINE2, ACI_SET_LINE2), | |||
570 | 568 | ||
571 | /* Equalizer with seven bands (only PCM20) | 569 | /* Equalizer with seven bands (only PCM20) |
572 | from -12dB up to +12dB on each band */ | 570 | from -12dB up to +12dB on each band */ |
573 | static struct snd_kcontrol_new snd_miro_eq_controls[] = { | 571 | static struct snd_kcontrol_new snd_miro_eq_controls[] __devinitdata = { |
574 | MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1, ACI_SET_EQ1), | 572 | MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1, ACI_SET_EQ1), |
575 | MIRO_DOUBLE("Tone Control - 160 Hz", 0, ACI_GET_EQ2, ACI_SET_EQ2), | 573 | MIRO_DOUBLE("Tone Control - 160 Hz", 0, ACI_GET_EQ2, ACI_SET_EQ2), |
576 | MIRO_DOUBLE("Tone Control - 400 Hz", 0, ACI_GET_EQ3, ACI_SET_EQ3), | 574 | MIRO_DOUBLE("Tone Control - 400 Hz", 0, ACI_GET_EQ3, ACI_SET_EQ3), |
@@ -580,15 +578,15 @@ MIRO_DOUBLE("Tone Control - 6.3 kHz", 0, ACI_GET_EQ6, ACI_SET_EQ6), | |||
580 | MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7), | 578 | MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7), |
581 | }; | 579 | }; |
582 | 580 | ||
583 | static struct snd_kcontrol_new snd_miro_radio_control[] = { | 581 | static struct snd_kcontrol_new snd_miro_radio_control[] __devinitdata = { |
584 | MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1), | 582 | MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1), |
585 | }; | 583 | }; |
586 | 584 | ||
587 | static struct snd_kcontrol_new snd_miro_line_control[] = { | 585 | static struct snd_kcontrol_new snd_miro_line_control[] __devinitdata = { |
588 | MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1), | 586 | MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1), |
589 | }; | 587 | }; |
590 | 588 | ||
591 | static struct snd_kcontrol_new snd_miro_preamp_control[] = { | 589 | static struct snd_kcontrol_new snd_miro_preamp_control[] __devinitdata = { |
592 | { | 590 | { |
593 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 591 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
594 | .name = "Mic Boost", | 592 | .name = "Mic Boost", |
@@ -598,7 +596,7 @@ static struct snd_kcontrol_new snd_miro_preamp_control[] = { | |||
598 | .put = snd_miro_put_preamp, | 596 | .put = snd_miro_put_preamp, |
599 | }}; | 597 | }}; |
600 | 598 | ||
601 | static struct snd_kcontrol_new snd_miro_amp_control[] = { | 599 | static struct snd_kcontrol_new snd_miro_amp_control[] __devinitdata = { |
602 | { | 600 | { |
603 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 601 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
604 | .name = "Line Boost", | 602 | .name = "Line Boost", |
@@ -608,7 +606,7 @@ static struct snd_kcontrol_new snd_miro_amp_control[] = { | |||
608 | .put = snd_miro_put_amp, | 606 | .put = snd_miro_put_amp, |
609 | }}; | 607 | }}; |
610 | 608 | ||
611 | static struct snd_kcontrol_new snd_miro_capture_control[] = { | 609 | static struct snd_kcontrol_new snd_miro_capture_control[] __devinitdata = { |
612 | { | 610 | { |
613 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 611 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
614 | .name = "PCM Capture Switch", | 612 | .name = "PCM Capture Switch", |
@@ -618,7 +616,7 @@ static struct snd_kcontrol_new snd_miro_capture_control[] = { | |||
618 | .put = snd_miro_put_capture, | 616 | .put = snd_miro_put_capture, |
619 | }}; | 617 | }}; |
620 | 618 | ||
621 | static unsigned char aci_init_values[][2] __initdata = { | 619 | static unsigned char aci_init_values[][2] __devinitdata = { |
622 | { ACI_SET_MUTE, 0x00 }, | 620 | { ACI_SET_MUTE, 0x00 }, |
623 | { ACI_SET_POWERAMP, 0x00 }, | 621 | { ACI_SET_POWERAMP, 0x00 }, |
624 | { ACI_SET_PREAMP, 0x00 }, | 622 | { ACI_SET_PREAMP, 0x00 }, |
@@ -641,7 +639,7 @@ static unsigned char aci_init_values[][2] __initdata = { | |||
641 | { ACI_SET_MASTER + 1, 0x20 }, | 639 | { ACI_SET_MASTER + 1, 0x20 }, |
642 | }; | 640 | }; |
643 | 641 | ||
644 | static int __init snd_set_aci_init_values(struct snd_miro *miro) | 642 | static int __devinit snd_set_aci_init_values(struct snd_miro *miro) |
645 | { | 643 | { |
646 | int idx, error; | 644 | int idx, error; |
647 | 645 | ||
@@ -751,7 +749,8 @@ static long snd_legacy_find_free_ioport(long *port_table, long size) | |||
751 | return -1; | 749 | return -1; |
752 | } | 750 | } |
753 | 751 | ||
754 | static int __init snd_miro_init(struct snd_miro *chip, unsigned short hardware) | 752 | static int __devinit snd_miro_init(struct snd_miro *chip, |
753 | unsigned short hardware) | ||
755 | { | 754 | { |
756 | static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; | 755 | static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; |
757 | 756 | ||
@@ -962,7 +961,7 @@ static void snd_miro_proc_read(struct snd_info_entry * entry, | |||
962 | snd_iprintf(buffer, " preamp : 0x%x\n", miro->aci_preamp); | 961 | snd_iprintf(buffer, " preamp : 0x%x\n", miro->aci_preamp); |
963 | } | 962 | } |
964 | 963 | ||
965 | static void __init snd_miro_proc_init(struct snd_miro * miro) | 964 | static void __devinit snd_miro_proc_init(struct snd_miro * miro) |
966 | { | 965 | { |
967 | struct snd_info_entry *entry; | 966 | struct snd_info_entry *entry; |
968 | 967 | ||
@@ -974,7 +973,7 @@ static void __init snd_miro_proc_init(struct snd_miro * miro) | |||
974 | * Init | 973 | * Init |
975 | */ | 974 | */ |
976 | 975 | ||
977 | static int __init snd_miro_configure(struct snd_miro *chip) | 976 | static int __devinit snd_miro_configure(struct snd_miro *chip) |
978 | { | 977 | { |
979 | unsigned char wss_base_bits; | 978 | unsigned char wss_base_bits; |
980 | unsigned char irq_bits; | 979 | unsigned char irq_bits; |
@@ -1131,7 +1130,8 @@ __skip_mpu: | |||
1131 | return 0; | 1130 | return 0; |
1132 | } | 1131 | } |
1133 | 1132 | ||
1134 | static int __init snd_card_miro_detect(struct snd_card *card, struct snd_miro *chip) | 1133 | static int __devinit snd_card_miro_detect(struct snd_card *card, |
1134 | struct snd_miro *chip) | ||
1135 | { | 1135 | { |
1136 | int i, err; | 1136 | int i, err; |
1137 | unsigned char value; | 1137 | unsigned char value; |
@@ -1157,7 +1157,8 @@ static int __init snd_card_miro_detect(struct snd_card *card, struct snd_miro *c | |||
1157 | return -ENODEV; | 1157 | return -ENODEV; |
1158 | } | 1158 | } |
1159 | 1159 | ||
1160 | static int __init snd_card_miro_aci_detect(struct snd_card *card, struct snd_miro * miro) | 1160 | static int __devinit snd_card_miro_aci_detect(struct snd_card *card, |
1161 | struct snd_miro * miro) | ||
1161 | { | 1162 | { |
1162 | unsigned char regval; | 1163 | unsigned char regval; |
1163 | int i; | 1164 | int i; |
@@ -1213,7 +1214,12 @@ static void snd_card_miro_free(struct snd_card *card) | |||
1213 | release_and_free_resource(miro->res_mc_base); | 1214 | release_and_free_resource(miro->res_mc_base); |
1214 | } | 1215 | } |
1215 | 1216 | ||
1216 | static int __init snd_miro_probe(struct platform_device *devptr) | 1217 | static int __devinit snd_miro_match(struct device *devptr, unsigned int n) |
1218 | { | ||
1219 | return 1; | ||
1220 | } | ||
1221 | |||
1222 | static int __devinit snd_miro_probe(struct device *devptr, unsigned int n) | ||
1217 | { | 1223 | { |
1218 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; | 1224 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; |
1219 | static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; | 1225 | static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; |
@@ -1399,25 +1405,26 @@ static int __init snd_miro_probe(struct platform_device *devptr) | |||
1399 | return error; | 1405 | return error; |
1400 | } | 1406 | } |
1401 | 1407 | ||
1402 | snd_card_set_dev(card, &devptr->dev); | 1408 | snd_card_set_dev(card, devptr); |
1403 | 1409 | ||
1404 | if ((error = snd_card_register(card))) { | 1410 | if ((error = snd_card_register(card))) { |
1405 | snd_card_free(card); | 1411 | snd_card_free(card); |
1406 | return error; | 1412 | return error; |
1407 | } | 1413 | } |
1408 | 1414 | ||
1409 | platform_set_drvdata(devptr, card); | 1415 | dev_set_drvdata(devptr, card); |
1410 | return 0; | 1416 | return 0; |
1411 | } | 1417 | } |
1412 | 1418 | ||
1413 | static int __devexit snd_miro_remove(struct platform_device *devptr) | 1419 | static int __devexit snd_miro_remove(struct device *devptr, unsigned int dev) |
1414 | { | 1420 | { |
1415 | snd_card_free(platform_get_drvdata(devptr)); | 1421 | snd_card_free(dev_get_drvdata(devptr)); |
1416 | platform_set_drvdata(devptr, NULL); | 1422 | dev_set_drvdata(devptr, NULL); |
1417 | return 0; | 1423 | return 0; |
1418 | } | 1424 | } |
1419 | 1425 | ||
1420 | static struct platform_driver snd_miro_driver = { | 1426 | static struct isa_driver snd_miro_driver = { |
1427 | .match = snd_miro_match, | ||
1421 | .probe = snd_miro_probe, | 1428 | .probe = snd_miro_probe, |
1422 | .remove = __devexit_p(snd_miro_remove), | 1429 | .remove = __devexit_p(snd_miro_remove), |
1423 | /* FIXME: suspend/resume */ | 1430 | /* FIXME: suspend/resume */ |
@@ -1428,27 +1435,12 @@ static struct platform_driver snd_miro_driver = { | |||
1428 | 1435 | ||
1429 | static int __init alsa_card_miro_init(void) | 1436 | static int __init alsa_card_miro_init(void) |
1430 | { | 1437 | { |
1431 | int error; | 1438 | return isa_register_driver(&snd_miro_driver, 1); |
1432 | |||
1433 | if ((error = platform_driver_register(&snd_miro_driver)) < 0) | ||
1434 | return error; | ||
1435 | device = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0); | ||
1436 | if (! IS_ERR(device)) { | ||
1437 | if (platform_get_drvdata(device)) | ||
1438 | return 0; | ||
1439 | platform_device_unregister(device); | ||
1440 | } | ||
1441 | #ifdef MODULE | ||
1442 | printk(KERN_ERR "no miro soundcard found\n"); | ||
1443 | #endif | ||
1444 | platform_driver_unregister(&snd_miro_driver); | ||
1445 | return PTR_ERR(device); | ||
1446 | } | 1439 | } |
1447 | 1440 | ||
1448 | static void __exit alsa_card_miro_exit(void) | 1441 | static void __exit alsa_card_miro_exit(void) |
1449 | { | 1442 | { |
1450 | platform_device_unregister(device); | 1443 | isa_unregister_driver(&snd_miro_driver); |
1451 | platform_driver_unregister(&snd_miro_driver); | ||
1452 | } | 1444 | } |
1453 | 1445 | ||
1454 | module_init(alsa_card_miro_init) | 1446 | module_init(alsa_card_miro_init) |
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index df227377c333..1c390580bd50 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <sound/driver.h> | 26 | #include <sound/driver.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | #include <linux/platform_device.h> | 29 | #include <linux/isa.h> |
30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/pnp.h> | 32 | #include <linux/pnp.h> |
@@ -259,7 +259,6 @@ struct snd_opti9xx { | |||
259 | }; | 259 | }; |
260 | 260 | ||
261 | static int snd_opti9xx_pnp_is_probed; | 261 | static int snd_opti9xx_pnp_is_probed; |
262 | static struct platform_device *snd_opti9xx_platform_device; | ||
263 | 262 | ||
264 | #ifdef CONFIG_PNP | 263 | #ifdef CONFIG_PNP |
265 | 264 | ||
@@ -294,7 +293,7 @@ static char * snd_opti9xx_names[] = { | |||
294 | }; | 293 | }; |
295 | 294 | ||
296 | 295 | ||
297 | static long __init snd_legacy_find_free_ioport(long *port_table, long size) | 296 | static long __devinit snd_legacy_find_free_ioport(long *port_table, long size) |
298 | { | 297 | { |
299 | while (*port_table != -1) { | 298 | while (*port_table != -1) { |
300 | if (request_region(*port_table, size, "ALSA test")) { | 299 | if (request_region(*port_table, size, "ALSA test")) { |
@@ -306,7 +305,8 @@ static long __init snd_legacy_find_free_ioport(long *port_table, long size) | |||
306 | return -1; | 305 | return -1; |
307 | } | 306 | } |
308 | 307 | ||
309 | static int __init snd_opti9xx_init(struct snd_opti9xx *chip, unsigned short hardware) | 308 | static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, |
309 | unsigned short hardware) | ||
310 | { | 310 | { |
311 | static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; | 311 | static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; |
312 | 312 | ||
@@ -451,7 +451,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, | |||
451 | (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask))) | 451 | (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask))) |
452 | 452 | ||
453 | 453 | ||
454 | static int __init snd_opti9xx_configure(struct snd_opti9xx *chip) | 454 | static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) |
455 | { | 455 | { |
456 | unsigned char wss_base_bits; | 456 | unsigned char wss_base_bits; |
457 | unsigned char irq_bits; | 457 | unsigned char irq_bits; |
@@ -1561,7 +1561,7 @@ static int snd_opti93x_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
1561 | return change; | 1561 | return change; |
1562 | } | 1562 | } |
1563 | 1563 | ||
1564 | static struct snd_kcontrol_new snd_opti93x_controls[] = { | 1564 | static struct snd_kcontrol_new snd_opti93x_controls[] __devinitdata = { |
1565 | OPTi93X_DOUBLE("Master Playback Switch", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), | 1565 | OPTi93X_DOUBLE("Master Playback Switch", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), |
1566 | OPTi93X_DOUBLE("Master Playback Volume", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), | 1566 | OPTi93X_DOUBLE("Master Playback Volume", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), |
1567 | OPTi93X_DOUBLE("PCM Playback Switch", 0, OPTi93X_DAC_LEFT, OPTi93X_DAC_RIGHT, 7, 7, 1, 1), | 1567 | OPTi93X_DOUBLE("PCM Playback Switch", 0, OPTi93X_DAC_LEFT, OPTi93X_DAC_RIGHT, 7, 7, 1, 1), |
@@ -1622,7 +1622,8 @@ static int snd_opti93x_mixer(struct snd_opti93x *chip) | |||
1622 | 1622 | ||
1623 | #endif /* OPTi93X */ | 1623 | #endif /* OPTi93X */ |
1624 | 1624 | ||
1625 | static int __init snd_card_opti9xx_detect(struct snd_card *card, struct snd_opti9xx *chip) | 1625 | static int __devinit snd_card_opti9xx_detect(struct snd_card *card, |
1626 | struct snd_opti9xx *chip) | ||
1626 | { | 1627 | { |
1627 | int i, err; | 1628 | int i, err; |
1628 | 1629 | ||
@@ -1676,8 +1677,9 @@ static int __init snd_card_opti9xx_detect(struct snd_card *card, struct snd_opti | |||
1676 | } | 1677 | } |
1677 | 1678 | ||
1678 | #ifdef CONFIG_PNP | 1679 | #ifdef CONFIG_PNP |
1679 | static int __init snd_card_opti9xx_pnp(struct snd_opti9xx *chip, struct pnp_card_link *card, | 1680 | static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, |
1680 | const struct pnp_card_device_id *pid) | 1681 | struct pnp_card_link *card, |
1682 | const struct pnp_card_device_id *pid) | ||
1681 | { | 1683 | { |
1682 | struct pnp_dev *pdev; | 1684 | struct pnp_dev *pdev; |
1683 | struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); | 1685 | struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); |
@@ -1778,7 +1780,7 @@ static void snd_card_opti9xx_free(struct snd_card *card) | |||
1778 | release_and_free_resource(chip->res_mc_base); | 1780 | release_and_free_resource(chip->res_mc_base); |
1779 | } | 1781 | } |
1780 | 1782 | ||
1781 | static int __init snd_opti9xx_probe(struct snd_card *card) | 1783 | static int __devinit snd_opti9xx_probe(struct snd_card *card) |
1782 | { | 1784 | { |
1783 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; | 1785 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; |
1784 | int error; | 1786 | int error; |
@@ -1924,7 +1926,18 @@ static struct snd_card *snd_opti9xx_card_new(void) | |||
1924 | return card; | 1926 | return card; |
1925 | } | 1927 | } |
1926 | 1928 | ||
1927 | static int __init snd_opti9xx_nonpnp_probe(struct platform_device *devptr) | 1929 | static int __devinit snd_opti9xx_isa_match(struct device *devptr, |
1930 | unsigned int dev) | ||
1931 | { | ||
1932 | if (snd_opti9xx_pnp_is_probed) | ||
1933 | return 0; | ||
1934 | if (isapnp) | ||
1935 | return 0; | ||
1936 | return 1; | ||
1937 | } | ||
1938 | |||
1939 | static int __devinit snd_opti9xx_isa_probe(struct device *devptr, | ||
1940 | unsigned int dev) | ||
1928 | { | 1941 | { |
1929 | struct snd_card *card; | 1942 | struct snd_card *card; |
1930 | int error; | 1943 | int error; |
@@ -1940,9 +1953,6 @@ static int __init snd_opti9xx_nonpnp_probe(struct platform_device *devptr) | |||
1940 | static int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}}; | 1953 | static int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}}; |
1941 | #endif /* CS4231 || OPTi93X */ | 1954 | #endif /* CS4231 || OPTi93X */ |
1942 | 1955 | ||
1943 | if (snd_opti9xx_pnp_is_probed) | ||
1944 | return -EBUSY; | ||
1945 | |||
1946 | if (mpu_port == SNDRV_AUTO_PORT) { | 1956 | if (mpu_port == SNDRV_AUTO_PORT) { |
1947 | if ((mpu_port = snd_legacy_find_free_ioport(possible_mpu_ports, 2)) < 0) { | 1957 | if ((mpu_port = snd_legacy_find_free_ioport(possible_mpu_ports, 2)) < 0) { |
1948 | snd_printk(KERN_ERR "unable to find a free MPU401 port\n"); | 1958 | snd_printk(KERN_ERR "unable to find a free MPU401 port\n"); |
@@ -1984,25 +1994,27 @@ static int __init snd_opti9xx_nonpnp_probe(struct platform_device *devptr) | |||
1984 | snd_card_free(card); | 1994 | snd_card_free(card); |
1985 | return error; | 1995 | return error; |
1986 | } | 1996 | } |
1987 | snd_card_set_dev(card, &devptr->dev); | 1997 | snd_card_set_dev(card, devptr); |
1988 | if ((error = snd_opti9xx_probe(card)) < 0) { | 1998 | if ((error = snd_opti9xx_probe(card)) < 0) { |
1989 | snd_card_free(card); | 1999 | snd_card_free(card); |
1990 | return error; | 2000 | return error; |
1991 | } | 2001 | } |
1992 | platform_set_drvdata(devptr, card); | 2002 | dev_set_drvdata(devptr, card); |
1993 | return 0; | 2003 | return 0; |
1994 | } | 2004 | } |
1995 | 2005 | ||
1996 | static int __devexit snd_opti9xx_nonpnp_remove(struct platform_device *devptr) | 2006 | static int __devexit snd_opti9xx_isa_remove(struct device *devptr, |
2007 | unsigned int dev) | ||
1997 | { | 2008 | { |
1998 | snd_card_free(platform_get_drvdata(devptr)); | 2009 | snd_card_free(dev_get_drvdata(devptr)); |
1999 | platform_set_drvdata(devptr, NULL); | 2010 | dev_set_drvdata(devptr, NULL); |
2000 | return 0; | 2011 | return 0; |
2001 | } | 2012 | } |
2002 | 2013 | ||
2003 | static struct platform_driver snd_opti9xx_driver = { | 2014 | static struct isa_driver snd_opti9xx_driver = { |
2004 | .probe = snd_opti9xx_nonpnp_probe, | 2015 | .match = snd_opti9xx_isa_match, |
2005 | .remove = __devexit_p(snd_opti9xx_nonpnp_remove), | 2016 | .probe = snd_opti9xx_isa_probe, |
2017 | .remove = __devexit_p(snd_opti9xx_isa_remove), | ||
2006 | /* FIXME: suspend/resume */ | 2018 | /* FIXME: suspend/resume */ |
2007 | .driver = { | 2019 | .driver = { |
2008 | .name = DRIVER_NAME | 2020 | .name = DRIVER_NAME |
@@ -2010,8 +2022,8 @@ static struct platform_driver snd_opti9xx_driver = { | |||
2010 | }; | 2022 | }; |
2011 | 2023 | ||
2012 | #ifdef CONFIG_PNP | 2024 | #ifdef CONFIG_PNP |
2013 | static int __init snd_opti9xx_pnp_probe(struct pnp_card_link *pcard, | 2025 | static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard, |
2014 | const struct pnp_card_device_id *pid) | 2026 | const struct pnp_card_device_id *pid) |
2015 | { | 2027 | { |
2016 | struct snd_card *card; | 2028 | struct snd_card *card; |
2017 | int error, hw; | 2029 | int error, hw; |
@@ -2074,11 +2086,6 @@ static struct pnp_card_driver opti9xx_pnpc_driver = { | |||
2074 | }; | 2086 | }; |
2075 | #endif | 2087 | #endif |
2076 | 2088 | ||
2077 | #ifdef CONFIG_PNP | ||
2078 | #define is_isapnp_selected() isapnp | ||
2079 | #else | ||
2080 | #define is_isapnp_selected() 0 | ||
2081 | #endif | ||
2082 | #ifdef OPTi93X | 2089 | #ifdef OPTi93X |
2083 | #define CHIP_NAME "82C93x" | 2090 | #define CHIP_NAME "82C93x" |
2084 | #else | 2091 | #else |
@@ -2087,42 +2094,19 @@ static struct pnp_card_driver opti9xx_pnpc_driver = { | |||
2087 | 2094 | ||
2088 | static int __init alsa_card_opti9xx_init(void) | 2095 | static int __init alsa_card_opti9xx_init(void) |
2089 | { | 2096 | { |
2090 | int error; | ||
2091 | struct platform_device *device; | ||
2092 | |||
2093 | #ifdef CONFIG_PNP | 2097 | #ifdef CONFIG_PNP |
2094 | pnp_register_card_driver(&opti9xx_pnpc_driver); | 2098 | pnp_register_card_driver(&opti9xx_pnpc_driver); |
2095 | if (snd_opti9xx_pnp_is_probed) | 2099 | if (snd_opti9xx_pnp_is_probed) |
2096 | return 0; | 2100 | return 0; |
2097 | #endif | 2101 | #endif |
2098 | if (! is_isapnp_selected()) { | 2102 | return isa_register_driver(&snd_opti9xx_driver, 1); |
2099 | error = platform_driver_register(&snd_opti9xx_driver); | ||
2100 | if (error < 0) | ||
2101 | return error; | ||
2102 | device = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0); | ||
2103 | if (!IS_ERR(device)) { | ||
2104 | if (platform_get_drvdata(device)) { | ||
2105 | snd_opti9xx_platform_device = device; | ||
2106 | return 0; | ||
2107 | } | ||
2108 | platform_device_unregister(device); | ||
2109 | } | ||
2110 | platform_driver_unregister(&snd_opti9xx_driver); | ||
2111 | } | ||
2112 | #ifdef CONFIG_PNP | ||
2113 | pnp_unregister_card_driver(&opti9xx_pnpc_driver); | ||
2114 | #endif | ||
2115 | #ifdef MODULE | ||
2116 | printk(KERN_ERR "no OPTi " CHIP_NAME " soundcard found\n"); | ||
2117 | #endif | ||
2118 | return -ENODEV; | ||
2119 | } | 2103 | } |
2120 | 2104 | ||
2121 | static void __exit alsa_card_opti9xx_exit(void) | 2105 | static void __exit alsa_card_opti9xx_exit(void) |
2122 | { | 2106 | { |
2123 | if (!snd_opti9xx_pnp_is_probed) { | 2107 | if (!snd_opti9xx_pnp_is_probed) { |
2124 | platform_device_unregister(snd_opti9xx_platform_device); | 2108 | isa_unregister_driver(&snd_opti9xx_driver); |
2125 | platform_driver_unregister(&snd_opti9xx_driver); | 2109 | return; |
2126 | } | 2110 | } |
2127 | #ifdef CONFIG_PNP | 2111 | #ifdef CONFIG_PNP |
2128 | pnp_unregister_card_driver(&opti9xx_pnpc_driver); | 2112 | pnp_unregister_card_driver(&opti9xx_pnpc_driver); |
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index d64e67f2bafa..8b734a239008 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/pnp.h> | 26 | #include <linux/pnp.h> |
27 | #include <linux/err.h> | 27 | #include <linux/err.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/isa.h> |
29 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
30 | #include <sound/core.h> | 30 | #include <sound/core.h> |
31 | #include <sound/sb.h> | 31 | #include <sound/sb.h> |
@@ -128,7 +128,6 @@ module_param_array(seq_ports, int, NULL, 0444); | |||
128 | MODULE_PARM_DESC(seq_ports, "Number of sequencer ports for WaveTable synth."); | 128 | MODULE_PARM_DESC(seq_ports, "Number of sequencer ports for WaveTable synth."); |
129 | #endif | 129 | #endif |
130 | 130 | ||
131 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
132 | #ifdef CONFIG_PNP | 131 | #ifdef CONFIG_PNP |
133 | static int pnp_registered; | 132 | static int pnp_registered; |
134 | #endif | 133 | #endif |
@@ -519,7 +518,7 @@ static int snd_sb16_resume(struct snd_card *card) | |||
519 | } | 518 | } |
520 | #endif | 519 | #endif |
521 | 520 | ||
522 | static int __devinit snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr) | 521 | static int __devinit snd_sb16_isa_probe1(int dev, struct device *pdev) |
523 | { | 522 | { |
524 | struct snd_card_sb16 *acard; | 523 | struct snd_card_sb16 *acard; |
525 | struct snd_card *card; | 524 | struct snd_card *card; |
@@ -539,19 +538,23 @@ static int __devinit snd_sb16_nonpnp_probe1(int dev, struct platform_device *dev | |||
539 | awe_port[dev] = port[dev] + 0x400; | 538 | awe_port[dev] = port[dev] + 0x400; |
540 | #endif | 539 | #endif |
541 | 540 | ||
542 | snd_card_set_dev(card, &devptr->dev); | 541 | snd_card_set_dev(card, pdev); |
543 | if ((err = snd_sb16_probe(card, dev)) < 0) { | 542 | if ((err = snd_sb16_probe(card, dev)) < 0) { |
544 | snd_card_free(card); | 543 | snd_card_free(card); |
545 | return err; | 544 | return err; |
546 | } | 545 | } |
547 | platform_set_drvdata(devptr, card); | 546 | dev_set_drvdata(pdev, card); |
548 | return 0; | 547 | return 0; |
549 | } | 548 | } |
550 | 549 | ||
551 | 550 | ||
552 | static int __devinit snd_sb16_nonpnp_probe(struct platform_device *pdev) | 551 | static int __devinit snd_sb16_isa_match(struct device *pdev, unsigned int dev) |
552 | { | ||
553 | return enable[dev] && !is_isapnp_selected(dev); | ||
554 | } | ||
555 | |||
556 | static int __devinit snd_sb16_isa_probe(struct device *pdev, unsigned int dev) | ||
553 | { | 557 | { |
554 | int dev = pdev->id; | ||
555 | int err; | 558 | int err; |
556 | static int possible_irqs[] = {5, 9, 10, 7, -1}; | 559 | static int possible_irqs[] = {5, 9, 10, 7, -1}; |
557 | static int possible_dmas8[] = {1, 3, 0, -1}; | 560 | static int possible_dmas8[] = {1, 3, 0, -1}; |
@@ -577,13 +580,13 @@ static int __devinit snd_sb16_nonpnp_probe(struct platform_device *pdev) | |||
577 | } | 580 | } |
578 | 581 | ||
579 | if (port[dev] != SNDRV_AUTO_PORT) | 582 | if (port[dev] != SNDRV_AUTO_PORT) |
580 | return snd_sb16_nonpnp_probe1(dev, pdev); | 583 | return snd_sb16_isa_probe1(dev, pdev); |
581 | else { | 584 | else { |
582 | static int possible_ports[] = {0x220, 0x240, 0x260, 0x280}; | 585 | static int possible_ports[] = {0x220, 0x240, 0x260, 0x280}; |
583 | int i; | 586 | int i; |
584 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { | 587 | for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { |
585 | port[dev] = possible_ports[i]; | 588 | port[dev] = possible_ports[i]; |
586 | err = snd_sb16_nonpnp_probe1(dev, pdev); | 589 | err = snd_sb16_isa_probe1(dev, pdev); |
587 | if (! err) | 590 | if (! err) |
588 | return 0; | 591 | return 0; |
589 | } | 592 | } |
@@ -591,22 +594,23 @@ static int __devinit snd_sb16_nonpnp_probe(struct platform_device *pdev) | |||
591 | } | 594 | } |
592 | } | 595 | } |
593 | 596 | ||
594 | static int __devexit snd_sb16_nonpnp_remove(struct platform_device *devptr) | 597 | static int __devexit snd_sb16_isa_remove(struct device *pdev, unsigned int dev) |
595 | { | 598 | { |
596 | snd_card_free(platform_get_drvdata(devptr)); | 599 | snd_card_free(dev_get_drvdata(pdev)); |
597 | platform_set_drvdata(devptr, NULL); | 600 | dev_set_drvdata(pdev, NULL); |
598 | return 0; | 601 | return 0; |
599 | } | 602 | } |
600 | 603 | ||
601 | #ifdef CONFIG_PM | 604 | #ifdef CONFIG_PM |
602 | static int snd_sb16_nonpnp_suspend(struct platform_device *dev, pm_message_t state) | 605 | static int snd_sb16_isa_suspend(struct device *dev, unsigned int n, |
606 | pm_message_t state) | ||
603 | { | 607 | { |
604 | return snd_sb16_suspend(platform_get_drvdata(dev), state); | 608 | return snd_sb16_suspend(dev_get_drvdata(dev), state); |
605 | } | 609 | } |
606 | 610 | ||
607 | static int snd_sb16_nonpnp_resume(struct platform_device *dev) | 611 | static int snd_sb16_isa_resume(struct device *dev, unsigned int n) |
608 | { | 612 | { |
609 | return snd_sb16_resume(platform_get_drvdata(dev)); | 613 | return snd_sb16_resume(dev_get_drvdata(dev)); |
610 | } | 614 | } |
611 | #endif | 615 | #endif |
612 | 616 | ||
@@ -616,12 +620,13 @@ static int snd_sb16_nonpnp_resume(struct platform_device *dev) | |||
616 | #define SND_SB16_DRIVER "snd_sb16" | 620 | #define SND_SB16_DRIVER "snd_sb16" |
617 | #endif | 621 | #endif |
618 | 622 | ||
619 | static struct platform_driver snd_sb16_nonpnp_driver = { | 623 | static struct isa_driver snd_sb16_isa_driver = { |
620 | .probe = snd_sb16_nonpnp_probe, | 624 | .match = snd_sb16_isa_match, |
621 | .remove = __devexit_p(snd_sb16_nonpnp_remove), | 625 | .probe = snd_sb16_isa_probe, |
626 | .remove = __devexit_p(snd_sb16_isa_remove), | ||
622 | #ifdef CONFIG_PM | 627 | #ifdef CONFIG_PM |
623 | .suspend = snd_sb16_nonpnp_suspend, | 628 | .suspend = snd_sb16_isa_suspend, |
624 | .resume = snd_sb16_nonpnp_resume, | 629 | .resume = snd_sb16_isa_resume, |
625 | #endif | 630 | #endif |
626 | .driver = { | 631 | .driver = { |
627 | .name = SND_SB16_DRIVER | 632 | .name = SND_SB16_DRIVER |
@@ -630,8 +635,6 @@ static struct platform_driver snd_sb16_nonpnp_driver = { | |||
630 | 635 | ||
631 | 636 | ||
632 | #ifdef CONFIG_PNP | 637 | #ifdef CONFIG_PNP |
633 | static unsigned int __devinitdata sb16_pnp_devices; | ||
634 | |||
635 | static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, | 638 | static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, |
636 | const struct pnp_card_device_id *pid) | 639 | const struct pnp_card_device_id *pid) |
637 | { | 640 | { |
@@ -653,7 +656,6 @@ static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, | |||
653 | } | 656 | } |
654 | pnp_set_card_drvdata(pcard, card); | 657 | pnp_set_card_drvdata(pcard, card); |
655 | dev++; | 658 | dev++; |
656 | sb16_pnp_devices++; | ||
657 | return 0; | 659 | return 0; |
658 | } | 660 | } |
659 | 661 | ||
@@ -695,68 +697,29 @@ static struct pnp_card_driver sb16_pnpc_driver = { | |||
695 | 697 | ||
696 | #endif /* CONFIG_PNP */ | 698 | #endif /* CONFIG_PNP */ |
697 | 699 | ||
698 | static void __init_or_module snd_sb16_unregister_all(void) | ||
699 | { | ||
700 | int i; | ||
701 | |||
702 | #ifdef CONFIG_PNP | ||
703 | if (pnp_registered) | ||
704 | pnp_unregister_card_driver(&sb16_pnpc_driver); | ||
705 | #endif | ||
706 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
707 | platform_device_unregister(platform_devices[i]); | ||
708 | platform_driver_unregister(&snd_sb16_nonpnp_driver); | ||
709 | } | ||
710 | |||
711 | static int __init alsa_card_sb16_init(void) | 700 | static int __init alsa_card_sb16_init(void) |
712 | { | 701 | { |
713 | int i, err, cards = 0; | 702 | int err; |
714 | 703 | ||
715 | if ((err = platform_driver_register(&snd_sb16_nonpnp_driver)) < 0) | 704 | err = isa_register_driver(&snd_sb16_isa_driver, SNDRV_CARDS); |
705 | if (err < 0) | ||
716 | return err; | 706 | return err; |
717 | |||
718 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
719 | struct platform_device *device; | ||
720 | if (! enable[i] || is_isapnp_selected(i)) | ||
721 | continue; | ||
722 | device = platform_device_register_simple(SND_SB16_DRIVER, | ||
723 | i, NULL, 0); | ||
724 | if (IS_ERR(device)) | ||
725 | continue; | ||
726 | if (!platform_get_drvdata(device)) { | ||
727 | platform_device_unregister(device); | ||
728 | continue; | ||
729 | } | ||
730 | platform_devices[i] = device; | ||
731 | cards++; | ||
732 | } | ||
733 | #ifdef CONFIG_PNP | 707 | #ifdef CONFIG_PNP |
734 | /* PnP cards at last */ | 708 | /* PnP cards at last */ |
735 | err = pnp_register_card_driver(&sb16_pnpc_driver); | 709 | err = pnp_register_card_driver(&sb16_pnpc_driver); |
736 | if (!err) { | 710 | if (!err) |
737 | pnp_registered = 1; | 711 | pnp_registered = 1; |
738 | cards += sb16_pnp_devices; | ||
739 | } | ||
740 | #endif | ||
741 | |||
742 | if (!cards) { | ||
743 | #ifdef MODULE | ||
744 | snd_printk(KERN_ERR "Sound Blaster 16 soundcard not found or device busy\n"); | ||
745 | #ifdef SNDRV_SBAWE_EMU8000 | ||
746 | snd_printk(KERN_ERR "In case, if you have non-AWE card, try snd-sb16 module\n"); | ||
747 | #else | ||
748 | snd_printk(KERN_ERR "In case, if you have AWE card, try snd-sbawe module\n"); | ||
749 | #endif | 712 | #endif |
750 | #endif | ||
751 | snd_sb16_unregister_all(); | ||
752 | return -ENODEV; | ||
753 | } | ||
754 | return 0; | 713 | return 0; |
755 | } | 714 | } |
756 | 715 | ||
757 | static void __exit alsa_card_sb16_exit(void) | 716 | static void __exit alsa_card_sb16_exit(void) |
758 | { | 717 | { |
759 | snd_sb16_unregister_all(); | 718 | #ifdef CONFIG_PNP |
719 | if (pnp_registered) | ||
720 | pnp_unregister_card_driver(&sb16_pnpc_driver); | ||
721 | #endif | ||
722 | isa_unregister_driver(&snd_sb16_isa_driver); | ||
760 | } | 723 | } |
761 | 724 | ||
762 | module_init(alsa_card_sb16_init) | 725 | module_init(alsa_card_sb16_init) |
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index be1e83e6dea3..b7de1bc0e8a4 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <sound/driver.h> | 22 | #include <sound/driver.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/isa.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/ioport.h> | 27 | #include <linux/ioport.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
@@ -56,8 +56,6 @@ MODULE_PARM_DESC(irq, "IRQ # for SB8 driver."); | |||
56 | module_param_array(dma8, int, NULL, 0444); | 56 | module_param_array(dma8, int, NULL, 0444); |
57 | MODULE_PARM_DESC(dma8, "8-bit DMA # for SB8 driver."); | 57 | MODULE_PARM_DESC(dma8, "8-bit DMA # for SB8 driver."); |
58 | 58 | ||
59 | static struct platform_device *devices[SNDRV_CARDS]; | ||
60 | |||
61 | struct snd_sb8 { | 59 | struct snd_sb8 { |
62 | struct resource *fm_res; /* used to block FM i/o region for legacy cards */ | 60 | struct resource *fm_res; /* used to block FM i/o region for legacy cards */ |
63 | struct snd_sb *chip; | 61 | struct snd_sb *chip; |
@@ -83,9 +81,23 @@ static void snd_sb8_free(struct snd_card *card) | |||
83 | release_and_free_resource(acard->fm_res); | 81 | release_and_free_resource(acard->fm_res); |
84 | } | 82 | } |
85 | 83 | ||
86 | static int __devinit snd_sb8_probe(struct platform_device *pdev) | 84 | static int __devinit snd_sb8_match(struct device *pdev, unsigned int dev) |
85 | { | ||
86 | if (!enable[dev]) | ||
87 | return 0; | ||
88 | if (irq[dev] == SNDRV_AUTO_IRQ) { | ||
89 | snd_printk(KERN_ERR "%s: please specify irq\n", pdev->bus_id); | ||
90 | return 0; | ||
91 | } | ||
92 | if (dma8[dev] == SNDRV_AUTO_DMA) { | ||
93 | snd_printk(KERN_ERR "%s: please specify dma8\n", pdev->bus_id); | ||
94 | return 0; | ||
95 | } | ||
96 | return 1; | ||
97 | } | ||
98 | |||
99 | static int __devinit snd_sb8_probe(struct device *pdev, unsigned int dev) | ||
87 | { | 100 | { |
88 | int dev = pdev->id; | ||
89 | struct snd_sb *chip; | 101 | struct snd_sb *chip; |
90 | struct snd_card *card; | 102 | struct snd_card *card; |
91 | struct snd_sb8 *acard; | 103 | struct snd_sb8 *acard; |
@@ -180,12 +192,12 @@ static int __devinit snd_sb8_probe(struct platform_device *pdev) | |||
180 | chip->port, | 192 | chip->port, |
181 | irq[dev], dma8[dev]); | 193 | irq[dev], dma8[dev]); |
182 | 194 | ||
183 | snd_card_set_dev(card, &pdev->dev); | 195 | snd_card_set_dev(card, pdev); |
184 | 196 | ||
185 | if ((err = snd_card_register(card)) < 0) | 197 | if ((err = snd_card_register(card)) < 0) |
186 | goto _err; | 198 | goto _err; |
187 | 199 | ||
188 | platform_set_drvdata(pdev, card); | 200 | dev_set_drvdata(pdev, card); |
189 | return 0; | 201 | return 0; |
190 | 202 | ||
191 | _err: | 203 | _err: |
@@ -193,17 +205,18 @@ static int __devinit snd_sb8_probe(struct platform_device *pdev) | |||
193 | return err; | 205 | return err; |
194 | } | 206 | } |
195 | 207 | ||
196 | static int __devexit snd_sb8_remove(struct platform_device *pdev) | 208 | static int __devexit snd_sb8_remove(struct device *pdev, unsigned int dev) |
197 | { | 209 | { |
198 | snd_card_free(platform_get_drvdata(pdev)); | 210 | snd_card_free(dev_get_drvdata(pdev)); |
199 | platform_set_drvdata(pdev, NULL); | 211 | dev_set_drvdata(pdev, NULL); |
200 | return 0; | 212 | return 0; |
201 | } | 213 | } |
202 | 214 | ||
203 | #ifdef CONFIG_PM | 215 | #ifdef CONFIG_PM |
204 | static int snd_sb8_suspend(struct platform_device *dev, pm_message_t state) | 216 | static int snd_sb8_suspend(struct device *dev, unsigned int n, |
217 | pm_message_t state) | ||
205 | { | 218 | { |
206 | struct snd_card *card = platform_get_drvdata(dev); | 219 | struct snd_card *card = dev_get_drvdata(dev); |
207 | struct snd_sb8 *acard = card->private_data; | 220 | struct snd_sb8 *acard = card->private_data; |
208 | struct snd_sb *chip = acard->chip; | 221 | struct snd_sb *chip = acard->chip; |
209 | 222 | ||
@@ -213,9 +226,9 @@ static int snd_sb8_suspend(struct platform_device *dev, pm_message_t state) | |||
213 | return 0; | 226 | return 0; |
214 | } | 227 | } |
215 | 228 | ||
216 | static int snd_sb8_resume(struct platform_device *dev) | 229 | static int snd_sb8_resume(struct device *dev, unsigned int n) |
217 | { | 230 | { |
218 | struct snd_card *card = platform_get_drvdata(dev); | 231 | struct snd_card *card = dev_get_drvdata(dev); |
219 | struct snd_sb8 *acard = card->private_data; | 232 | struct snd_sb8 *acard = card->private_data; |
220 | struct snd_sb *chip = acard->chip; | 233 | struct snd_sb *chip = acard->chip; |
221 | 234 | ||
@@ -228,7 +241,8 @@ static int snd_sb8_resume(struct platform_device *dev) | |||
228 | 241 | ||
229 | #define SND_SB8_DRIVER "snd_sb8" | 242 | #define SND_SB8_DRIVER "snd_sb8" |
230 | 243 | ||
231 | static struct platform_driver snd_sb8_driver = { | 244 | static struct isa_driver snd_sb8_driver = { |
245 | .match = snd_sb8_match, | ||
232 | .probe = snd_sb8_probe, | 246 | .probe = snd_sb8_probe, |
233 | .remove = __devexit_p(snd_sb8_remove), | 247 | .remove = __devexit_p(snd_sb8_remove), |
234 | #ifdef CONFIG_PM | 248 | #ifdef CONFIG_PM |
@@ -240,52 +254,14 @@ static struct platform_driver snd_sb8_driver = { | |||
240 | }, | 254 | }, |
241 | }; | 255 | }; |
242 | 256 | ||
243 | static void __init_or_module snd_sb8_unregister_all(void) | ||
244 | { | ||
245 | int i; | ||
246 | |||
247 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
248 | platform_device_unregister(devices[i]); | ||
249 | platform_driver_unregister(&snd_sb8_driver); | ||
250 | } | ||
251 | |||
252 | static int __init alsa_card_sb8_init(void) | 257 | static int __init alsa_card_sb8_init(void) |
253 | { | 258 | { |
254 | int i, cards, err; | 259 | return isa_register_driver(&snd_sb8_driver, SNDRV_CARDS); |
255 | |||
256 | err = platform_driver_register(&snd_sb8_driver); | ||
257 | if (err < 0) | ||
258 | return err; | ||
259 | |||
260 | cards = 0; | ||
261 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
262 | struct platform_device *device; | ||
263 | if (! enable[i]) | ||
264 | continue; | ||
265 | device = platform_device_register_simple(SND_SB8_DRIVER, | ||
266 | i, NULL, 0); | ||
267 | if (IS_ERR(device)) | ||
268 | continue; | ||
269 | if (!platform_get_drvdata(device)) { | ||
270 | platform_device_unregister(device); | ||
271 | continue; | ||
272 | } | ||
273 | devices[i] = device; | ||
274 | cards++; | ||
275 | } | ||
276 | if (!cards) { | ||
277 | #ifdef MODULE | ||
278 | snd_printk(KERN_ERR "Sound Blaster soundcard not found or device busy\n"); | ||
279 | #endif | ||
280 | snd_sb8_unregister_all(); | ||
281 | return -ENODEV; | ||
282 | } | ||
283 | return 0; | ||
284 | } | 260 | } |
285 | 261 | ||
286 | static void __exit alsa_card_sb8_exit(void) | 262 | static void __exit alsa_card_sb8_exit(void) |
287 | { | 263 | { |
288 | snd_sb8_unregister_all(); | 264 | isa_unregister_driver(&snd_sb8_driver); |
289 | } | 265 | } |
290 | 266 | ||
291 | module_init(alsa_card_sb8_init) | 267 | module_init(alsa_card_sb8_init) |
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c index 4fcd0f4e868c..19e0b0edb8c4 100644 --- a/sound/isa/sgalaxy.c +++ b/sound/isa/sgalaxy.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <sound/driver.h> | 24 | #include <sound/driver.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/isa.h> |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/time.h> | 29 | #include <linux/time.h> |
30 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
@@ -64,8 +64,6 @@ MODULE_PARM_DESC(irq, "IRQ # for Sound Galaxy driver."); | |||
64 | module_param_array(dma1, int, NULL, 0444); | 64 | module_param_array(dma1, int, NULL, 0444); |
65 | MODULE_PARM_DESC(dma1, "DMA1 # for Sound Galaxy driver."); | 65 | MODULE_PARM_DESC(dma1, "DMA1 # for Sound Galaxy driver."); |
66 | 66 | ||
67 | static struct platform_device *devices[SNDRV_CARDS]; | ||
68 | |||
69 | #define SGALAXY_AUXC_LEFT 18 | 67 | #define SGALAXY_AUXC_LEFT 18 |
70 | #define SGALAXY_AUXC_RIGHT 19 | 68 | #define SGALAXY_AUXC_RIGHT 19 |
71 | 69 | ||
@@ -96,7 +94,8 @@ static int snd_sgalaxy_sbdsp_reset(unsigned long port) | |||
96 | return 0; | 94 | return 0; |
97 | } | 95 | } |
98 | 96 | ||
99 | static int __init snd_sgalaxy_sbdsp_command(unsigned long port, unsigned char val) | 97 | static int __devinit snd_sgalaxy_sbdsp_command(unsigned long port, |
98 | unsigned char val) | ||
100 | { | 99 | { |
101 | int i; | 100 | int i; |
102 | 101 | ||
@@ -114,7 +113,7 @@ static irqreturn_t snd_sgalaxy_dummy_interrupt(int irq, void *dev_id) | |||
114 | return IRQ_NONE; | 113 | return IRQ_NONE; |
115 | } | 114 | } |
116 | 115 | ||
117 | static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma) | 116 | static int __devinit snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma) |
118 | { | 117 | { |
119 | static int interrupt_bits[] = {-1, -1, -1, -1, -1, -1, -1, 0x08, -1, | 118 | static int interrupt_bits[] = {-1, -1, -1, -1, -1, -1, -1, 0x08, -1, |
120 | 0x10, 0x18, 0x20, -1, -1, -1, -1}; | 119 | 0x10, 0x18, 0x20, -1, -1, -1, -1}; |
@@ -161,7 +160,7 @@ static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma) | |||
161 | return 0; | 160 | return 0; |
162 | } | 161 | } |
163 | 162 | ||
164 | static int __init snd_sgalaxy_detect(int dev, int irq, int dma) | 163 | static int __devinit snd_sgalaxy_detect(int dev, int irq, int dma) |
165 | { | 164 | { |
166 | #if 0 | 165 | #if 0 |
167 | snd_printdd(PFX "switching to WSS mode\n"); | 166 | snd_printdd(PFX "switching to WSS mode\n"); |
@@ -182,7 +181,7 @@ AD1848_DOUBLE("Aux Playback Switch", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 7 | |||
182 | AD1848_DOUBLE("Aux Playback Volume", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 0, 0, 31, 0) | 181 | AD1848_DOUBLE("Aux Playback Volume", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 0, 0, 31, 0) |
183 | }; | 182 | }; |
184 | 183 | ||
185 | static int __init snd_sgalaxy_mixer(struct snd_ad1848 *chip) | 184 | static int __devinit snd_sgalaxy_mixer(struct snd_ad1848 *chip) |
186 | { | 185 | { |
187 | struct snd_card *card = chip->card; | 186 | struct snd_card *card = chip->card; |
188 | struct snd_ctl_elem_id id1, id2; | 187 | struct snd_ctl_elem_id id1, id2; |
@@ -218,23 +217,29 @@ static int __init snd_sgalaxy_mixer(struct snd_ad1848 *chip) | |||
218 | return 0; | 217 | return 0; |
219 | } | 218 | } |
220 | 219 | ||
221 | static int __init snd_sgalaxy_probe(struct platform_device *devptr) | 220 | static int __devinit snd_sgalaxy_match(struct device *devptr, unsigned int dev) |
222 | { | 221 | { |
223 | int dev = devptr->id; | 222 | if (!enable[dev]) |
224 | static int possible_irqs[] = {7, 9, 10, 11, -1}; | 223 | return 0; |
225 | static int possible_dmas[] = {1, 3, 0, -1}; | ||
226 | int err, xirq, xdma1; | ||
227 | struct snd_card *card; | ||
228 | struct snd_ad1848 *chip; | ||
229 | |||
230 | if (sbport[dev] == SNDRV_AUTO_PORT) { | 224 | if (sbport[dev] == SNDRV_AUTO_PORT) { |
231 | snd_printk(KERN_ERR PFX "specify SB port\n"); | 225 | snd_printk(KERN_ERR PFX "specify SB port\n"); |
232 | return -EINVAL; | 226 | return 0; |
233 | } | 227 | } |
234 | if (wssport[dev] == SNDRV_AUTO_PORT) { | 228 | if (wssport[dev] == SNDRV_AUTO_PORT) { |
235 | snd_printk(KERN_ERR PFX "specify WSS port\n"); | 229 | snd_printk(KERN_ERR PFX "specify WSS port\n"); |
236 | return -EINVAL; | 230 | return 0; |
237 | } | 231 | } |
232 | return 1; | ||
233 | } | ||
234 | |||
235 | static int __devinit snd_sgalaxy_probe(struct device *devptr, unsigned int dev) | ||
236 | { | ||
237 | static int possible_irqs[] = {7, 9, 10, 11, -1}; | ||
238 | static int possible_dmas[] = {1, 3, 0, -1}; | ||
239 | int err, xirq, xdma1; | ||
240 | struct snd_card *card; | ||
241 | struct snd_ad1848 *chip; | ||
242 | |||
238 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 243 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); |
239 | if (card == NULL) | 244 | if (card == NULL) |
240 | return -ENOMEM; | 245 | return -ENOMEM; |
@@ -283,12 +288,12 @@ static int __init snd_sgalaxy_probe(struct platform_device *devptr) | |||
283 | sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d", | 288 | sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d", |
284 | wssport[dev], xirq, xdma1); | 289 | wssport[dev], xirq, xdma1); |
285 | 290 | ||
286 | snd_card_set_dev(card, &devptr->dev); | 291 | snd_card_set_dev(card, devptr); |
287 | 292 | ||
288 | if ((err = snd_card_register(card)) < 0) | 293 | if ((err = snd_card_register(card)) < 0) |
289 | goto _err; | 294 | goto _err; |
290 | 295 | ||
291 | platform_set_drvdata(devptr, card); | 296 | dev_set_drvdata(devptr, card); |
292 | return 0; | 297 | return 0; |
293 | 298 | ||
294 | _err: | 299 | _err: |
@@ -296,17 +301,18 @@ static int __init snd_sgalaxy_probe(struct platform_device *devptr) | |||
296 | return err; | 301 | return err; |
297 | } | 302 | } |
298 | 303 | ||
299 | static int __devexit snd_sgalaxy_remove(struct platform_device *devptr) | 304 | static int __devexit snd_sgalaxy_remove(struct device *devptr, unsigned int dev) |
300 | { | 305 | { |
301 | snd_card_free(platform_get_drvdata(devptr)); | 306 | snd_card_free(dev_get_drvdata(devptr)); |
302 | platform_set_drvdata(devptr, NULL); | 307 | dev_set_drvdata(devptr, NULL); |
303 | return 0; | 308 | return 0; |
304 | } | 309 | } |
305 | 310 | ||
306 | #ifdef CONFIG_PM | 311 | #ifdef CONFIG_PM |
307 | static int snd_sgalaxy_suspend(struct platform_device *pdev, pm_message_t state) | 312 | static int snd_sgalaxy_suspend(struct device *pdev, unsigned int n, |
313 | pm_message_t state) | ||
308 | { | 314 | { |
309 | struct snd_card *card = platform_get_drvdata(pdev); | 315 | struct snd_card *card = dev_get_drvdata(pdev); |
310 | struct snd_ad1848 *chip = card->private_data; | 316 | struct snd_ad1848 *chip = card->private_data; |
311 | 317 | ||
312 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 318 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
@@ -314,9 +320,9 @@ static int snd_sgalaxy_suspend(struct platform_device *pdev, pm_message_t state) | |||
314 | return 0; | 320 | return 0; |
315 | } | 321 | } |
316 | 322 | ||
317 | static int snd_sgalaxy_resume(struct platform_device *pdev) | 323 | static int snd_sgalaxy_resume(struct device *pdev, unsigned int n) |
318 | { | 324 | { |
319 | struct snd_card *card = platform_get_drvdata(pdev); | 325 | struct snd_card *card = dev_get_drvdata(pdev); |
320 | struct snd_ad1848 *chip = card->private_data; | 326 | struct snd_ad1848 *chip = card->private_data; |
321 | 327 | ||
322 | chip->resume(chip); | 328 | chip->resume(chip); |
@@ -330,7 +336,8 @@ static int snd_sgalaxy_resume(struct platform_device *pdev) | |||
330 | 336 | ||
331 | #define SND_SGALAXY_DRIVER "snd_sgalaxy" | 337 | #define SND_SGALAXY_DRIVER "snd_sgalaxy" |
332 | 338 | ||
333 | static struct platform_driver snd_sgalaxy_driver = { | 339 | static struct isa_driver snd_sgalaxy_driver = { |
340 | .match = snd_sgalaxy_match, | ||
334 | .probe = snd_sgalaxy_probe, | 341 | .probe = snd_sgalaxy_probe, |
335 | .remove = __devexit_p(snd_sgalaxy_remove), | 342 | .remove = __devexit_p(snd_sgalaxy_remove), |
336 | #ifdef CONFIG_PM | 343 | #ifdef CONFIG_PM |
@@ -342,52 +349,14 @@ static struct platform_driver snd_sgalaxy_driver = { | |||
342 | }, | 349 | }, |
343 | }; | 350 | }; |
344 | 351 | ||
345 | static void __init_or_module snd_sgalaxy_unregister_all(void) | ||
346 | { | ||
347 | int i; | ||
348 | |||
349 | for (i = 0; i < ARRAY_SIZE(devices); ++i) | ||
350 | platform_device_unregister(devices[i]); | ||
351 | platform_driver_unregister(&snd_sgalaxy_driver); | ||
352 | } | ||
353 | |||
354 | static int __init alsa_card_sgalaxy_init(void) | 352 | static int __init alsa_card_sgalaxy_init(void) |
355 | { | 353 | { |
356 | int i, cards, err; | 354 | return isa_register_driver(&snd_sgalaxy_driver, SNDRV_CARDS); |
357 | |||
358 | err = platform_driver_register(&snd_sgalaxy_driver); | ||
359 | if (err < 0) | ||
360 | return err; | ||
361 | |||
362 | cards = 0; | ||
363 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
364 | struct platform_device *device; | ||
365 | if (! enable[i]) | ||
366 | continue; | ||
367 | device = platform_device_register_simple(SND_SGALAXY_DRIVER, | ||
368 | i, NULL, 0); | ||
369 | if (IS_ERR(device)) | ||
370 | continue; | ||
371 | if (!platform_get_drvdata(device)) { | ||
372 | platform_device_unregister(device); | ||
373 | continue; | ||
374 | } | ||
375 | devices[i] = device; | ||
376 | cards++; | ||
377 | } | ||
378 | if (!cards) { | ||
379 | #ifdef MODULE | ||
380 | snd_printk(KERN_ERR "Sound Galaxy soundcard not found or device busy\n"); | ||
381 | #endif | ||
382 | snd_sgalaxy_unregister_all(); | ||
383 | return -ENODEV; | ||
384 | } | ||
385 | return 0; | ||
386 | } | 355 | } |
387 | 356 | ||
388 | static void __exit alsa_card_sgalaxy_exit(void) | 357 | static void __exit alsa_card_sgalaxy_exit(void) |
389 | { | 358 | { |
390 | snd_sgalaxy_unregister_all(); | 359 | isa_unregister_driver(&snd_sgalaxy_driver); |
391 | } | 360 | } |
392 | 361 | ||
393 | module_init(alsa_card_sgalaxy_init) | 362 | module_init(alsa_card_sgalaxy_init) |
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index b1f25823c652..369de44a6904 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <sound/driver.h> | 24 | #include <sound/driver.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/isa.h> |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/pnp.h> | 29 | #include <linux/pnp.h> |
30 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
@@ -68,8 +68,6 @@ MODULE_PARM_DESC(mpu_irq, "MPU401 IRQ # for SoundScape driver."); | |||
68 | module_param_array(dma, int, NULL, 0444); | 68 | module_param_array(dma, int, NULL, 0444); |
69 | MODULE_PARM_DESC(dma, "DMA # for SoundScape driver."); | 69 | MODULE_PARM_DESC(dma, "DMA # for SoundScape driver."); |
70 | 70 | ||
71 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
72 | |||
73 | #ifdef CONFIG_PNP | 71 | #ifdef CONFIG_PNP |
74 | static int pnp_registered; | 72 | static int pnp_registered; |
75 | static struct pnp_card_device_id sscape_pnpids[] = { | 73 | static struct pnp_card_device_id sscape_pnpids[] = { |
@@ -1254,9 +1252,27 @@ static int __devinit create_sscape(int dev, struct snd_card **rcardp) | |||
1254 | } | 1252 | } |
1255 | 1253 | ||
1256 | 1254 | ||
1257 | static int __devinit snd_sscape_probe(struct platform_device *pdev) | 1255 | static int __devinit snd_sscape_match(struct device *pdev, unsigned int i) |
1256 | { | ||
1257 | /* | ||
1258 | * Make sure we were given ALL of the other parameters. | ||
1259 | */ | ||
1260 | if (port[i] == SNDRV_AUTO_PORT) | ||
1261 | return 0; | ||
1262 | |||
1263 | if (irq[i] == SNDRV_AUTO_IRQ || | ||
1264 | mpu_irq[i] == SNDRV_AUTO_IRQ || | ||
1265 | dma[i] == SNDRV_AUTO_DMA) { | ||
1266 | printk(KERN_INFO | ||
1267 | "sscape: insufficient parameters, need IO, IRQ, MPU-IRQ and DMA\n"); | ||
1268 | return 0; | ||
1269 | } | ||
1270 | |||
1271 | return 1; | ||
1272 | } | ||
1273 | |||
1274 | static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev) | ||
1258 | { | 1275 | { |
1259 | int dev = pdev->id; | ||
1260 | struct snd_card *card; | 1276 | struct snd_card *card; |
1261 | int ret; | 1277 | int ret; |
1262 | 1278 | ||
@@ -1264,25 +1280,26 @@ static int __devinit snd_sscape_probe(struct platform_device *pdev) | |||
1264 | ret = create_sscape(dev, &card); | 1280 | ret = create_sscape(dev, &card); |
1265 | if (ret < 0) | 1281 | if (ret < 0) |
1266 | return ret; | 1282 | return ret; |
1267 | snd_card_set_dev(card, &pdev->dev); | 1283 | snd_card_set_dev(card, pdev); |
1268 | if ((ret = snd_card_register(card)) < 0) { | 1284 | if ((ret = snd_card_register(card)) < 0) { |
1269 | printk(KERN_ERR "sscape: Failed to register sound card\n"); | 1285 | printk(KERN_ERR "sscape: Failed to register sound card\n"); |
1270 | return ret; | 1286 | return ret; |
1271 | } | 1287 | } |
1272 | platform_set_drvdata(pdev, card); | 1288 | dev_set_drvdata(pdev, card); |
1273 | return 0; | 1289 | return 0; |
1274 | } | 1290 | } |
1275 | 1291 | ||
1276 | static int __devexit snd_sscape_remove(struct platform_device *devptr) | 1292 | static int __devexit snd_sscape_remove(struct device *devptr, unsigned int dev) |
1277 | { | 1293 | { |
1278 | snd_card_free(platform_get_drvdata(devptr)); | 1294 | snd_card_free(dev_get_drvdata(devptr)); |
1279 | platform_set_drvdata(devptr, NULL); | 1295 | dev_set_drvdata(devptr, NULL); |
1280 | return 0; | 1296 | return 0; |
1281 | } | 1297 | } |
1282 | 1298 | ||
1283 | #define SSCAPE_DRIVER "snd_sscape" | 1299 | #define SSCAPE_DRIVER "snd_sscape" |
1284 | 1300 | ||
1285 | static struct platform_driver snd_sscape_driver = { | 1301 | static struct isa_driver snd_sscape_driver = { |
1302 | .match = snd_sscape_match, | ||
1286 | .probe = snd_sscape_probe, | 1303 | .probe = snd_sscape_probe, |
1287 | .remove = __devexit_p(snd_sscape_remove), | 1304 | .remove = __devexit_p(snd_sscape_remove), |
1288 | /* FIXME: suspend/resume */ | 1305 | /* FIXME: suspend/resume */ |
@@ -1386,72 +1403,6 @@ static struct pnp_card_driver sscape_pnpc_driver = { | |||
1386 | 1403 | ||
1387 | #endif /* CONFIG_PNP */ | 1404 | #endif /* CONFIG_PNP */ |
1388 | 1405 | ||
1389 | static void __init_or_module sscape_unregister_all(void) | ||
1390 | { | ||
1391 | int i; | ||
1392 | |||
1393 | #ifdef CONFIG_PNP | ||
1394 | if (pnp_registered) | ||
1395 | pnp_unregister_card_driver(&sscape_pnpc_driver); | ||
1396 | #endif | ||
1397 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
1398 | platform_device_unregister(platform_devices[i]); | ||
1399 | platform_driver_unregister(&snd_sscape_driver); | ||
1400 | } | ||
1401 | |||
1402 | static int __init sscape_manual_probe(void) | ||
1403 | { | ||
1404 | struct platform_device *device; | ||
1405 | int i, ret; | ||
1406 | |||
1407 | ret = platform_driver_register(&snd_sscape_driver); | ||
1408 | if (ret < 0) | ||
1409 | return ret; | ||
1410 | |||
1411 | for (i = 0; i < SNDRV_CARDS; ++i) { | ||
1412 | /* | ||
1413 | * We do NOT probe for ports. | ||
1414 | * If we're not given a port number for this | ||
1415 | * card then we completely ignore this line | ||
1416 | * of parameters. | ||
1417 | */ | ||
1418 | if (port[i] == SNDRV_AUTO_PORT) | ||
1419 | continue; | ||
1420 | |||
1421 | /* | ||
1422 | * Make sure we were given ALL of the other parameters. | ||
1423 | */ | ||
1424 | if (irq[i] == SNDRV_AUTO_IRQ || | ||
1425 | mpu_irq[i] == SNDRV_AUTO_IRQ || | ||
1426 | dma[i] == SNDRV_AUTO_DMA) { | ||
1427 | printk(KERN_INFO | ||
1428 | "sscape: insufficient parameters, need IO, IRQ, MPU-IRQ and DMA\n"); | ||
1429 | sscape_unregister_all(); | ||
1430 | return -ENXIO; | ||
1431 | } | ||
1432 | |||
1433 | /* | ||
1434 | * This cards looks OK ... | ||
1435 | */ | ||
1436 | device = platform_device_register_simple(SSCAPE_DRIVER, | ||
1437 | i, NULL, 0); | ||
1438 | if (IS_ERR(device)) | ||
1439 | continue; | ||
1440 | if (!platform_get_drvdata(device)) { | ||
1441 | platform_device_unregister(device); | ||
1442 | continue; | ||
1443 | } | ||
1444 | platform_devices[i] = device; | ||
1445 | } | ||
1446 | return 0; | ||
1447 | } | ||
1448 | |||
1449 | static void sscape_exit(void) | ||
1450 | { | ||
1451 | sscape_unregister_all(); | ||
1452 | } | ||
1453 | |||
1454 | |||
1455 | static int __init sscape_init(void) | 1406 | static int __init sscape_init(void) |
1456 | { | 1407 | { |
1457 | int ret; | 1408 | int ret; |
@@ -1462,7 +1413,7 @@ static int __init sscape_init(void) | |||
1462 | * of allocating cards, because the operator is | 1413 | * of allocating cards, because the operator is |
1463 | * S-P-E-L-L-I-N-G it out for us... | 1414 | * S-P-E-L-L-I-N-G it out for us... |
1464 | */ | 1415 | */ |
1465 | ret = sscape_manual_probe(); | 1416 | ret = isa_register_driver(&snd_sscape_driver, SNDRV_CARDS); |
1466 | if (ret < 0) | 1417 | if (ret < 0) |
1467 | return ret; | 1418 | return ret; |
1468 | #ifdef CONFIG_PNP | 1419 | #ifdef CONFIG_PNP |
@@ -1472,5 +1423,14 @@ static int __init sscape_init(void) | |||
1472 | return 0; | 1423 | return 0; |
1473 | } | 1424 | } |
1474 | 1425 | ||
1426 | static void __exit sscape_exit(void) | ||
1427 | { | ||
1428 | #ifdef CONFIG_PNP | ||
1429 | if (pnp_registered) | ||
1430 | pnp_unregister_card_driver(&sscape_pnpc_driver); | ||
1431 | #endif | ||
1432 | isa_unregister_driver(&snd_sscape_driver); | ||
1433 | } | ||
1434 | |||
1475 | module_init(sscape_init); | 1435 | module_init(sscape_init); |
1476 | module_exit(sscape_exit); | 1436 | module_exit(sscape_exit); |
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index e2fdd5fd39d0..6f143275e3b3 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/isa.h> |
28 | #include <linux/pnp.h> | 28 | #include <linux/pnp.h> |
29 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
30 | #include <sound/core.h> | 30 | #include <sound/core.h> |
@@ -83,8 +83,6 @@ MODULE_PARM_DESC(fm_port, "FM port #."); | |||
83 | module_param_array(use_cs4232_midi, bool, NULL, 0444); | 83 | module_param_array(use_cs4232_midi, bool, NULL, 0444); |
84 | MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)"); | 84 | MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)"); |
85 | 85 | ||
86 | static struct platform_device *platform_devices[SNDRV_CARDS]; | ||
87 | |||
88 | #ifdef CONFIG_PNP | 86 | #ifdef CONFIG_PNP |
89 | static int pnp_registered; | 87 | static int pnp_registered; |
90 | 88 | ||
@@ -588,46 +586,59 @@ snd_wavefront_probe (struct snd_card *card, int dev) | |||
588 | return snd_card_register(card); | 586 | return snd_card_register(card); |
589 | } | 587 | } |
590 | 588 | ||
591 | static int __devinit snd_wavefront_nonpnp_probe(struct platform_device *pdev) | 589 | static int __devinit snd_wavefront_isa_match(struct device *pdev, |
590 | unsigned int dev) | ||
592 | { | 591 | { |
593 | int dev = pdev->id; | 592 | if (!enable[dev]) |
594 | struct snd_card *card; | 593 | return 0; |
595 | int err; | 594 | #ifdef CONFIG_PNP |
596 | 595 | if (isapnp[dev]) | |
596 | return 0; | ||
597 | #endif | ||
597 | if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { | 598 | if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { |
598 | snd_printk("specify CS4232 port\n"); | 599 | snd_printk("specify CS4232 port\n"); |
599 | return -EINVAL; | 600 | return 0; |
600 | } | 601 | } |
601 | if (ics2115_port[dev] == SNDRV_AUTO_PORT) { | 602 | if (ics2115_port[dev] == SNDRV_AUTO_PORT) { |
602 | snd_printk("specify ICS2115 port\n"); | 603 | snd_printk("specify ICS2115 port\n"); |
603 | return -ENODEV; | 604 | return 0; |
604 | } | 605 | } |
606 | return 1; | ||
607 | } | ||
608 | |||
609 | static int __devinit snd_wavefront_isa_probe(struct device *pdev, | ||
610 | unsigned int dev) | ||
611 | { | ||
612 | struct snd_card *card; | ||
613 | int err; | ||
605 | 614 | ||
606 | card = snd_wavefront_card_new(dev); | 615 | card = snd_wavefront_card_new(dev); |
607 | if (! card) | 616 | if (! card) |
608 | return -ENOMEM; | 617 | return -ENOMEM; |
609 | snd_card_set_dev(card, &pdev->dev); | 618 | snd_card_set_dev(card, pdev); |
610 | if ((err = snd_wavefront_probe(card, dev)) < 0) { | 619 | if ((err = snd_wavefront_probe(card, dev)) < 0) { |
611 | snd_card_free(card); | 620 | snd_card_free(card); |
612 | return err; | 621 | return err; |
613 | } | 622 | } |
614 | 623 | ||
615 | platform_set_drvdata(pdev, card); | 624 | dev_set_drvdata(pdev, card); |
616 | return 0; | 625 | return 0; |
617 | } | 626 | } |
618 | 627 | ||
619 | static int __devexit snd_wavefront_nonpnp_remove(struct platform_device *devptr) | 628 | static int __devexit snd_wavefront_isa_remove(struct device *devptr, |
629 | unsigned int dev) | ||
620 | { | 630 | { |
621 | snd_card_free(platform_get_drvdata(devptr)); | 631 | snd_card_free(dev_get_drvdata(devptr)); |
622 | platform_set_drvdata(devptr, NULL); | 632 | dev_set_drvdata(devptr, NULL); |
623 | return 0; | 633 | return 0; |
624 | } | 634 | } |
625 | 635 | ||
626 | #define WAVEFRONT_DRIVER "snd_wavefront" | 636 | #define WAVEFRONT_DRIVER "snd_wavefront" |
627 | 637 | ||
628 | static struct platform_driver snd_wavefront_driver = { | 638 | static struct isa_driver snd_wavefront_driver = { |
629 | .probe = snd_wavefront_nonpnp_probe, | 639 | .match = snd_wavefront_isa_match, |
630 | .remove = __devexit_p(snd_wavefront_nonpnp_remove), | 640 | .probe = snd_wavefront_isa_probe, |
641 | .remove = __devexit_p(snd_wavefront_isa_remove), | ||
631 | /* FIXME: suspend, resume */ | 642 | /* FIXME: suspend, resume */ |
632 | .driver = { | 643 | .driver = { |
633 | .name = WAVEFRONT_DRIVER | 644 | .name = WAVEFRONT_DRIVER |
@@ -636,8 +647,6 @@ static struct platform_driver snd_wavefront_driver = { | |||
636 | 647 | ||
637 | 648 | ||
638 | #ifdef CONFIG_PNP | 649 | #ifdef CONFIG_PNP |
639 | static unsigned int __devinitdata wavefront_pnp_devices; | ||
640 | |||
641 | static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, | 650 | static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, |
642 | const struct pnp_card_device_id *pid) | 651 | const struct pnp_card_device_id *pid) |
643 | { | 652 | { |
@@ -670,7 +679,6 @@ static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, | |||
670 | 679 | ||
671 | pnp_set_card_drvdata(pcard, card); | 680 | pnp_set_card_drvdata(pcard, card); |
672 | dev++; | 681 | dev++; |
673 | wavefront_pnp_devices++; | ||
674 | return 0; | 682 | return 0; |
675 | } | 683 | } |
676 | 684 | ||
@@ -691,67 +699,28 @@ static struct pnp_card_driver wavefront_pnpc_driver = { | |||
691 | 699 | ||
692 | #endif /* CONFIG_PNP */ | 700 | #endif /* CONFIG_PNP */ |
693 | 701 | ||
694 | static void __init_or_module snd_wavefront_unregister_all(void) | ||
695 | { | ||
696 | int i; | ||
697 | |||
698 | #ifdef CONFIG_PNP | ||
699 | if (pnp_registered) | ||
700 | pnp_unregister_card_driver(&wavefront_pnpc_driver); | ||
701 | #endif | ||
702 | for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) | ||
703 | platform_device_unregister(platform_devices[i]); | ||
704 | platform_driver_unregister(&snd_wavefront_driver); | ||
705 | } | ||
706 | |||
707 | static int __init alsa_card_wavefront_init(void) | 702 | static int __init alsa_card_wavefront_init(void) |
708 | { | 703 | { |
709 | int i, err, cards = 0; | 704 | int err; |
710 | 705 | ||
711 | if ((err = platform_driver_register(&snd_wavefront_driver)) < 0) | 706 | err = isa_register_driver(&snd_wavefront_driver, SNDRV_CARDS); |
707 | if (err < 0) | ||
712 | return err; | 708 | return err; |
713 | |||
714 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
715 | struct platform_device *device; | ||
716 | if (! enable[i]) | ||
717 | continue; | ||
718 | #ifdef CONFIG_PNP | ||
719 | if (isapnp[i]) | ||
720 | continue; | ||
721 | #endif | ||
722 | device = platform_device_register_simple(WAVEFRONT_DRIVER, | ||
723 | i, NULL, 0); | ||
724 | if (IS_ERR(device)) | ||
725 | continue; | ||
726 | if (!platform_get_drvdata(device)) { | ||
727 | platform_device_unregister(device); | ||
728 | continue; | ||
729 | } | ||
730 | platform_devices[i] = device; | ||
731 | cards++; | ||
732 | } | ||
733 | |||
734 | #ifdef CONFIG_PNP | 709 | #ifdef CONFIG_PNP |
735 | err = pnp_register_card_driver(&wavefront_pnpc_driver); | 710 | err = pnp_register_card_driver(&wavefront_pnpc_driver); |
736 | if (!err) { | 711 | if (!err) |
737 | pnp_registered = 1; | 712 | pnp_registered = 1; |
738 | cards += wavefront_pnp_devices; | ||
739 | } | ||
740 | #endif | ||
741 | |||
742 | if (!cards) { | ||
743 | #ifdef MODULE | ||
744 | printk (KERN_ERR "No WaveFront cards found or devices busy\n"); | ||
745 | #endif | 713 | #endif |
746 | snd_wavefront_unregister_all(); | ||
747 | return -ENODEV; | ||
748 | } | ||
749 | return 0; | 714 | return 0; |
750 | } | 715 | } |
751 | 716 | ||
752 | static void __exit alsa_card_wavefront_exit(void) | 717 | static void __exit alsa_card_wavefront_exit(void) |
753 | { | 718 | { |
754 | snd_wavefront_unregister_all(); | 719 | #ifdef CONFIG_PNP |
720 | if (pnp_registered) | ||
721 | pnp_unregister_card_driver(&wavefront_pnpc_driver); | ||
722 | #endif | ||
723 | isa_unregister_driver(&snd_wavefront_driver); | ||
755 | } | 724 | } |
756 | 725 | ||
757 | module_init(alsa_card_wavefront_init) | 726 | module_init(alsa_card_wavefront_init) |