diff options
Diffstat (limited to 'sound/isa/opl3sa2.c')
-rw-r--r-- | sound/isa/opl3sa2.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 75bd6eca63e7..e2d2babcd20b 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c | |||
@@ -143,6 +143,8 @@ struct snd_opl3sa2 { | |||
143 | 143 | ||
144 | static snd_card_t *snd_opl3sa2_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; | 144 | static snd_card_t *snd_opl3sa2_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; |
145 | 145 | ||
146 | #define PFX "opl3sa2: " | ||
147 | |||
146 | #ifdef CONFIG_PNP | 148 | #ifdef CONFIG_PNP |
147 | 149 | ||
148 | static struct pnp_device_id snd_opl3sa2_pnpbiosids[] = { | 150 | static struct pnp_device_id snd_opl3sa2_pnpbiosids[] = { |
@@ -231,7 +233,7 @@ static int __init snd_opl3sa2_detect(opl3sa2_t *chip) | |||
231 | card = chip->card; | 233 | card = chip->card; |
232 | port = chip->port; | 234 | port = chip->port; |
233 | if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) { | 235 | if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) { |
234 | snd_printk(KERN_ERR "opl3sa2: can't grab port 0x%lx\n", port); | 236 | snd_printk(KERN_ERR PFX "can't grab port 0x%lx\n", port); |
235 | return -EBUSY; | 237 | return -EBUSY; |
236 | } | 238 | } |
237 | // snd_printk("REG 0A = 0x%x\n", snd_opl3sa2_read(chip, 0x0a)); | 239 | // snd_printk("REG 0A = 0x%x\n", snd_opl3sa2_read(chip, 0x0a)); |
@@ -668,6 +670,12 @@ static int snd_opl3sa2_dev_free(snd_device_t *device) | |||
668 | return snd_opl3sa2_free(chip); | 670 | return snd_opl3sa2_free(chip); |
669 | } | 671 | } |
670 | 672 | ||
673 | #ifdef CONFIG_PNP | ||
674 | #define is_isapnp_selected(dev) isapnp[dev] | ||
675 | #else | ||
676 | #define is_isapnp_selected(dev) 0 | ||
677 | #endif | ||
678 | |||
671 | static int __devinit snd_opl3sa2_probe(int dev, | 679 | static int __devinit snd_opl3sa2_probe(int dev, |
672 | struct pnp_dev *pdev, | 680 | struct pnp_dev *pdev, |
673 | struct pnp_card_link *pcard, | 681 | struct pnp_card_link *pcard, |
@@ -683,34 +691,31 @@ static int __devinit snd_opl3sa2_probe(int dev, | |||
683 | }; | 691 | }; |
684 | int err; | 692 | int err; |
685 | 693 | ||
686 | #ifdef CONFIG_PNP | 694 | if (! is_isapnp_selected(dev)) { |
687 | if (!isapnp[dev]) { | ||
688 | #endif | ||
689 | if (port[dev] == SNDRV_AUTO_PORT) { | 695 | if (port[dev] == SNDRV_AUTO_PORT) { |
690 | snd_printk("specify port\n"); | 696 | snd_printk(KERN_ERR PFX "specify port\n"); |
691 | return -EINVAL; | 697 | return -EINVAL; |
692 | } | 698 | } |
693 | if (wss_port[dev] == SNDRV_AUTO_PORT) { | 699 | if (wss_port[dev] == SNDRV_AUTO_PORT) { |
694 | snd_printk("specify wss_port\n"); | 700 | snd_printk(KERN_ERR PFX "specify wss_port\n"); |
695 | return -EINVAL; | 701 | return -EINVAL; |
696 | } | 702 | } |
697 | if (fm_port[dev] == SNDRV_AUTO_PORT) { | 703 | if (fm_port[dev] == SNDRV_AUTO_PORT) { |
698 | snd_printk("specify fm_port\n"); | 704 | snd_printk(KERN_ERR PFX "specify fm_port\n"); |
699 | return -EINVAL; | 705 | return -EINVAL; |
700 | } | 706 | } |
701 | if (midi_port[dev] == SNDRV_AUTO_PORT) { | 707 | if (midi_port[dev] == SNDRV_AUTO_PORT) { |
702 | snd_printk("specify midi_port\n"); | 708 | snd_printk(KERN_ERR PFX "specify midi_port\n"); |
703 | return -EINVAL; | 709 | return -EINVAL; |
704 | } | 710 | } |
705 | #ifdef CONFIG_PNP | ||
706 | } | 711 | } |
707 | #endif | 712 | |
708 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 713 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); |
709 | if (card == NULL) | 714 | if (card == NULL) |
710 | return -ENOMEM; | 715 | return -ENOMEM; |
711 | strcpy(card->driver, "OPL3SA2"); | 716 | strcpy(card->driver, "OPL3SA2"); |
712 | strcpy(card->shortname, "Yamaha OPL3-SA2"); | 717 | strcpy(card->shortname, "Yamaha OPL3-SA2"); |
713 | chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); | 718 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
714 | if (chip == NULL) { | 719 | if (chip == NULL) { |
715 | err = -ENOMEM; | 720 | err = -ENOMEM; |
716 | goto __error; | 721 | goto __error; |
@@ -742,7 +747,7 @@ static int __devinit snd_opl3sa2_probe(int dev, | |||
742 | if ((err = snd_opl3sa2_detect(chip)) < 0) | 747 | if ((err = snd_opl3sa2_detect(chip)) < 0) |
743 | goto __error; | 748 | goto __error; |
744 | if (request_irq(xirq, snd_opl3sa2_interrupt, SA_INTERRUPT, "OPL3-SA2", (void *)chip)) { | 749 | if (request_irq(xirq, snd_opl3sa2_interrupt, SA_INTERRUPT, "OPL3-SA2", (void *)chip)) { |
745 | snd_printk(KERN_ERR "opl3sa2: can't grab IRQ %d\n", xirq); | 750 | snd_printk(KERN_ERR PFX "can't grab IRQ %d\n", xirq); |
746 | err = -ENODEV; | 751 | err = -ENODEV; |
747 | goto __error; | 752 | goto __error; |
748 | } | 753 | } |
@@ -795,6 +800,9 @@ static int __devinit snd_opl3sa2_probe(int dev, | |||
795 | if (dma2 >= 0) | 800 | if (dma2 >= 0) |
796 | sprintf(card->longname + strlen(card->longname), "&%d", xdma2); | 801 | sprintf(card->longname + strlen(card->longname), "&%d", xdma2); |
797 | 802 | ||
803 | if ((err = snd_card_set_generic_dev(card)) < 0) | ||
804 | goto __error; | ||
805 | |||
798 | if ((err = snd_card_register(card)) < 0) | 806 | if ((err = snd_card_register(card)) < 0) |
799 | goto __error; | 807 | goto __error; |
800 | 808 | ||
@@ -852,8 +860,10 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *card, | |||
852 | int res; | 860 | int res; |
853 | 861 | ||
854 | for ( ; dev < SNDRV_CARDS; dev++) { | 862 | for ( ; dev < SNDRV_CARDS; dev++) { |
855 | if (!enable[dev] || !isapnp[dev]) | 863 | if (!enable[dev]) |
856 | continue; | 864 | continue; |
865 | if (is_isapnp_selected(dev)) | ||
866 | continue; | ||
857 | res = snd_opl3sa2_probe(dev, NULL, card, id); | 867 | res = snd_opl3sa2_probe(dev, NULL, card, id); |
858 | if (res < 0) | 868 | if (res < 0) |
859 | return res; | 869 | return res; |