aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf.c86
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf.h2
-rw-r--r--sound/pcmcia/vx/vxpocket.c94
-rw-r--r--sound/pcmcia/vx/vxpocket.h2
4 files changed, 58 insertions, 126 deletions
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c
index 77caf43a3109..adfdce7499d1 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c
@@ -57,18 +57,12 @@ static struct snd_card *card_list[SNDRV_CARDS];
57/* 57/*
58 * prototypes 58 * prototypes
59 */ 59 */
60static void pdacf_config(dev_link_t *link); 60static int pdacf_config(struct pcmcia_device *link);
61static void snd_pdacf_detach(struct pcmcia_device *p_dev); 61static void snd_pdacf_detach(struct pcmcia_device *p_dev);
62 62
63static void pdacf_release(dev_link_t *link) 63static void pdacf_release(struct pcmcia_device *link)
64{ 64{
65 if (link->state & DEV_CONFIG) { 65 pcmcia_disable_device(link);
66 /* release cs resources */
67 pcmcia_release_configuration(link->handle);
68 pcmcia_release_io(link->handle, &link->io);
69 pcmcia_release_irq(link->handle, &link->irq);
70 link->state &= ~DEV_CONFIG;
71 }
72} 66}
73 67
74/* 68/*
@@ -76,7 +70,7 @@ static void pdacf_release(dev_link_t *link)
76 */ 70 */
77static int snd_pdacf_free(struct snd_pdacf *pdacf) 71static int snd_pdacf_free(struct snd_pdacf *pdacf)
78{ 72{
79 dev_link_t *link = &pdacf->link; 73 struct pcmcia_device *link = pdacf->p_dev;
80 74
81 pdacf_release(link); 75 pdacf_release(link);
82 76
@@ -96,10 +90,9 @@ static int snd_pdacf_dev_free(struct snd_device *device)
96/* 90/*
97 * snd_pdacf_attach - attach callback for cs 91 * snd_pdacf_attach - attach callback for cs
98 */ 92 */
99static int snd_pdacf_attach(struct pcmcia_device *p_dev) 93static int snd_pdacf_probe(struct pcmcia_device *link)
100{ 94{
101 int i; 95 int i;
102 dev_link_t *link; /* Info for cardmgr */
103 struct snd_pdacf *pdacf; 96 struct snd_pdacf *pdacf;
104 struct snd_card *card; 97 struct snd_card *card;
105 static struct snd_device_ops ops = { 98 static struct snd_device_ops ops = {
@@ -139,7 +132,7 @@ static int snd_pdacf_attach(struct pcmcia_device *p_dev)
139 pdacf->index = i; 132 pdacf->index = i;
140 card_list[i] = card; 133 card_list[i] = card;
141 134
142 link = &pdacf->link; 135 pdacf->p_dev = link;
143 link->priv = pdacf; 136 link->priv = pdacf;
144 137
145 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 138 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
@@ -156,13 +149,7 @@ static int snd_pdacf_attach(struct pcmcia_device *p_dev)
156 link->conf.ConfigIndex = 1; 149 link->conf.ConfigIndex = 1;
157 link->conf.Present = PRESENT_OPTION; 150 link->conf.Present = PRESENT_OPTION;
158 151
159 /* Chain drivers */ 152 return pdacf_config(link);
160 link->next = NULL;
161
162 link->handle = p_dev;
163 pdacf_config(link);
164
165 return 0;
166} 153}
167 154
168 155
@@ -209,9 +196,8 @@ static int snd_pdacf_assign_resources(struct snd_pdacf *pdacf, int port, int irq
209/* 196/*
210 * snd_pdacf_detach - detach callback for cs 197 * snd_pdacf_detach - detach callback for cs
211 */ 198 */
212static void snd_pdacf_detach(struct pcmcia_device *p_dev) 199static void snd_pdacf_detach(struct pcmcia_device *link)
213{ 200{
214 dev_link_t *link = dev_to_instance(p_dev);
215 struct snd_pdacf *chip = link->priv; 201 struct snd_pdacf *chip = link->priv;
216 202
217 snd_printdd(KERN_DEBUG "pdacf_detach called\n"); 203 snd_printdd(KERN_DEBUG "pdacf_detach called\n");
@@ -230,13 +216,11 @@ static void snd_pdacf_detach(struct pcmcia_device *p_dev)
230#define CS_CHECK(fn, ret) \ 216#define CS_CHECK(fn, ret) \
231do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 217do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
232 218
233static void pdacf_config(dev_link_t *link) 219static int pdacf_config(struct pcmcia_device *link)
234{ 220{
235 client_handle_t handle = link->handle;
236 struct snd_pdacf *pdacf = link->priv; 221 struct snd_pdacf *pdacf = link->priv;
237 tuple_t tuple; 222 tuple_t tuple;
238 cisparse_t *parse = NULL; 223 cisparse_t *parse = NULL;
239 config_info_t conf;
240 u_short buf[32]; 224 u_short buf[32];
241 int last_fn, last_ret; 225 int last_fn, last_ret;
242 226
@@ -244,7 +228,7 @@ static void pdacf_config(dev_link_t *link)
244 parse = kmalloc(sizeof(*parse), GFP_KERNEL); 228 parse = kmalloc(sizeof(*parse), GFP_KERNEL);
245 if (! parse) { 229 if (! parse) {
246 snd_printk(KERN_ERR "pdacf_config: cannot allocate\n"); 230 snd_printk(KERN_ERR "pdacf_config: cannot allocate\n");
247 return; 231 return -ENOMEM;
248 } 232 }
249 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 233 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
250 tuple.Attributes = 0; 234 tuple.Attributes = 0;
@@ -252,71 +236,51 @@ static void pdacf_config(dev_link_t *link)
252 tuple.TupleDataMax = sizeof(buf); 236 tuple.TupleDataMax = sizeof(buf);
253 tuple.TupleOffset = 0; 237 tuple.TupleOffset = 0;
254 tuple.DesiredTuple = CISTPL_CONFIG; 238 tuple.DesiredTuple = CISTPL_CONFIG;
255 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 239 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
256 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 240 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
257 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, parse)); 241 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
258 link->conf.ConfigBase = parse->config.base; 242 link->conf.ConfigBase = parse->config.base;
259 link->conf.ConfigIndex = 0x5; 243 link->conf.ConfigIndex = 0x5;
260 kfree(parse); 244 kfree(parse);
261 245
262 CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf)); 246 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
263 link->conf.Vcc = conf.Vcc; 247 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
264 248 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
265 /* Configure card */
266 link->state |= DEV_CONFIG;
267
268 CS_CHECK(RequestIO, pcmcia_request_io(handle, &link->io));
269 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
270 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
271 249
272 if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0) 250 if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0)
273 goto failed; 251 goto failed;
274 252
275 link->dev = &pdacf->node; 253 link->dev_node = &pdacf->node;
276 link->state &= ~DEV_CONFIG_PENDING; 254 return 0;
277 return;
278 255
279cs_failed: 256cs_failed:
280 cs_error(link->handle, last_fn, last_ret); 257 cs_error(link, last_fn, last_ret);
281failed: 258failed:
282 pcmcia_release_configuration(link->handle); 259 pcmcia_disable_device(link);
283 pcmcia_release_io(link->handle, &link->io); 260 return -ENODEV;
284 pcmcia_release_irq(link->handle, &link->irq);
285} 261}
286 262
287#ifdef CONFIG_PM 263#ifdef CONFIG_PM
288 264
289static int pdacf_suspend(struct pcmcia_device *dev) 265static int pdacf_suspend(struct pcmcia_device *link)
290{ 266{
291 dev_link_t *link = dev_to_instance(dev);
292 struct snd_pdacf *chip = link->priv; 267 struct snd_pdacf *chip = link->priv;
293 268
294 snd_printdd(KERN_DEBUG "SUSPEND\n"); 269 snd_printdd(KERN_DEBUG "SUSPEND\n");
295 link->state |= DEV_SUSPEND;
296 if (chip) { 270 if (chip) {
297 snd_printdd(KERN_DEBUG "snd_pdacf_suspend calling\n"); 271 snd_printdd(KERN_DEBUG "snd_pdacf_suspend calling\n");
298 snd_pdacf_suspend(chip, PMSG_SUSPEND); 272 snd_pdacf_suspend(chip, PMSG_SUSPEND);
299 } 273 }
300 274
301 snd_printdd(KERN_DEBUG "RESET_PHYSICAL\n");
302 if (link->state & DEV_CONFIG)
303 pcmcia_release_configuration(link->handle);
304
305 return 0; 275 return 0;
306} 276}
307 277
308static int pdacf_resume(struct pcmcia_device *dev) 278static int pdacf_resume(struct pcmcia_device *link)
309{ 279{
310 dev_link_t *link = dev_to_instance(dev);
311 struct snd_pdacf *chip = link->priv; 280 struct snd_pdacf *chip = link->priv;
312 281
313 snd_printdd(KERN_DEBUG "RESUME\n"); 282 snd_printdd(KERN_DEBUG "RESUME\n");
314 link->state &= ~DEV_SUSPEND; 283 if (pcmcia_dev_present(link)) {
315
316 snd_printdd(KERN_DEBUG "CARD_RESET\n");
317 if (DEV_OK(link)) {
318 snd_printdd(KERN_DEBUG "requestconfig...\n");
319 pcmcia_request_configuration(link->handle, &link->conf);
320 if (chip) { 284 if (chip) {
321 snd_printdd(KERN_DEBUG "calling snd_pdacf_resume\n"); 285 snd_printdd(KERN_DEBUG "calling snd_pdacf_resume\n");
322 snd_pdacf_resume(chip); 286 snd_pdacf_resume(chip);
@@ -343,7 +307,7 @@ static struct pcmcia_driver pdacf_cs_driver = {
343 .drv = { 307 .drv = {
344 .name = "snd-pdaudiocf", 308 .name = "snd-pdaudiocf",
345 }, 309 },
346 .probe = snd_pdacf_attach, 310 .probe = snd_pdacf_probe,
347 .remove = snd_pdacf_detach, 311 .remove = snd_pdacf_detach,
348 .id_table = snd_pdacf_ids, 312 .id_table = snd_pdacf_ids,
349#ifdef CONFIG_PM 313#ifdef CONFIG_PM
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.h b/sound/pcmcia/pdaudiocf/pdaudiocf.h
index 2744f189a613..9a14a4f64bd3 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.h
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.h
@@ -116,7 +116,7 @@ struct snd_pdacf {
116 void *pcm_area; 116 void *pcm_area;
117 117
118 /* pcmcia stuff */ 118 /* pcmcia stuff */
119 dev_link_t link; 119 struct pcmcia_device *p_dev;
120 dev_node_t node; 120 dev_node_t node;
121}; 121};
122 122
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
index 66900d20a42f..7e0cda2b6ef9 100644
--- a/sound/pcmcia/vx/vxpocket.c
+++ b/sound/pcmcia/vx/vxpocket.c
@@ -59,15 +59,9 @@ static unsigned int card_alloc;
59 59
60/* 60/*
61 */ 61 */
62static void vxpocket_release(dev_link_t *link) 62static void vxpocket_release(struct pcmcia_device *link)
63{ 63{
64 if (link->state & DEV_CONFIG) { 64 pcmcia_disable_device(link);
65 /* release cs resources */
66 pcmcia_release_configuration(link->handle);
67 pcmcia_release_io(link->handle, &link->io);
68 pcmcia_release_irq(link->handle, &link->irq);
69 link->state &= ~DEV_CONFIG;
70 }
71} 65}
72 66
73/* 67/*
@@ -132,9 +126,9 @@ static struct snd_vx_hardware vxp440_hw = {
132/* 126/*
133 * create vxpocket instance 127 * create vxpocket instance
134 */ 128 */
135static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl) 129static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl,
130 struct pcmcia_device *link)
136{ 131{
137 dev_link_t *link; /* Info for cardmgr */
138 struct vx_core *chip; 132 struct vx_core *chip;
139 struct snd_vxpocket *vxp; 133 struct snd_vxpocket *vxp;
140 static struct snd_device_ops ops = { 134 static struct snd_device_ops ops = {
@@ -154,7 +148,7 @@ static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl)
154 148
155 vxp = (struct snd_vxpocket *)chip; 149 vxp = (struct snd_vxpocket *)chip;
156 150
157 link = &vxp->link; 151 vxp->p_dev = link;
158 link->priv = chip; 152 link->priv = chip;
159 153
160 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 154 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
@@ -167,7 +161,6 @@ static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl)
167 link->irq.Instance = chip; 161 link->irq.Instance = chip;
168 162
169 link->conf.Attributes = CONF_ENABLE_IRQ; 163 link->conf.Attributes = CONF_ENABLE_IRQ;
170 link->conf.Vcc = 50;
171 link->conf.IntType = INT_MEMORY_AND_IO; 164 link->conf.IntType = INT_MEMORY_AND_IO;
172 link->conf.ConfigIndex = 1; 165 link->conf.ConfigIndex = 1;
173 link->conf.Present = PRESENT_OPTION; 166 link->conf.Present = PRESENT_OPTION;
@@ -215,9 +208,8 @@ static int snd_vxpocket_assign_resources(struct vx_core *chip, int port, int irq
215#define CS_CHECK(fn, ret) \ 208#define CS_CHECK(fn, ret) \
216do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 209do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
217 210
218static void vxpocket_config(dev_link_t *link) 211static int vxpocket_config(struct pcmcia_device *link)
219{ 212{
220 client_handle_t handle = link->handle;
221 struct vx_core *chip = link->priv; 213 struct vx_core *chip = link->priv;
222 struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; 214 struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
223 tuple_t tuple; 215 tuple_t tuple;
@@ -229,24 +221,24 @@ static void vxpocket_config(dev_link_t *link)
229 parse = kmalloc(sizeof(*parse), GFP_KERNEL); 221 parse = kmalloc(sizeof(*parse), GFP_KERNEL);
230 if (! parse) { 222 if (! parse) {
231 snd_printk(KERN_ERR "vx: cannot allocate\n"); 223 snd_printk(KERN_ERR "vx: cannot allocate\n");
232 return; 224 return -ENOMEM;
233 } 225 }
234 tuple.Attributes = 0; 226 tuple.Attributes = 0;
235 tuple.TupleData = (cisdata_t *)buf; 227 tuple.TupleData = (cisdata_t *)buf;
236 tuple.TupleDataMax = sizeof(buf); 228 tuple.TupleDataMax = sizeof(buf);
237 tuple.TupleOffset = 0; 229 tuple.TupleOffset = 0;
238 tuple.DesiredTuple = CISTPL_CONFIG; 230 tuple.DesiredTuple = CISTPL_CONFIG;
239 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 231 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
240 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 232 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
241 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, parse)); 233 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
242 link->conf.ConfigBase = parse->config.base; 234 link->conf.ConfigBase = parse->config.base;
243 link->conf.Present = parse->config.rmask[0]; 235 link->conf.Present = parse->config.rmask[0];
244 236
245 /* redefine hardware record according to the VERSION1 string */ 237 /* redefine hardware record according to the VERSION1 string */
246 tuple.DesiredTuple = CISTPL_VERS_1; 238 tuple.DesiredTuple = CISTPL_VERS_1;
247 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 239 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
248 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 240 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
249 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, parse)); 241 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
250 if (! strcmp(parse->version_1.str + parse->version_1.ofs[1], "VX-POCKET")) { 242 if (! strcmp(parse->version_1.str + parse->version_1.ofs[1], "VX-POCKET")) {
251 snd_printdd("VX-pocket is detected\n"); 243 snd_printdd("VX-pocket is detected\n");
252 } else { 244 } else {
@@ -257,67 +249,50 @@ static void vxpocket_config(dev_link_t *link)
257 strcpy(chip->card->driver, vxp440_hw.name); 249 strcpy(chip->card->driver, vxp440_hw.name);
258 } 250 }
259 251
260 /* Configure card */ 252 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
261 link->state |= DEV_CONFIG; 253 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
262 254 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
263 CS_CHECK(RequestIO, pcmcia_request_io(handle, &link->io));
264 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
265 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf));
266 255
267 chip->dev = &handle_to_dev(link->handle); 256 chip->dev = &handle_to_dev(link);
268 snd_card_set_dev(chip->card, chip->dev); 257 snd_card_set_dev(chip->card, chip->dev);
269 258
270 if (snd_vxpocket_assign_resources(chip, link->io.BasePort1, link->irq.AssignedIRQ) < 0) 259 if (snd_vxpocket_assign_resources(chip, link->io.BasePort1, link->irq.AssignedIRQ) < 0)
271 goto failed; 260 goto failed;
272 261
273 link->dev = &vxp->node; 262 link->dev_node = &vxp->node;
274 link->state &= ~DEV_CONFIG_PENDING;
275 kfree(parse); 263 kfree(parse);
276 return; 264 return 9;
277 265
278cs_failed: 266cs_failed:
279 cs_error(link->handle, last_fn, last_ret); 267 cs_error(link, last_fn, last_ret);
280failed: 268failed:
281 pcmcia_release_configuration(link->handle); 269 pcmcia_disable_device(link);
282 pcmcia_release_io(link->handle, &link->io);
283 pcmcia_release_irq(link->handle, &link->irq);
284 link->state &= ~DEV_CONFIG;
285 kfree(parse); 270 kfree(parse);
271 return -ENODEV;
286} 272}
287 273
288#ifdef CONFIG_PM 274#ifdef CONFIG_PM
289 275
290static int vxp_suspend(struct pcmcia_device *dev) 276static int vxp_suspend(struct pcmcia_device *link)
291{ 277{
292 dev_link_t *link = dev_to_instance(dev);
293 struct vx_core *chip = link->priv; 278 struct vx_core *chip = link->priv;
294 279
295 snd_printdd(KERN_DEBUG "SUSPEND\n"); 280 snd_printdd(KERN_DEBUG "SUSPEND\n");
296 link->state |= DEV_SUSPEND;
297 if (chip) { 281 if (chip) {
298 snd_printdd(KERN_DEBUG "snd_vx_suspend calling\n"); 282 snd_printdd(KERN_DEBUG "snd_vx_suspend calling\n");
299 snd_vx_suspend(chip, PMSG_SUSPEND); 283 snd_vx_suspend(chip, PMSG_SUSPEND);
300 } 284 }
301 snd_printdd(KERN_DEBUG "RESET_PHYSICAL\n");
302 if (link->state & DEV_CONFIG)
303 pcmcia_release_configuration(link->handle);
304 285
305 return 0; 286 return 0;
306} 287}
307 288
308static int vxp_resume(struct pcmcia_device *dev) 289static int vxp_resume(struct pcmcia_device *link)
309{ 290{
310 dev_link_t *link = dev_to_instance(dev);
311 struct vx_core *chip = link->priv; 291 struct vx_core *chip = link->priv;
312 292
313 snd_printdd(KERN_DEBUG "RESUME\n"); 293 snd_printdd(KERN_DEBUG "RESUME\n");
314 link->state &= ~DEV_SUSPEND; 294 if (pcmcia_dev_present(link)) {
315
316 snd_printdd(KERN_DEBUG "CARD_RESET\n");
317 if (DEV_OK(link)) {
318 //struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; 295 //struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
319 snd_printdd(KERN_DEBUG "requestconfig...\n");
320 pcmcia_request_configuration(link->handle, &link->conf);
321 if (chip) { 296 if (chip) {
322 snd_printdd(KERN_DEBUG "calling snd_vx_resume\n"); 297 snd_printdd(KERN_DEBUG "calling snd_vx_resume\n");
323 snd_vx_resume(chip); 298 snd_vx_resume(chip);
@@ -333,7 +308,7 @@ static int vxp_resume(struct pcmcia_device *dev)
333 308
334/* 309/*
335 */ 310 */
336static int vxpocket_attach(struct pcmcia_device *p_dev) 311static int vxpocket_probe(struct pcmcia_device *p_dev)
337{ 312{
338 struct snd_card *card; 313 struct snd_card *card;
339 struct snd_vxpocket *vxp; 314 struct snd_vxpocket *vxp;
@@ -358,7 +333,7 @@ static int vxpocket_attach(struct pcmcia_device *p_dev)
358 return -ENOMEM; 333 return -ENOMEM;
359 } 334 }
360 335
361 vxp = snd_vxpocket_new(card, ibl[i]); 336 vxp = snd_vxpocket_new(card, ibl[i], p_dev);
362 if (! vxp) { 337 if (! vxp) {
363 snd_card_free(card); 338 snd_card_free(card);
364 return -ENODEV; 339 return -ENODEV;
@@ -368,20 +343,13 @@ static int vxpocket_attach(struct pcmcia_device *p_dev)
368 vxp->index = i; 343 vxp->index = i;
369 card_alloc |= 1 << i; 344 card_alloc |= 1 << i;
370 345
371 /* Chain drivers */ 346 vxp->p_dev = p_dev;
372 vxp->link.next = NULL;
373
374 vxp->link.handle = p_dev;
375 vxp->link.state |= DEV_PRESENT | DEV_CONFIG_PENDING;
376 p_dev->instance = &vxp->link;
377 vxpocket_config(&vxp->link);
378 347
379 return 0; 348 return vxpocket_config(p_dev);
380} 349}
381 350
382static void vxpocket_detach(struct pcmcia_device *p_dev) 351static void vxpocket_detach(struct pcmcia_device *link)
383{ 352{
384 dev_link_t *link = dev_to_instance(p_dev);
385 struct snd_vxpocket *vxp; 353 struct snd_vxpocket *vxp;
386 struct vx_core *chip; 354 struct vx_core *chip;
387 355
@@ -413,7 +381,7 @@ static struct pcmcia_driver vxp_cs_driver = {
413 .drv = { 381 .drv = {
414 .name = "snd-vxpocket", 382 .name = "snd-vxpocket",
415 }, 383 },
416 .probe = vxpocket_attach, 384 .probe = vxpocket_probe,
417 .remove = vxpocket_detach, 385 .remove = vxpocket_detach,
418 .id_table = vxp_ids, 386 .id_table = vxp_ids,
419#ifdef CONFIG_PM 387#ifdef CONFIG_PM
diff --git a/sound/pcmcia/vx/vxpocket.h b/sound/pcmcia/vx/vxpocket.h
index 67efae3f6c8d..27ea002294c0 100644
--- a/sound/pcmcia/vx/vxpocket.h
+++ b/sound/pcmcia/vx/vxpocket.h
@@ -42,7 +42,7 @@ struct snd_vxpocket {
42 int index; /* card index */ 42 int index; /* card index */
43 43
44 /* pcmcia stuff */ 44 /* pcmcia stuff */
45 dev_link_t link; 45 struct pcmcia_device *p_dev;
46 dev_node_t node; 46 dev_node_t node;
47}; 47};
48 48