aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorRene Herman <rene.herman@gmail.com>2007-11-30 11:59:25 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:29:30 -0500
commit109c53f840e551d6e99ecfd8b0131a968332c89f (patch)
tree212af8d6ebb3303a21dd44b032fd5949fdc37607 /sound
parentdf1deb67532ea26f1a033a5f48bf34b30bec8e1d (diff)
[ALSA] sound/isa: kill pnp_resource_change
This removes the pnp_resource_change use from the ALSA ISAPnP drivers. In 2.4 these were useful in providing an easy path to setting the resources, but in 2.6 they retain function as a layering violation only. This makes for a nice cleanup (-550 lines) of ALSA but moreover, ALSA is the only remaining user of pnp_init_resource_table(), pnp_resource_change() and pnp_manual_config_dev() (and, in fact, of 'struct pnp_resource_table') in the tree outide of drivers/pnp itself meaning it makes for more cleanup potential inside the PnP layer. Thomas Renninger acked their removal from that side, you did from the ALSA side (CC list just copied from that thread). Against current alsa-kernel HG. Many more potential cleanups in there, but this _only_ removes the pnp_resource_change code. Compile tested against current alsa-kernel HG and compile- and use-tested against 2.6.23.x (few offsets). Cc: Thomas Renninger <trenn@suse.de> Signed-off-by: Rene Herman <rene.herman@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/isa/ad1816a/ad1816a.c53
-rw-r--r--sound/isa/als100.c49
-rw-r--r--sound/isa/azt2320.c50
-rw-r--r--sound/isa/cmi8330.c42
-rw-r--r--sound/isa/cs423x/cs4236.c91
-rw-r--r--sound/isa/dt019x.c46
-rw-r--r--sound/isa/es18xx.c56
-rw-r--r--sound/isa/gus/interwave.c39
-rw-r--r--sound/isa/opl3sa2.c36
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c48
-rw-r--r--sound/isa/sb/es968.c27
-rw-r--r--sound/isa/sb/sb16.c39
-rw-r--r--sound/isa/wavefront/wavefront.c55
13 files changed, 56 insertions, 575 deletions
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c
index fc88a31da6f5..994bc85376c1 100644
--- a/sound/isa/ad1816a/ad1816a.c
+++ b/sound/isa/ad1816a/ad1816a.c
@@ -61,20 +61,6 @@ module_param_array(id, charp, NULL, 0444);
61MODULE_PARM_DESC(id, "ID string for ad1816a based soundcard."); 61MODULE_PARM_DESC(id, "ID string for ad1816a based soundcard.");
62module_param_array(enable, bool, NULL, 0444); 62module_param_array(enable, bool, NULL, 0444);
63MODULE_PARM_DESC(enable, "Enable ad1816a based soundcard."); 63MODULE_PARM_DESC(enable, "Enable ad1816a based soundcard.");
64module_param_array(port, long, NULL, 0444);
65MODULE_PARM_DESC(port, "Port # for ad1816a driver.");
66module_param_array(mpu_port, long, NULL, 0444);
67MODULE_PARM_DESC(mpu_port, "MPU-401 port # for ad1816a driver.");
68module_param_array(fm_port, long, NULL, 0444);
69MODULE_PARM_DESC(fm_port, "FM port # for ad1816a driver.");
70module_param_array(irq, int, NULL, 0444);
71MODULE_PARM_DESC(irq, "IRQ # for ad1816a driver.");
72module_param_array(mpu_irq, int, NULL, 0444);
73MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for ad1816a driver.");
74module_param_array(dma1, int, NULL, 0444);
75MODULE_PARM_DESC(dma1, "1st DMA # for ad1816a driver.");
76module_param_array(dma2, int, NULL, 0444);
77MODULE_PARM_DESC(dma2, "2nd DMA # for ad1816a driver.");
78module_param_array(clockfreq, int, NULL, 0444); 64module_param_array(clockfreq, int, NULL, 0444);
79MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0)."); 65MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0).");
80 66
@@ -117,16 +103,12 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
117 const struct pnp_card_device_id *id) 103 const struct pnp_card_device_id *id)
118{ 104{
119 struct pnp_dev *pdev; 105 struct pnp_dev *pdev;
120 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
121 int err; 106 int err;
122 107
123 if (!cfg)
124 return -ENOMEM;
125 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 108 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
126 if (acard->dev == NULL) { 109 if (acard->dev == NULL)
127 kfree(cfg);
128 return -EBUSY; 110 return -EBUSY;
129 } 111
130 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL); 112 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL);
131 if (acard->devmpu == NULL) { 113 if (acard->devmpu == NULL) {
132 mpu_port[dev] = -1; 114 mpu_port[dev] = -1;
@@ -134,25 +116,10 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
134 } 116 }
135 117
136 pdev = acard->dev; 118 pdev = acard->dev;
137 pnp_init_resource_table(cfg); 119
138
139 if (port[dev] != SNDRV_AUTO_PORT)
140 pnp_resource_change(&cfg->port_resource[2], port[dev], 16);
141 if (fm_port[dev] != SNDRV_AUTO_PORT)
142 pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4);
143 if (dma1[dev] != SNDRV_AUTO_DMA)
144 pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
145 if (dma2[dev] != SNDRV_AUTO_DMA)
146 pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1);
147 if (irq[dev] != SNDRV_AUTO_IRQ)
148 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
149
150 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
151 snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
152 err = pnp_activate_dev(pdev); 120 err = pnp_activate_dev(pdev);
153 if (err < 0) { 121 if (err < 0) {
154 printk(KERN_ERR PFX "AUDIO PnP configure failure\n"); 122 printk(KERN_ERR PFX "AUDIO PnP configure failure\n");
155 kfree(cfg);
156 return -EBUSY; 123 return -EBUSY;
157 } 124 }
158 125
@@ -162,20 +129,11 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
162 dma2[dev] = pnp_dma(pdev, 1); 129 dma2[dev] = pnp_dma(pdev, 1);
163 irq[dev] = pnp_irq(pdev, 0); 130 irq[dev] = pnp_irq(pdev, 0);
164 131
165 if (acard->devmpu == NULL) { 132 if (acard->devmpu == NULL)
166 kfree(cfg);
167 return 0; 133 return 0;
168 }
169 pdev = acard->devmpu;
170 pnp_init_resource_table(cfg);
171 134
172 if (mpu_port[dev] != SNDRV_AUTO_PORT) 135 pdev = acard->devmpu;
173 pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
174 if (mpu_irq[dev] != SNDRV_AUTO_IRQ)
175 pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
176 136
177 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
178 snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
179 err = pnp_activate_dev(pdev); 137 err = pnp_activate_dev(pdev);
180 if (err < 0) { 138 if (err < 0) {
181 printk(KERN_ERR PFX "MPU401 PnP configure failure\n"); 139 printk(KERN_ERR PFX "MPU401 PnP configure failure\n");
@@ -186,7 +144,6 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
186 mpu_irq[dev] = pnp_irq(pdev, 0); 144 mpu_irq[dev] = pnp_irq(pdev, 0);
187 } 145 }
188 146
189 kfree(cfg);
190 return 0; 147 return 0;
191} 148}
192 149
diff --git a/sound/isa/als100.c b/sound/isa/als100.c
index f2bcfb2cf5f5..35e25e5878e0 100644
--- a/sound/isa/als100.c
+++ b/sound/isa/als100.c
@@ -63,20 +63,6 @@ module_param_array(id, charp, NULL, 0444);
63MODULE_PARM_DESC(id, "ID string for als100 based soundcard."); 63MODULE_PARM_DESC(id, "ID string for als100 based soundcard.");
64module_param_array(enable, bool, NULL, 0444); 64module_param_array(enable, bool, NULL, 0444);
65MODULE_PARM_DESC(enable, "Enable als100 based soundcard."); 65MODULE_PARM_DESC(enable, "Enable als100 based soundcard.");
66module_param_array(port, long, NULL, 0444);
67MODULE_PARM_DESC(port, "Port # for als100 driver.");
68module_param_array(mpu_port, long, NULL, 0444);
69MODULE_PARM_DESC(mpu_port, "MPU-401 port # for als100 driver.");
70module_param_array(fm_port, long, NULL, 0444);
71MODULE_PARM_DESC(fm_port, "FM port # for als100 driver.");
72module_param_array(irq, int, NULL, 0444);
73MODULE_PARM_DESC(irq, "IRQ # for als100 driver.");
74module_param_array(mpu_irq, int, NULL, 0444);
75MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for als100 driver.");
76module_param_array(dma8, int, NULL, 0444);
77MODULE_PARM_DESC(dma8, "8-bit DMA # for als100 driver.");
78module_param_array(dma16, int, NULL, 0444);
79MODULE_PARM_DESC(dma16, "16-bit DMA # for als100 driver.");
80 66
81struct snd_card_als100 { 67struct snd_card_als100 {
82 int dev_no; 68 int dev_no;
@@ -111,38 +97,20 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,
111 const struct pnp_card_device_id *id) 97 const struct pnp_card_device_id *id)
112{ 98{
113 struct pnp_dev *pdev; 99 struct pnp_dev *pdev;
114 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
115 int err; 100 int err;
116 101
117 if (!cfg)
118 return -ENOMEM;
119 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 102 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
120 if (acard->dev == NULL) { 103 if (acard->dev == NULL)
121 kfree(cfg);
122 return -ENODEV; 104 return -ENODEV;
123 } 105
124 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, acard->dev); 106 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, acard->dev);
125 acard->devopl = pnp_request_card_device(card, id->devs[2].id, acard->dev); 107 acard->devopl = pnp_request_card_device(card, id->devs[2].id, acard->dev);
126 108
127 pdev = acard->dev; 109 pdev = acard->dev;
128 110
129 pnp_init_resource_table(cfg);
130
131 /* override resources */
132 if (port[dev] != SNDRV_AUTO_PORT)
133 pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
134 if (dma8[dev] != SNDRV_AUTO_DMA)
135 pnp_resource_change(&cfg->dma_resource[0], dma8[dev], 1);
136 if (dma16[dev] != SNDRV_AUTO_DMA)
137 pnp_resource_change(&cfg->dma_resource[1], dma16[dev], 1);
138 if (irq[dev] != SNDRV_AUTO_IRQ)
139 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
140 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
141 snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
142 err = pnp_activate_dev(pdev); 111 err = pnp_activate_dev(pdev);
143 if (err < 0) { 112 if (err < 0) {
144 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n"); 113 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n");
145 kfree(cfg);
146 return err; 114 return err;
147 } 115 }
148 port[dev] = pnp_port_start(pdev, 0); 116 port[dev] = pnp_port_start(pdev, 0);
@@ -152,13 +120,6 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,
152 120
153 pdev = acard->devmpu; 121 pdev = acard->devmpu;
154 if (pdev != NULL) { 122 if (pdev != NULL) {
155 pnp_init_resource_table(cfg);
156 if (mpu_port[dev] != SNDRV_AUTO_PORT)
157 pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
158 if (mpu_irq[dev] != SNDRV_AUTO_IRQ)
159 pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
160 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
161 snd_printk(KERN_ERR PFX "MPU401 the requested resources are invalid, using auto config\n");
162 err = pnp_activate_dev(pdev); 123 err = pnp_activate_dev(pdev);
163 if (err < 0) 124 if (err < 0)
164 goto __mpu_error; 125 goto __mpu_error;
@@ -176,11 +137,6 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,
176 137
177 pdev = acard->devopl; 138 pdev = acard->devopl;
178 if (pdev != NULL) { 139 if (pdev != NULL) {
179 pnp_init_resource_table(cfg);
180 if (fm_port[dev] != SNDRV_AUTO_PORT)
181 pnp_resource_change(&cfg->port_resource[0], fm_port[dev], 4);
182 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
183 snd_printk(KERN_ERR PFX "OPL3 the requested resources are invalid, using auto config\n");
184 err = pnp_activate_dev(pdev); 140 err = pnp_activate_dev(pdev);
185 if (err < 0) 141 if (err < 0)
186 goto __fm_error; 142 goto __fm_error;
@@ -195,7 +151,6 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,
195 fm_port[dev] = -1; 151 fm_port[dev] = -1;
196 } 152 }
197 153
198 kfree(cfg);
199 return 0; 154 return 0;
200} 155}
201 156
diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c
index b615538a928d..bfe3a255815c 100644
--- a/sound/isa/azt2320.c
+++ b/sound/isa/azt2320.c
@@ -72,22 +72,6 @@ module_param_array(id, charp, NULL, 0444);
72MODULE_PARM_DESC(id, "ID string for azt2320 based soundcard."); 72MODULE_PARM_DESC(id, "ID string for azt2320 based soundcard.");
73module_param_array(enable, bool, NULL, 0444); 73module_param_array(enable, bool, NULL, 0444);
74MODULE_PARM_DESC(enable, "Enable azt2320 based soundcard."); 74MODULE_PARM_DESC(enable, "Enable azt2320 based soundcard.");
75module_param_array(port, long, NULL, 0444);
76MODULE_PARM_DESC(port, "Port # for azt2320 driver.");
77module_param_array(wss_port, long, NULL, 0444);
78MODULE_PARM_DESC(wss_port, "WSS Port # for azt2320 driver.");
79module_param_array(mpu_port, long, NULL, 0444);
80MODULE_PARM_DESC(mpu_port, "MPU-401 port # for azt2320 driver.");
81module_param_array(fm_port, long, NULL, 0444);
82MODULE_PARM_DESC(fm_port, "FM port # for azt2320 driver.");
83module_param_array(irq, int, NULL, 0444);
84MODULE_PARM_DESC(irq, "IRQ # for azt2320 driver.");
85module_param_array(mpu_irq, int, NULL, 0444);
86MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for azt2320 driver.");
87module_param_array(dma1, int, NULL, 0444);
88MODULE_PARM_DESC(dma1, "1st DMA # for azt2320 driver.");
89module_param_array(dma2, int, NULL, 0444);
90MODULE_PARM_DESC(dma2, "2nd DMA # for azt2320 driver.");
91 75
92struct snd_card_azt2320 { 76struct snd_card_azt2320 {
93 int dev_no; 77 int dev_no;
@@ -121,43 +105,19 @@ static int __devinit snd_card_azt2320_pnp(int dev, struct snd_card_azt2320 *acar
121 const struct pnp_card_device_id *id) 105 const struct pnp_card_device_id *id)
122{ 106{
123 struct pnp_dev *pdev; 107 struct pnp_dev *pdev;
124 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
125 int err; 108 int err;
126 109
127 if (!cfg)
128 return -ENOMEM;
129
130 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 110 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
131 if (acard->dev == NULL) { 111 if (acard->dev == NULL)
132 kfree(cfg);
133 return -ENODEV; 112 return -ENODEV;
134 }
135 113
136 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL); 114 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL);
137 115
138 pdev = acard->dev; 116 pdev = acard->dev;
139 pnp_init_resource_table(cfg);
140
141 /* override resources */
142 if (port[dev] != SNDRV_AUTO_PORT)
143 pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
144 if (fm_port[dev] != SNDRV_AUTO_PORT)
145 pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4);
146 if (wss_port[dev] != SNDRV_AUTO_PORT)
147 pnp_resource_change(&cfg->port_resource[2], wss_port[dev], 4);
148 if (dma1[dev] != SNDRV_AUTO_DMA)
149 pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
150 if (dma2[dev] != SNDRV_AUTO_DMA)
151 pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1);
152 if (irq[dev] != SNDRV_AUTO_IRQ)
153 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
154 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
155 snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
156 117
157 err = pnp_activate_dev(pdev); 118 err = pnp_activate_dev(pdev);
158 if (err < 0) { 119 if (err < 0) {
159 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n"); 120 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n");
160 kfree(cfg);
161 return err; 121 return err;
162 } 122 }
163 port[dev] = pnp_port_start(pdev, 0); 123 port[dev] = pnp_port_start(pdev, 0);
@@ -169,13 +129,6 @@ static int __devinit snd_card_azt2320_pnp(int dev, struct snd_card_azt2320 *acar
169 129
170 pdev = acard->devmpu; 130 pdev = acard->devmpu;
171 if (pdev != NULL) { 131 if (pdev != NULL) {
172 pnp_init_resource_table(cfg);
173 if (mpu_port[dev] != SNDRV_AUTO_PORT)
174 pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
175 if (mpu_irq[dev] != SNDRV_AUTO_IRQ)
176 pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
177 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
178 snd_printk(KERN_ERR PFX "MPU401 the requested resources are invalid, using auto config\n");
179 err = pnp_activate_dev(pdev); 132 err = pnp_activate_dev(pdev);
180 if (err < 0) 133 if (err < 0)
181 goto __mpu_error; 134 goto __mpu_error;
@@ -191,7 +144,6 @@ static int __devinit snd_card_azt2320_pnp(int dev, struct snd_card_azt2320 *acar
191 mpu_port[dev] = -1; 144 mpu_port[dev] = -1;
192 } 145 }
193 146
194 kfree (cfg);
195 return 0; 147 return 0;
196} 148}
197 149
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index f471f8ad6885..c166e13d17ec 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -286,39 +286,21 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
286 const struct pnp_card_device_id *id) 286 const struct pnp_card_device_id *id)
287{ 287{
288 struct pnp_dev *pdev; 288 struct pnp_dev *pdev;
289 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
290 int err; 289 int err;
291 290
292 if (!cfg)
293 return -ENOMEM;
294 acard->cap = pnp_request_card_device(card, id->devs[0].id, NULL); 291 acard->cap = pnp_request_card_device(card, id->devs[0].id, NULL);
295 if (acard->cap == NULL) { 292 if (acard->cap == NULL)
296 kfree(cfg);
297 return -EBUSY; 293 return -EBUSY;
298 } 294
299 acard->play = pnp_request_card_device(card, id->devs[1].id, NULL); 295 acard->play = pnp_request_card_device(card, id->devs[1].id, NULL);
300 if (acard->play == NULL) { 296 if (acard->play == NULL)
301 kfree(cfg);
302 return -EBUSY; 297 return -EBUSY;
303 }
304 298
305 pdev = acard->cap; 299 pdev = acard->cap;
306 pnp_init_resource_table(cfg); 300
307 /* allocate AD1848 resources */
308 if (wssport[dev] != SNDRV_AUTO_PORT)
309 pnp_resource_change(&cfg->port_resource[0], wssport[dev], 8);
310 if (wssdma[dev] != SNDRV_AUTO_DMA)
311 pnp_resource_change(&cfg->dma_resource[0], wssdma[dev], 1);
312 if (wssirq[dev] != SNDRV_AUTO_IRQ)
313 pnp_resource_change(&cfg->irq_resource[0], wssirq[dev], 1);
314
315 err = pnp_manual_config_dev(pdev, cfg, 0);
316 if (err < 0)
317 snd_printk(KERN_ERR "CMI8330/C3D (AD1848) PnP manual resources are invalid, using auto config\n");
318 err = pnp_activate_dev(pdev); 301 err = pnp_activate_dev(pdev);
319 if (err < 0) { 302 if (err < 0) {
320 snd_printk(KERN_ERR "CMI8330/C3D (AD1848) PnP configure failure\n"); 303 snd_printk(KERN_ERR "CMI8330/C3D (AD1848) PnP configure failure\n");
321 kfree(cfg);
322 return -EBUSY; 304 return -EBUSY;
323 } 305 }
324 wssport[dev] = pnp_port_start(pdev, 0); 306 wssport[dev] = pnp_port_start(pdev, 0);
@@ -327,23 +309,10 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
327 309
328 /* allocate SB16 resources */ 310 /* allocate SB16 resources */
329 pdev = acard->play; 311 pdev = acard->play;
330 pnp_init_resource_table(cfg); 312
331 if (sbport[dev] != SNDRV_AUTO_PORT)
332 pnp_resource_change(&cfg->port_resource[0], sbport[dev], 16);
333 if (sbdma8[dev] != SNDRV_AUTO_DMA)
334 pnp_resource_change(&cfg->dma_resource[0], sbdma8[dev], 1);
335 if (sbdma16[dev] != SNDRV_AUTO_DMA)
336 pnp_resource_change(&cfg->dma_resource[1], sbdma16[dev], 1);
337 if (sbirq[dev] != SNDRV_AUTO_IRQ)
338 pnp_resource_change(&cfg->irq_resource[0], sbirq[dev], 1);
339
340 err = pnp_manual_config_dev(pdev, cfg, 0);
341 if (err < 0)
342 snd_printk(KERN_ERR "CMI8330/C3D (SB16) PnP manual resources are invalid, using auto config\n");
343 err = pnp_activate_dev(pdev); 313 err = pnp_activate_dev(pdev);
344 if (err < 0) { 314 if (err < 0) {
345 snd_printk(KERN_ERR "CMI8330/C3D (SB16) PnP configure failure\n"); 315 snd_printk(KERN_ERR "CMI8330/C3D (SB16) PnP configure failure\n");
346 kfree(cfg);
347 return -EBUSY; 316 return -EBUSY;
348 } 317 }
349 sbport[dev] = pnp_port_start(pdev, 0); 318 sbport[dev] = pnp_port_start(pdev, 0);
@@ -351,7 +320,6 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
351 sbdma16[dev] = pnp_dma(pdev, 1); 320 sbdma16[dev] = pnp_dma(pdev, 1);
352 sbirq[dev] = pnp_irq(pdev, 0); 321 sbirq[dev] = pnp_irq(pdev, 0);
353 322
354 kfree(cfg);
355 return 0; 323 return 0;
356} 324}
357#endif 325#endif
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 5784b43f4123..0a3fece40f8b 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -270,29 +270,9 @@ static struct pnp_card_device_id snd_cs423x_pnpids[] = {
270MODULE_DEVICE_TABLE(pnp_card, snd_cs423x_pnpids); 270MODULE_DEVICE_TABLE(pnp_card, snd_cs423x_pnpids);
271 271
272/* WSS initialization */ 272/* WSS initialization */
273static int __devinit snd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev, 273static int __devinit snd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev)
274 struct pnp_resource_table *cfg)
275{ 274{
276 int err; 275 if (pnp_activate_dev(pdev) < 0) {
277
278 pnp_init_resource_table(cfg);
279 if (port[dev] != SNDRV_AUTO_PORT)
280 pnp_resource_change(&cfg->port_resource[0], port[dev], 4);
281 if (fm_port[dev] != SNDRV_AUTO_PORT && fm_port[dev] > 0)
282 pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4);
283 if (sb_port[dev] != SNDRV_AUTO_PORT)
284 pnp_resource_change(&cfg->port_resource[2], sb_port[dev], 16);
285 if (irq[dev] != SNDRV_AUTO_IRQ)
286 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
287 if (dma1[dev] != SNDRV_AUTO_DMA)
288 pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
289 if (dma2[dev] != SNDRV_AUTO_DMA)
290 pnp_resource_change(&cfg->dma_resource[1], dma2[dev] < 0 ? 4 : dma2[dev], 1);
291 err = pnp_manual_config_dev(pdev, cfg, 0);
292 if (err < 0)
293 snd_printk(KERN_ERR IDENT " WSS PnP manual resources are invalid, using auto config\n");
294 err = pnp_activate_dev(pdev);
295 if (err < 0) {
296 printk(KERN_ERR IDENT " WSS PnP configure failed for WSS (out of resources?)\n"); 276 printk(KERN_ERR IDENT " WSS PnP configure failed for WSS (out of resources?)\n");
297 return -EBUSY; 277 return -EBUSY;
298 } 278 }
@@ -311,19 +291,9 @@ static int __devinit snd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev,
311} 291}
312 292
313/* CTRL initialization */ 293/* CTRL initialization */
314static int __devinit snd_cs423x_pnp_init_ctrl(int dev, struct pnp_dev *pdev, 294static int __devinit snd_cs423x_pnp_init_ctrl(int dev, struct pnp_dev *pdev)
315 struct pnp_resource_table *cfg)
316{ 295{
317 int err; 296 if (pnp_activate_dev(pdev) < 0) {
318
319 pnp_init_resource_table(cfg);
320 if (cport[dev] != SNDRV_AUTO_PORT)
321 pnp_resource_change(&cfg->port_resource[0], cport[dev], 8);
322 err = pnp_manual_config_dev(pdev, cfg, 0);
323 if (err < 0)
324 snd_printk(KERN_ERR IDENT " CTRL PnP manual resources are invalid, using auto config\n");
325 err = pnp_activate_dev(pdev);
326 if (err < 0) {
327 printk(KERN_ERR IDENT " CTRL PnP configure failed for WSS (out of resources?)\n"); 297 printk(KERN_ERR IDENT " CTRL PnP configure failed for WSS (out of resources?)\n");
328 return -EBUSY; 298 return -EBUSY;
329 } 299 }
@@ -333,21 +303,9 @@ static int __devinit snd_cs423x_pnp_init_ctrl(int dev, struct pnp_dev *pdev,
333} 303}
334 304
335/* MPU initialization */ 305/* MPU initialization */
336static int __devinit snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev, 306static int __devinit snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
337 struct pnp_resource_table *cfg)
338{ 307{
339 int err; 308 if (pnp_activate_dev(pdev) < 0) {
340
341 pnp_init_resource_table(cfg);
342 if (mpu_port[dev] != SNDRV_AUTO_PORT)
343 pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
344 if (mpu_irq[dev] != SNDRV_AUTO_IRQ && mpu_irq[dev] >= 0)
345 pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
346 err = pnp_manual_config_dev(pdev, cfg, 0);
347 if (err < 0)
348 snd_printk(KERN_ERR IDENT " MPU401 PnP manual resources are invalid, using auto config\n");
349 err = pnp_activate_dev(pdev);
350 if (err < 0) {
351 printk(KERN_ERR IDENT " MPU401 PnP configure failed for WSS (out of resources?)\n"); 309 printk(KERN_ERR IDENT " MPU401 PnP configure failed for WSS (out of resources?)\n");
352 mpu_port[dev] = SNDRV_AUTO_PORT; 310 mpu_port[dev] = SNDRV_AUTO_PORT;
353 mpu_irq[dev] = SNDRV_AUTO_IRQ; 311 mpu_irq[dev] = SNDRV_AUTO_IRQ;
@@ -368,15 +326,8 @@ static int __devinit snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev,
368static int __devinit snd_card_cs4232_pnp(int dev, struct snd_card_cs4236 *acard, 326static int __devinit snd_card_cs4232_pnp(int dev, struct snd_card_cs4236 *acard,
369 struct pnp_dev *pdev) 327 struct pnp_dev *pdev)
370{ 328{
371 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); 329 if (snd_cs423x_pnp_init_wss(dev, acard->wss) < 0)
372
373 if (!cfg)
374 return -ENOMEM;
375 if (snd_cs423x_pnp_init_wss(dev, acard->wss, cfg) < 0) {
376 kfree(cfg);
377 return -EBUSY; 330 return -EBUSY;
378 }
379 kfree(cfg);
380 cport[dev] = -1; 331 cport[dev] = -1;
381 return 0; 332 return 0;
382} 333}
@@ -386,43 +337,33 @@ static int __devinit snd_card_cs423x_pnpc(int dev, struct snd_card_cs4236 *acard
386 struct pnp_card_link *card, 337 struct pnp_card_link *card,
387 const struct pnp_card_device_id *id) 338 const struct pnp_card_device_id *id)
388{ 339{
389 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
390
391 if (!cfg)
392 return -ENOMEM;
393
394 acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL); 340 acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL);
395 if (acard->wss == NULL) 341 if (acard->wss == NULL)
396 goto error; 342 return -EBUSY;
397 acard->ctrl = pnp_request_card_device(card, id->devs[1].id, NULL); 343 acard->ctrl = pnp_request_card_device(card, id->devs[1].id, NULL);
398 if (acard->ctrl == NULL) 344 if (acard->ctrl == NULL)
399 goto error; 345 return -EBUSY;
400 if (id->devs[2].id[0]) { 346 if (id->devs[2].id[0]) {
401 acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL); 347 acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL);
402 if (acard->mpu == NULL) 348 if (acard->mpu == NULL)
403 goto error; 349 return -EBUSY;
404 } 350 }
405 351
406 /* WSS initialization */ 352 /* WSS initialization */
407 if (snd_cs423x_pnp_init_wss(dev, acard->wss, cfg) < 0) 353 if (snd_cs423x_pnp_init_wss(dev, acard->wss) < 0)
408 goto error; 354 return -EBUSY;
409 355
410 /* CTRL initialization */ 356 /* CTRL initialization */
411 if (acard->ctrl && cport[dev] > 0) { 357 if (acard->ctrl && cport[dev] > 0) {
412 if (snd_cs423x_pnp_init_ctrl(dev, acard->ctrl, cfg) < 0) 358 if (snd_cs423x_pnp_init_ctrl(dev, acard->ctrl) < 0)
413 goto error; 359 return -EBUSY;
414 } 360 }
415 /* MPU initialization */ 361 /* MPU initialization */
416 if (acard->mpu && mpu_port[dev] > 0) { 362 if (acard->mpu && mpu_port[dev] > 0) {
417 if (snd_cs423x_pnp_init_mpu(dev, acard->mpu, cfg) < 0) 363 if (snd_cs423x_pnp_init_mpu(dev, acard->mpu) < 0)
418 goto error; 364 return -EBUSY;
419 } 365 }
420 kfree(cfg);
421 return 0; 366 return 0;
422
423 error:
424 kfree(cfg);
425 return -EBUSY;
426} 367}
427#endif /* CONFIG_PNP */ 368#endif /* CONFIG_PNP */
428 369
diff --git a/sound/isa/dt019x.c b/sound/isa/dt019x.c
index ce57d526f7bc..ab689f948aea 100644
--- a/sound/isa/dt019x.c
+++ b/sound/isa/dt019x.c
@@ -56,18 +56,6 @@ module_param_array(id, charp, NULL, 0444);
56MODULE_PARM_DESC(id, "ID string for DT-019X based soundcard."); 56MODULE_PARM_DESC(id, "ID string for DT-019X based soundcard.");
57module_param_array(enable, bool, NULL, 0444); 57module_param_array(enable, bool, NULL, 0444);
58MODULE_PARM_DESC(enable, "Enable DT-019X based soundcard."); 58MODULE_PARM_DESC(enable, "Enable DT-019X based soundcard.");
59module_param_array(port, long, NULL, 0444);
60MODULE_PARM_DESC(port, "Port # for dt019x driver.");
61module_param_array(mpu_port, long, NULL, 0444);
62MODULE_PARM_DESC(mpu_port, "MPU-401 port # for dt019x driver.");
63module_param_array(fm_port, long, NULL, 0444);
64MODULE_PARM_DESC(fm_port, "FM port # for dt019x driver.");
65module_param_array(irq, int, NULL, 0444);
66MODULE_PARM_DESC(irq, "IRQ # for dt019x driver.");
67module_param_array(mpu_irq, int, NULL, 0444);
68MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for dt019x driver.");
69module_param_array(dma8, int, NULL, 0444);
70MODULE_PARM_DESC(dma8, "8-bit DMA # for dt019x driver.");
71 59
72struct snd_card_dt019x { 60struct snd_card_dt019x {
73 struct pnp_dev *dev; 61 struct pnp_dev *dev;
@@ -95,36 +83,20 @@ static int __devinit snd_card_dt019x_pnp(int dev, struct snd_card_dt019x *acard,
95 const struct pnp_card_device_id *pid) 83 const struct pnp_card_device_id *pid)
96{ 84{
97 struct pnp_dev *pdev; 85 struct pnp_dev *pdev;
98 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
99 int err; 86 int err;
100 87
101 if (!cfg)
102 return -ENOMEM;
103
104 acard->dev = pnp_request_card_device(card, pid->devs[0].id, NULL); 88 acard->dev = pnp_request_card_device(card, pid->devs[0].id, NULL);
105 if (acard->dev == NULL) { 89 if (acard->dev == NULL)
106 kfree (cfg);
107 return -ENODEV; 90 return -ENODEV;
108 } 91
109 acard->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL); 92 acard->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL);
110 acard->devopl = pnp_request_card_device(card, pid->devs[2].id, NULL); 93 acard->devopl = pnp_request_card_device(card, pid->devs[2].id, NULL);
111 94
112 pdev = acard->dev; 95 pdev = acard->dev;
113 pnp_init_resource_table(cfg);
114
115 if (port[dev] != SNDRV_AUTO_PORT)
116 pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
117 if (dma8[dev] != SNDRV_AUTO_DMA)
118 pnp_resource_change(&cfg->dma_resource[0], dma8[dev], 1);
119 if (irq[dev] != SNDRV_AUTO_IRQ)
120 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
121 96
122 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
123 snd_printk(KERN_ERR PFX "DT-019X AUDIO the requested resources are invalid, using auto config\n");
124 err = pnp_activate_dev(pdev); 97 err = pnp_activate_dev(pdev);
125 if (err < 0) { 98 if (err < 0) {
126 snd_printk(KERN_ERR PFX "DT-019X AUDIO pnp configure failure\n"); 99 snd_printk(KERN_ERR PFX "DT-019X AUDIO pnp configure failure\n");
127 kfree(cfg);
128 return err; 100 return err;
129 } 101 }
130 102
@@ -135,15 +107,7 @@ static int __devinit snd_card_dt019x_pnp(int dev, struct snd_card_dt019x *acard,
135 port[dev],irq[dev],dma8[dev]); 107 port[dev],irq[dev],dma8[dev]);
136 108
137 pdev = acard->devmpu; 109 pdev = acard->devmpu;
138
139 if (pdev != NULL) { 110 if (pdev != NULL) {
140 pnp_init_resource_table(cfg);
141 if (mpu_port[dev] != SNDRV_AUTO_PORT)
142 pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
143 if (mpu_irq[dev] != SNDRV_AUTO_IRQ)
144 pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
145 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
146 snd_printk(KERN_ERR PFX "DT-019X MPU401 the requested resources are invalid, using auto config\n");
147 err = pnp_activate_dev(pdev); 111 err = pnp_activate_dev(pdev);
148 if (err < 0) { 112 if (err < 0) {
149 pnp_release_card_device(pdev); 113 pnp_release_card_device(pdev);
@@ -162,11 +126,6 @@ static int __devinit snd_card_dt019x_pnp(int dev, struct snd_card_dt019x *acard,
162 126
163 pdev = acard->devopl; 127 pdev = acard->devopl;
164 if (pdev != NULL) { 128 if (pdev != NULL) {
165 pnp_init_resource_table(cfg);
166 if (fm_port[dev] != SNDRV_AUTO_PORT)
167 pnp_resource_change(&cfg->port_resource[0], fm_port[dev], 4);
168 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
169 snd_printk(KERN_ERR PFX "DT-019X OPL3 the requested resources are invalid, using auto config\n");
170 err = pnp_activate_dev(pdev); 129 err = pnp_activate_dev(pdev);
171 if (err < 0) { 130 if (err < 0) {
172 pnp_release_card_device(pdev); 131 pnp_release_card_device(pdev);
@@ -181,7 +140,6 @@ static int __devinit snd_card_dt019x_pnp(int dev, struct snd_card_dt019x *acard,
181 fm_port[dev] = -1; 140 fm_port[dev] = -1;
182 } 141 }
183 142
184 kfree(cfg);
185 return 0; 143 return 0;
186} 144}
187 145
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[] = {
2035MODULE_DEVICE_TABLE(pnp, snd_audiodrive_pnpbiosids); 2035MODULE_DEVICE_TABLE(pnp, snd_audiodrive_pnpbiosids);
2036 2036
2037/* PnP main device initialization */ 2037/* PnP main device initialization */
2038static int __devinit snd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev, 2038static 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,
2087static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard, 2065static 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 */
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 2091c50b2e3e..9381d1e8ad75 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -560,50 +560,27 @@ static int __devinit snd_interwave_pnp(int dev, struct snd_interwave *iwcard,
560 const struct pnp_card_device_id *id) 560 const struct pnp_card_device_id *id)
561{ 561{
562 struct pnp_dev *pdev; 562 struct pnp_dev *pdev;
563 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
564 int err; 563 int err;
565 564
566 if (!cfg)
567 return -ENOMEM;
568 iwcard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 565 iwcard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
569 if (iwcard->dev == NULL) { 566 if (iwcard->dev == NULL)
570 kfree(cfg);
571 return -EBUSY; 567 return -EBUSY;
572 } 568
573#ifdef SNDRV_STB 569#ifdef SNDRV_STB
574 iwcard->devtc = pnp_request_card_device(card, id->devs[1].id, NULL); 570 iwcard->devtc = pnp_request_card_device(card, id->devs[1].id, NULL);
575 if (iwcard->devtc == NULL) { 571 if (iwcard->devtc == NULL)
576 kfree(cfg);
577 return -EBUSY; 572 return -EBUSY;
578 }
579#endif 573#endif
580 /* Synth & Codec initialization */ 574 /* Synth & Codec initialization */
581 pdev = iwcard->dev; 575 pdev = iwcard->dev;
582 pnp_init_resource_table(cfg); 576
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); 577 err = pnp_activate_dev(pdev);
599 if (err < 0) { 578 if (err < 0) {
600 kfree(cfg);
601 snd_printk(KERN_ERR "InterWave PnP configure failure (out of resources?)\n"); 579 snd_printk(KERN_ERR "InterWave PnP configure failure (out of resources?)\n");
602 return err; 580 return err;
603 } 581 }
604 if (pnp_port_start(pdev, 0) + 0x100 != pnp_port_start(pdev, 1) || 582 if (pnp_port_start(pdev, 0) + 0x100 != pnp_port_start(pdev, 1) ||
605 pnp_port_start(pdev, 0) + 0x10c != pnp_port_start(pdev, 2)) { 583 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"); 584 snd_printk(KERN_ERR "PnP configure failure (wrong ports)\n");
608 return -ENOENT; 585 return -ENOENT;
609 } 586 }
@@ -620,21 +597,15 @@ static int __devinit snd_interwave_pnp(int dev, struct snd_interwave *iwcard,
620#ifdef SNDRV_STB 597#ifdef SNDRV_STB
621 /* Tone Control initialization */ 598 /* Tone Control initialization */
622 pdev = iwcard->devtc; 599 pdev = iwcard->devtc;
623 pnp_init_resource_table(cfg); 600
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); 601 err = pnp_activate_dev(pdev);
629 if (err < 0) { 602 if (err < 0) {
630 kfree(cfg);
631 snd_printk(KERN_ERR "InterWave ToneControl PnP configure failure (out of resources?)\n"); 603 snd_printk(KERN_ERR "InterWave ToneControl PnP configure failure (out of resources?)\n");
632 return err; 604 return err;
633 } 605 }
634 port_tc[dev] = pnp_port_start(pdev, 0); 606 port_tc[dev] = pnp_port_start(pdev, 0);
635 snd_printdd("isapnp IW: tone control port=0x%lx\n", port_tc[dev]); 607 snd_printdd("isapnp IW: tone control port=0x%lx\n", port_tc[dev]);
636#endif 608#endif
637 kfree(cfg);
638 return 0; 609 return 0;
639} 610}
640#endif /* CONFIG_PNP */ 611#endif /* CONFIG_PNP */
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 59af9ab7191f..125f6994bfb1 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -610,39 +610,8 @@ static int snd_opl3sa2_resume(struct snd_card *card)
610static int __devinit snd_opl3sa2_pnp(int dev, struct snd_opl3sa2 *chip, 610static int __devinit snd_opl3sa2_pnp(int dev, struct snd_opl3sa2 *chip,
611 struct pnp_dev *pdev) 611 struct pnp_dev *pdev)
612{ 612{
613 struct pnp_resource_table * cfg; 613 if (pnp_activate_dev(pdev) < 0) {
614 int err; 614 snd_printk(KERN_ERR "PnP configure failure (out of resources?)\n");
615
616 cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
617 if (!cfg) {
618 snd_printk(KERN_ERR PFX "cannot allocate pnp cfg\n");
619 return -ENOMEM;
620 }
621 /* PnP initialization */
622 pnp_init_resource_table(cfg);
623 if (sb_port[dev] != SNDRV_AUTO_PORT)
624 pnp_resource_change(&cfg->port_resource[0], sb_port[dev], 16);
625 if (wss_port[dev] != SNDRV_AUTO_PORT)
626 pnp_resource_change(&cfg->port_resource[1], wss_port[dev], 8);
627 if (fm_port[dev] != SNDRV_AUTO_PORT)
628 pnp_resource_change(&cfg->port_resource[2], fm_port[dev], 4);
629 if (midi_port[dev] != SNDRV_AUTO_PORT)
630 pnp_resource_change(&cfg->port_resource[3], midi_port[dev], 2);
631 if (port[dev] != SNDRV_AUTO_PORT)
632 pnp_resource_change(&cfg->port_resource[4], port[dev], 2);
633 if (dma1[dev] != SNDRV_AUTO_DMA)
634 pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
635 if (dma2[dev] != SNDRV_AUTO_DMA)
636 pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1);
637 if (irq[dev] != SNDRV_AUTO_IRQ)
638 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
639 err = pnp_manual_config_dev(pdev, cfg, 0);
640 if (err < 0)
641 snd_printk(KERN_WARNING "PnP manual resources are invalid, using auto config\n");
642 err = pnp_activate_dev(pdev);
643 if (err < 0) {
644 kfree(cfg);
645 snd_printk(KERN_ERR "PnP configure failure (out of resources?) err = %d\n", err);
646 return -EBUSY; 615 return -EBUSY;
647 } 616 }
648 sb_port[dev] = pnp_port_start(pdev, 0); 617 sb_port[dev] = pnp_port_start(pdev, 0);
@@ -657,7 +626,6 @@ static int __devinit snd_opl3sa2_pnp(int dev, struct snd_opl3sa2 *chip,
657 pnp_device_is_pnpbios(pdev) ? "BIOS" : "ISA", sb_port[dev], wss_port[dev], fm_port[dev], midi_port[dev]); 626 pnp_device_is_pnpbios(pdev) ? "BIOS" : "ISA", sb_port[dev], wss_port[dev], fm_port[dev], midi_port[dev]);
658 snd_printdd("%sPnP OPL3-SA: control port=0x%lx, dma1=%i, dma2=%i, irq=%i\n", 627 snd_printdd("%sPnP OPL3-SA: control port=0x%lx, dma1=%i, dma2=%i, irq=%i\n",
659 pnp_device_is_pnpbios(pdev) ? "BIOS" : "ISA", port[dev], dma1[dev], dma2[dev], irq[dev]); 628 pnp_device_is_pnpbios(pdev) ? "BIOS" : "ISA", port[dev], dma1[dev], dma2[dev], irq[dev]);
660 kfree(cfg);
661 return 0; 629 return 0;
662} 630}
663#endif /* CONFIG_PNP */ 631#endif /* CONFIG_PNP */
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index ee1a824d8fc0..9300cf371ee8 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -1690,53 +1690,19 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
1690 const struct pnp_card_device_id *pid) 1690 const struct pnp_card_device_id *pid)
1691{ 1691{
1692 struct pnp_dev *pdev; 1692 struct pnp_dev *pdev;
1693 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
1694 int err; 1693 int err;
1695 1694
1696 if (!cfg)
1697 return -ENOMEM;
1698 chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL); 1695 chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL);
1699 if (chip->dev == NULL) { 1696 if (chip->dev == NULL)
1700 kfree(cfg);
1701 return -EBUSY; 1697 return -EBUSY;
1702 } 1698
1703 chip->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL); 1699 chip->devmpu = pnp_request_card_device(card, pid->devs[1].id, NULL);
1704 1700
1705 pdev = chip->dev; 1701 pdev = chip->dev;
1706 pnp_init_resource_table(cfg);
1707 1702
1708#ifdef OPTi93X
1709 if (port != SNDRV_AUTO_PORT)
1710 pnp_resource_change(&cfg->port_resource[0], port + 4, 4);
1711#else
1712 if (pid->driver_data != 0x0924 && port != SNDRV_AUTO_PORT)
1713 pnp_resource_change(&cfg->port_resource[1], port, 4);
1714#endif /* OPTi93X */
1715 if (irq != SNDRV_AUTO_IRQ)
1716 pnp_resource_change(&cfg->irq_resource[0], irq, 1);
1717 if (dma1 != SNDRV_AUTO_DMA)
1718 pnp_resource_change(&cfg->dma_resource[0], dma1, 1);
1719#if defined(CS4231) || defined(OPTi93X)
1720 if (dma2 != SNDRV_AUTO_DMA)
1721 pnp_resource_change(&cfg->dma_resource[1], dma2, 1);
1722#else
1723#ifdef snd_opti9xx_fixup_dma2
1724 snd_opti9xx_fixup_dma2(pdev);
1725#endif
1726#endif /* CS4231 || OPTi93X */
1727#ifdef OPTi93X
1728 if (fm_port > 0 && fm_port != SNDRV_AUTO_PORT)
1729 pnp_resource_change(&cfg->port_resource[1], fm_port, 4);
1730#else
1731 if (fm_port > 0 && fm_port != SNDRV_AUTO_PORT)
1732 pnp_resource_change(&cfg->port_resource[2], fm_port, 4);
1733#endif
1734 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
1735 snd_printk(KERN_ERR "AUDIO the requested resources are invalid, using auto config\n");
1736 err = pnp_activate_dev(pdev); 1703 err = pnp_activate_dev(pdev);
1737 if (err < 0) { 1704 if (err < 0) {
1738 snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err); 1705 snd_printk(KERN_ERR "AUDIO pnp configure failure: %d\n", err);
1739 kfree(cfg);
1740 return err; 1706 return err;
1741 } 1707 }
1742 1708
@@ -1756,15 +1722,6 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
1756 1722
1757 pdev = chip->devmpu; 1723 pdev = chip->devmpu;
1758 if (pdev && mpu_port > 0) { 1724 if (pdev && mpu_port > 0) {
1759 pnp_init_resource_table(cfg);
1760
1761 if (mpu_port != SNDRV_AUTO_PORT)
1762 pnp_resource_change(&cfg->port_resource[0], mpu_port, 2);
1763 if (mpu_irq != SNDRV_AUTO_IRQ)
1764 pnp_resource_change(&cfg->irq_resource[0], mpu_irq, 1);
1765
1766 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
1767 snd_printk(KERN_ERR "AUDIO the requested resources are invalid, using auto config\n");
1768 err = pnp_activate_dev(pdev); 1725 err = pnp_activate_dev(pdev);
1769 if (err < 0) { 1726 if (err < 0) {
1770 snd_printk(KERN_ERR "AUDIO pnp configure failure\n"); 1727 snd_printk(KERN_ERR "AUDIO pnp configure failure\n");
@@ -1775,7 +1732,6 @@ static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
1775 mpu_irq = pnp_irq(pdev, 0); 1732 mpu_irq = pnp_irq(pdev, 0);
1776 } 1733 }
1777 } 1734 }
1778 kfree(cfg);
1779 return pid->driver_data; 1735 return pid->driver_data;
1780} 1736}
1781#endif /* CONFIG_PNP */ 1737#endif /* CONFIG_PNP */
diff --git a/sound/isa/sb/es968.c b/sound/isa/sb/es968.c
index d4b218726ce7..3049692bcc57 100644
--- a/sound/isa/sb/es968.c
+++ b/sound/isa/sb/es968.c
@@ -49,12 +49,6 @@ module_param_array(id, charp, NULL, 0444);
49MODULE_PARM_DESC(id, "ID string for es968 based soundcard."); 49MODULE_PARM_DESC(id, "ID string for es968 based soundcard.");
50module_param_array(enable, bool, NULL, 0444); 50module_param_array(enable, bool, NULL, 0444);
51MODULE_PARM_DESC(enable, "Enable es968 based soundcard."); 51MODULE_PARM_DESC(enable, "Enable es968 based soundcard.");
52module_param_array(port, long, NULL, 0444);
53MODULE_PARM_DESC(port, "Port # for es968 driver.");
54module_param_array(irq, int, NULL, 0444);
55MODULE_PARM_DESC(irq, "IRQ # for es968 driver.");
56module_param_array(dma8, int, NULL, 0444);
57MODULE_PARM_DESC(dma8, "8-bit DMA # for es968 driver.");
58 52
59struct snd_card_es968 { 53struct snd_card_es968 {
60 struct pnp_dev *dev; 54 struct pnp_dev *dev;
@@ -86,40 +80,23 @@ static int __devinit snd_card_es968_pnp(int dev, struct snd_card_es968 *acard,
86 const struct pnp_card_device_id *id) 80 const struct pnp_card_device_id *id)
87{ 81{
88 struct pnp_dev *pdev; 82 struct pnp_dev *pdev;
89 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
90 int err; 83 int err;
91 if (!cfg) 84
92 return -ENOMEM;
93 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 85 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
94 if (acard->dev == NULL) { 86 if (acard->dev == NULL)
95 kfree(cfg);
96 return -ENODEV; 87 return -ENODEV;
97 }
98 88
99 pdev = acard->dev; 89 pdev = acard->dev;
100 90
101 pnp_init_resource_table(cfg);
102
103 /* override resources */
104 if (port[dev] != SNDRV_AUTO_PORT)
105 pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
106 if (dma8[dev] != SNDRV_AUTO_DMA)
107 pnp_resource_change(&cfg->dma_resource[0], dma8[dev], 1);
108 if (irq[dev] != SNDRV_AUTO_IRQ)
109 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
110 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
111 snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
112 err = pnp_activate_dev(pdev); 91 err = pnp_activate_dev(pdev);
113 if (err < 0) { 92 if (err < 0) {
114 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n"); 93 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n");
115 kfree(cfg);
116 return err; 94 return err;
117 } 95 }
118 port[dev] = pnp_port_start(pdev, 0); 96 port[dev] = pnp_port_start(pdev, 0);
119 dma8[dev] = pnp_dma(pdev, 1); 97 dma8[dev] = pnp_dma(pdev, 1);
120 irq[dev] = pnp_irq(pdev, 0); 98 irq[dev] = pnp_irq(pdev, 0);
121 99
122 kfree(cfg);
123 return 0; 100 return 0;
124} 101}
125 102
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index e7f9edd92626..8e1aff77b900 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -257,44 +257,21 @@ static int __devinit snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard,
257 const struct pnp_card_device_id *id) 257 const struct pnp_card_device_id *id)
258{ 258{
259 struct pnp_dev *pdev; 259 struct pnp_dev *pdev;
260 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
261 int err; 260 int err;
262 261
263 if (!cfg)
264 return -ENOMEM;
265 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 262 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
266 if (acard->dev == NULL) { 263 if (acard->dev == NULL)
267 kfree(cfg);
268 return -ENODEV; 264 return -ENODEV;
269 } 265
270#ifdef SNDRV_SBAWE_EMU8000 266#ifdef SNDRV_SBAWE_EMU8000
271 acard->devwt = pnp_request_card_device(card, id->devs[1].id, acard->dev); 267 acard->devwt = pnp_request_card_device(card, id->devs[1].id, acard->dev);
272#endif 268#endif
273 /* Audio initialization */ 269 /* Audio initialization */
274 pdev = acard->dev; 270 pdev = acard->dev;
275 271
276 pnp_init_resource_table(cfg);
277
278 /* override resources */
279
280 if (port[dev] != SNDRV_AUTO_PORT)
281 pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
282 if (mpu_port[dev] != SNDRV_AUTO_PORT)
283 pnp_resource_change(&cfg->port_resource[1], mpu_port[dev], 2);
284 if (fm_port[dev] != SNDRV_AUTO_PORT)
285 pnp_resource_change(&cfg->port_resource[2], fm_port[dev], 4);
286 if (dma8[dev] != SNDRV_AUTO_DMA)
287 pnp_resource_change(&cfg->dma_resource[0], dma8[dev], 1);
288 if (dma16[dev] != SNDRV_AUTO_DMA)
289 pnp_resource_change(&cfg->dma_resource[1], dma16[dev], 1);
290 if (irq[dev] != SNDRV_AUTO_IRQ)
291 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
292 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
293 snd_printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n");
294 err = pnp_activate_dev(pdev); 272 err = pnp_activate_dev(pdev);
295 if (err < 0) { 273 if (err < 0) {
296 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n"); 274 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n");
297 kfree(cfg);
298 return err; 275 return err;
299 } 276 }
300 port[dev] = pnp_port_start(pdev, 0); 277 port[dev] = pnp_port_start(pdev, 0);
@@ -311,17 +288,6 @@ static int __devinit snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard,
311 /* WaveTable initialization */ 288 /* WaveTable initialization */
312 pdev = acard->devwt; 289 pdev = acard->devwt;
313 if (pdev != NULL) { 290 if (pdev != NULL) {
314 pnp_init_resource_table(cfg);
315
316 /* override resources */
317
318 if (awe_port[dev] != SNDRV_AUTO_PORT) {
319 pnp_resource_change(&cfg->port_resource[0], awe_port[dev], 4);
320 pnp_resource_change(&cfg->port_resource[1], awe_port[dev] + 0x400, 4);
321 pnp_resource_change(&cfg->port_resource[2], awe_port[dev] + 0x800, 4);
322 }
323 if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0)
324 snd_printk(KERN_ERR PFX "WaveTable the requested resources are invalid, using auto config\n");
325 err = pnp_activate_dev(pdev); 291 err = pnp_activate_dev(pdev);
326 if (err < 0) { 292 if (err < 0) {
327 goto __wt_error; 293 goto __wt_error;
@@ -339,7 +305,6 @@ __wt_error:
339 awe_port[dev] = -1; 305 awe_port[dev] = -1;
340 } 306 }
341#endif 307#endif
342 kfree(cfg);
343 return 0; 308 return 0;
344} 309}
345 310
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index 83c2fc4cfc64..15c604653428 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -104,21 +104,15 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
104 const struct pnp_card_device_id *id) 104 const struct pnp_card_device_id *id)
105{ 105{
106 struct pnp_dev *pdev; 106 struct pnp_dev *pdev;
107 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
108 int err; 107 int err;
109 108
110 if (!cfg)
111 return -ENOMEM;
112
113 /* Check for each logical device. */ 109 /* Check for each logical device. */
114 110
115 /* CS4232 chip (aka "windows sound system") is logical device 0 */ 111 /* CS4232 chip (aka "windows sound system") is logical device 0 */
116 112
117 acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL); 113 acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL);
118 if (acard->wss == NULL) { 114 if (acard->wss == NULL)
119 kfree(cfg);
120 return -EBUSY; 115 return -EBUSY;
121 }
122 116
123 /* there is a game port at logical device 1, but we ignore it completely */ 117 /* there is a game port at logical device 1, but we ignore it completely */
124 118
@@ -133,26 +127,20 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
133 127
134 if (use_cs4232_midi[dev]) { 128 if (use_cs4232_midi[dev]) {
135 acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL); 129 acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL);
136 if (acard->mpu == NULL) { 130 if (acard->mpu == NULL)
137 kfree(cfg);
138 return -EBUSY; 131 return -EBUSY;
139 }
140 } 132 }
141 133
142 /* The ICS2115 synth is logical device 4 */ 134 /* The ICS2115 synth is logical device 4 */
143 135
144 acard->synth = pnp_request_card_device(card, id->devs[3].id, NULL); 136 acard->synth = pnp_request_card_device(card, id->devs[3].id, NULL);
145 if (acard->synth == NULL) { 137 if (acard->synth == NULL)
146 kfree(cfg);
147 return -EBUSY; 138 return -EBUSY;
148 }
149 139
150 /* PCM/FM initialization */ 140 /* PCM/FM initialization */
151 141
152 pdev = acard->wss; 142 pdev = acard->wss;
153 143
154 pnp_init_resource_table(cfg);
155
156 /* An interesting note from the Tropez+ FAQ: 144 /* An interesting note from the Tropez+ FAQ:
157 145
158 Q. [Ports] Why is the base address of the WSS I/O ports off by 4? 146 Q. [Ports] Why is the base address of the WSS I/O ports off by 4?
@@ -165,23 +153,9 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
165 153
166 */ 154 */
167 155
168 if (cs4232_pcm_port[dev] != SNDRV_AUTO_PORT)
169 pnp_resource_change(&cfg->port_resource[0], cs4232_pcm_port[dev], 4);
170 if (fm_port[dev] != SNDRV_AUTO_PORT)
171 pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4);
172 if (dma1[dev] != SNDRV_AUTO_DMA)
173 pnp_resource_change(&cfg->dma_resource[0], dma1[dev], 1);
174 if (dma2[dev] != SNDRV_AUTO_DMA)
175 pnp_resource_change(&cfg->dma_resource[1], dma2[dev], 1);
176 if (cs4232_pcm_irq[dev] != SNDRV_AUTO_IRQ)
177 pnp_resource_change(&cfg->irq_resource[0], cs4232_pcm_irq[dev], 1);
178
179 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
180 snd_printk(KERN_ERR "PnP WSS the requested resources are invalid, using auto config\n");
181 err = pnp_activate_dev(pdev); 156 err = pnp_activate_dev(pdev);
182 if (err < 0) { 157 if (err < 0) {
183 snd_printk(KERN_ERR "PnP WSS pnp configure failure\n"); 158 snd_printk(KERN_ERR "PnP WSS pnp configure failure\n");
184 kfree(cfg);
185 return err; 159 return err;
186 } 160 }
187 161
@@ -195,22 +169,9 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
195 169
196 pdev = acard->synth; 170 pdev = acard->synth;
197 171
198 pnp_init_resource_table(cfg);
199
200 if (ics2115_port[dev] != SNDRV_AUTO_PORT) {
201 pnp_resource_change(&cfg->port_resource[0], ics2115_port[dev], 16);
202 }
203
204 if (ics2115_port[dev] != SNDRV_AUTO_IRQ) {
205 pnp_resource_change(&cfg->irq_resource[0], ics2115_irq[dev], 1);
206 }
207
208 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
209 snd_printk(KERN_ERR "PnP ICS2115 the requested resources are invalid, using auto config\n");
210 err = pnp_activate_dev(pdev); 172 err = pnp_activate_dev(pdev);
211 if (err < 0) { 173 if (err < 0) {
212 snd_printk(KERN_ERR "PnP ICS2115 pnp configure failure\n"); 174 snd_printk(KERN_ERR "PnP ICS2115 pnp configure failure\n");
213 kfree(cfg);
214 return err; 175 return err;
215 } 176 }
216 177
@@ -226,15 +187,6 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
226 187
227 pdev = acard->mpu; 188 pdev = acard->mpu;
228 189
229 pnp_init_resource_table(cfg);
230
231 if (cs4232_mpu_port[dev] != SNDRV_AUTO_PORT)
232 pnp_resource_change(&cfg->port_resource[0], cs4232_mpu_port[dev], 2);
233 if (cs4232_mpu_irq[dev] != SNDRV_AUTO_IRQ)
234 pnp_resource_change(&cfg->port_resource[0], cs4232_mpu_irq[dev], 1);
235
236 if (pnp_manual_config_dev(pdev, cfg, 0) < 0)
237 snd_printk(KERN_ERR "PnP MPU401 the requested resources are invalid, using auto config\n");
238 err = pnp_activate_dev(pdev); 190 err = pnp_activate_dev(pdev);
239 if (err < 0) { 191 if (err < 0) {
240 snd_printk(KERN_ERR "PnP MPU401 pnp configure failure\n"); 192 snd_printk(KERN_ERR "PnP MPU401 pnp configure failure\n");
@@ -258,7 +210,6 @@ snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *c
258 ics2115_port[dev], 210 ics2115_port[dev],
259 ics2115_irq[dev]); 211 ics2115_irq[dev]);
260 212
261 kfree(cfg);
262 return 0; 213 return 0;
263} 214}
264 215