diff options
Diffstat (limited to 'sound/isa/es18xx.c')
-rw-r--r-- | sound/isa/es18xx.c | 56 |
1 files changed, 9 insertions, 47 deletions
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index c1af28fd4a1f..5d4f1635ffdd 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c | |||
@@ -2035,31 +2035,9 @@ static struct pnp_device_id snd_audiodrive_pnpbiosids[] = { | |||
2035 | MODULE_DEVICE_TABLE(pnp, snd_audiodrive_pnpbiosids); | 2035 | MODULE_DEVICE_TABLE(pnp, snd_audiodrive_pnpbiosids); |
2036 | 2036 | ||
2037 | /* PnP main device initialization */ | 2037 | /* PnP main device initialization */ |
2038 | static int __devinit snd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev, | 2038 | static int __devinit snd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev) |
2039 | struct pnp_resource_table *cfg) | ||
2040 | { | 2039 | { |
2041 | int err; | 2040 | if (pnp_activate_dev(pdev) < 0) { |
2042 | |||
2043 | pnp_init_resource_table(cfg); | ||
2044 | if (port[dev] != SNDRV_AUTO_PORT) | ||
2045 | pnp_resource_change(&cfg->port_resource[0], port[dev], 16); | ||
2046 | if (fm_port[dev] != SNDRV_AUTO_PORT) | ||
2047 | pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4); | ||
2048 | if (mpu_port[dev] != SNDRV_AUTO_PORT) | ||
2049 | pnp_resource_change(&cfg->port_resource[2], mpu_port[dev], 2); | ||
2050 | if (dma1[dev] != SNDRV_AUTO_DMA) | ||
2051 | pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1); | ||
2052 | if (dma2[dev] != SNDRV_AUTO_DMA) | ||
2053 | pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1); | ||
2054 | if (irq[dev] != SNDRV_AUTO_IRQ) | ||
2055 | pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1); | ||
2056 | if (pnp_device_is_isapnp(pdev)) { | ||
2057 | err = pnp_manual_config_dev(pdev, cfg, 0); | ||
2058 | if (err < 0) | ||
2059 | snd_printk(KERN_ERR PFX "PnP manual resources are invalid, using auto config\n"); | ||
2060 | } | ||
2061 | err = pnp_activate_dev(pdev); | ||
2062 | if (err < 0) { | ||
2063 | snd_printk(KERN_ERR PFX "PnP configure failure (out of resources?)\n"); | 2041 | snd_printk(KERN_ERR PFX "PnP configure failure (out of resources?)\n"); |
2064 | return -EBUSY; | 2042 | return -EBUSY; |
2065 | } | 2043 | } |
@@ -2087,16 +2065,9 @@ static int __devinit snd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev, | |||
2087 | static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard, | 2065 | static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard, |
2088 | struct pnp_dev *pdev) | 2066 | struct pnp_dev *pdev) |
2089 | { | 2067 | { |
2090 | struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL); | ||
2091 | |||
2092 | if (!cfg) | ||
2093 | return -ENOMEM; | ||
2094 | acard->dev = pdev; | 2068 | acard->dev = pdev; |
2095 | if (snd_audiodrive_pnp_init_main(dev, acard->dev, cfg) < 0) { | 2069 | if (snd_audiodrive_pnp_init_main(dev, acard->dev) < 0) |
2096 | kfree(cfg); | ||
2097 | return -EBUSY; | 2070 | return -EBUSY; |
2098 | } | ||
2099 | kfree(cfg); | ||
2100 | return 0; | 2071 | return 0; |
2101 | } | 2072 | } |
2102 | 2073 | ||
@@ -2125,33 +2096,24 @@ static int __devinit snd_audiodrive_pnpc(int dev, struct snd_audiodrive *acard, | |||
2125 | struct pnp_card_link *card, | 2096 | struct pnp_card_link *card, |
2126 | const struct pnp_card_device_id *id) | 2097 | const struct pnp_card_device_id *id) |
2127 | { | 2098 | { |
2128 | struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL); | ||
2129 | |||
2130 | if (!cfg) | ||
2131 | return -ENOMEM; | ||
2132 | acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); | 2099 | acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); |
2133 | if (acard->dev == NULL) { | 2100 | if (acard->dev == NULL) |
2134 | kfree(cfg); | ||
2135 | return -EBUSY; | 2101 | return -EBUSY; |
2136 | } | 2102 | |
2137 | acard->devc = pnp_request_card_device(card, id->devs[1].id, NULL); | 2103 | acard->devc = pnp_request_card_device(card, id->devs[1].id, NULL); |
2138 | if (acard->devc == NULL) { | 2104 | if (acard->devc == NULL) |
2139 | kfree(cfg); | ||
2140 | return -EBUSY; | 2105 | return -EBUSY; |
2141 | } | 2106 | |
2142 | /* Control port initialization */ | 2107 | /* Control port initialization */ |
2143 | if (pnp_activate_dev(acard->devc) < 0) { | 2108 | if (pnp_activate_dev(acard->devc) < 0) { |
2144 | kfree(cfg); | ||
2145 | snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n"); | 2109 | snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n"); |
2146 | return -EAGAIN; | 2110 | return -EAGAIN; |
2147 | } | 2111 | } |
2148 | snd_printdd("pnp: port=0x%llx\n", | 2112 | snd_printdd("pnp: port=0x%llx\n", |
2149 | (unsigned long long)pnp_port_start(acard->devc, 0)); | 2113 | (unsigned long long)pnp_port_start(acard->devc, 0)); |
2150 | if (snd_audiodrive_pnp_init_main(dev, acard->dev, cfg) < 0) { | 2114 | if (snd_audiodrive_pnp_init_main(dev, acard->dev) < 0) |
2151 | kfree(cfg); | ||
2152 | return -EBUSY; | 2115 | return -EBUSY; |
2153 | } | 2116 | |
2154 | kfree(cfg); | ||
2155 | return 0; | 2117 | return 0; |
2156 | } | 2118 | } |
2157 | #endif /* CONFIG_PNP */ | 2119 | #endif /* CONFIG_PNP */ |