aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/gus/interwave.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/gus/interwave.c')
-rw-r--r--sound/isa/gus/interwave.c40
1 files changed, 5 insertions, 35 deletions
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 2091c50b2e3..ca0d7ace0c7 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <sound/driver.h>
26#include <linux/init.h> 25#include <linux/init.h>
27#include <linux/err.h> 26#include <linux/err.h>
28#include <linux/isa.h> 27#include <linux/isa.h>
@@ -560,50 +559,27 @@ static int __devinit snd_interwave_pnp(int dev, struct snd_interwave *iwcard,
560 const struct pnp_card_device_id *id) 559 const struct pnp_card_device_id *id)
561{ 560{
562 struct pnp_dev *pdev; 561 struct pnp_dev *pdev;
563 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
564 int err; 562 int err;
565 563
566 if (!cfg)
567 return -ENOMEM;
568 iwcard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 564 iwcard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
569 if (iwcard->dev == NULL) { 565 if (iwcard->dev == NULL)
570 kfree(cfg);
571 return -EBUSY; 566 return -EBUSY;
572 } 567
573#ifdef SNDRV_STB 568#ifdef SNDRV_STB
574 iwcard->devtc = pnp_request_card_device(card, id->devs[1].id, NULL); 569 iwcard->devtc = pnp_request_card_device(card, id->devs[1].id, NULL);
575 if (iwcard->devtc == NULL) { 570 if (iwcard->devtc == NULL)
576 kfree(cfg);
577 return -EBUSY; 571 return -EBUSY;
578 }
579#endif 572#endif
580 /* Synth & Codec initialization */ 573 /* Synth & Codec initialization */
581 pdev = iwcard->dev; 574 pdev = iwcard->dev;
582 pnp_init_resource_table(cfg); 575
583 if (port[dev] != SNDRV_AUTO_PORT) {
584 pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
585 pnp_resource_change(&cfg->port_resource[1], port[dev] + 0x100, 12);
586 pnp_resource_change(&cfg->port_resource[2], port[dev] + 0x10c, 4);
587 }
588 if (dma1[dev] != SNDRV_AUTO_DMA)
589 pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
590 if (dma2[dev] != SNDRV_AUTO_DMA)
591 pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1);
592 if (dma2[dev] < 0)
593 pnp_resource_change(&cfg->dma_resource[1], 4, 1);
594 if (irq[dev] != SNDRV_AUTO_IRQ)
595 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
596 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
597 snd_printk(KERN_ERR "InterWave - Synth - the requested resources are invalid, using auto config\n");
598 err = pnp_activate_dev(pdev); 576 err = pnp_activate_dev(pdev);
599 if (err < 0) { 577 if (err < 0) {
600 kfree(cfg);
601 snd_printk(KERN_ERR "InterWave PnP configure failure (out of resources?)\n"); 578 snd_printk(KERN_ERR "InterWave PnP configure failure (out of resources?)\n");
602 return err; 579 return err;
603 } 580 }
604 if (pnp_port_start(pdev, 0) + 0x100 != pnp_port_start(pdev, 1) || 581 if (pnp_port_start(pdev, 0) + 0x100 != pnp_port_start(pdev, 1) ||
605 pnp_port_start(pdev, 0) + 0x10c != pnp_port_start(pdev, 2)) { 582 pnp_port_start(pdev, 0) + 0x10c != pnp_port_start(pdev, 2)) {
606 kfree(cfg);
607 snd_printk(KERN_ERR "PnP configure failure (wrong ports)\n"); 583 snd_printk(KERN_ERR "PnP configure failure (wrong ports)\n");
608 return -ENOENT; 584 return -ENOENT;
609 } 585 }
@@ -620,21 +596,15 @@ static int __devinit snd_interwave_pnp(int dev, struct snd_interwave *iwcard,
620#ifdef SNDRV_STB 596#ifdef SNDRV_STB
621 /* Tone Control initialization */ 597 /* Tone Control initialization */
622 pdev = iwcard->devtc; 598 pdev = iwcard->devtc;
623 pnp_init_resource_table(cfg); 599
624 if (port_tc[dev] != SNDRV_AUTO_PORT)
625 pnp_resource_change(&cfg->port_resource[0], port_tc[dev], 1);
626 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
627 snd_printk(KERN_ERR "InterWave - ToneControl - the requested resources are invalid, using auto config\n");
628 err = pnp_activate_dev(pdev); 600 err = pnp_activate_dev(pdev);
629 if (err < 0) { 601 if (err < 0) {
630 kfree(cfg);
631 snd_printk(KERN_ERR "InterWave ToneControl PnP configure failure (out of resources?)\n"); 602 snd_printk(KERN_ERR "InterWave ToneControl PnP configure failure (out of resources?)\n");
632 return err; 603 return err;
633 } 604 }
634 port_tc[dev] = pnp_port_start(pdev, 0); 605 port_tc[dev] = pnp_port_start(pdev, 0);
635 snd_printdd("isapnp IW: tone control port=0x%lx\n", port_tc[dev]); 606 snd_printdd("isapnp IW: tone control port=0x%lx\n", port_tc[dev]);
636#endif 607#endif
637 kfree(cfg);
638 return 0; 608 return 0;
639} 609}
640#endif /* CONFIG_PNP */ 610#endif /* CONFIG_PNP */