diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-11-14 15:23:14 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-05 18:03:10 -0500 |
commit | cc3b4866bee996c922e875b8c8efe9f0d8803aae (patch) | |
tree | 6632837b6986f33566f75ed971cecbdc210e3201 /drivers/isdn | |
parent | 8e9e793d68fcda6cc84c18cedf85ca0f91d801a8 (diff) |
[PATCH] pcmcia: unify detach, REMOVAL_EVENT handlers into one remove callback
Unify the "detach" and REMOVAL_EVENT handlers to one "remove" function.
Old functionality is preserved, for the moment.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/hardware/avm/avm_cs.c | 34 | ||||
-rw-r--r-- | drivers/isdn/hisax/avma1_cs.c | 39 | ||||
-rw-r--r-- | drivers/isdn/hisax/elsa_cs.c | 26 | ||||
-rw-r--r-- | drivers/isdn/hisax/sedlbauer_cs.c | 38 | ||||
-rw-r--r-- | drivers/isdn/hisax/teles_cs.c | 26 |
5 files changed, 36 insertions, 127 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 6d9816e10ecb..2d898d3afc97 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c | |||
@@ -63,7 +63,7 @@ static int avmcs_event(event_t event, int priority, | |||
63 | */ | 63 | */ |
64 | 64 | ||
65 | static dev_link_t *avmcs_attach(void); | 65 | static dev_link_t *avmcs_attach(void); |
66 | static void avmcs_detach(dev_link_t *); | 66 | static void avmcs_detach(struct pcmcia_device *p_dev); |
67 | 67 | ||
68 | /* | 68 | /* |
69 | The dev_info variable is the "key" that is used to match up this | 69 | The dev_info variable is the "key" that is used to match up this |
@@ -165,7 +165,7 @@ static dev_link_t *avmcs_attach(void) | |||
165 | ret = pcmcia_register_client(&link->handle, &client_reg); | 165 | ret = pcmcia_register_client(&link->handle, &client_reg); |
166 | if (ret != 0) { | 166 | if (ret != 0) { |
167 | cs_error(link->handle, RegisterClient, ret); | 167 | cs_error(link->handle, RegisterClient, ret); |
168 | avmcs_detach(link); | 168 | avmcs_detach(link->handle); |
169 | goto err; | 169 | goto err; |
170 | } | 170 | } |
171 | return link; | 171 | return link; |
@@ -185,8 +185,9 @@ static dev_link_t *avmcs_attach(void) | |||
185 | 185 | ||
186 | ======================================================================*/ | 186 | ======================================================================*/ |
187 | 187 | ||
188 | static void avmcs_detach(dev_link_t *link) | 188 | static void avmcs_detach(struct pcmcia_device *p_dev) |
189 | { | 189 | { |
190 | dev_link_t *link = dev_to_instance(p_dev); | ||
190 | dev_link_t **linkp; | 191 | dev_link_t **linkp; |
191 | 192 | ||
192 | /* Locate device structure */ | 193 | /* Locate device structure */ |
@@ -195,21 +196,9 @@ static void avmcs_detach(dev_link_t *link) | |||
195 | if (*linkp == NULL) | 196 | if (*linkp == NULL) |
196 | return; | 197 | return; |
197 | 198 | ||
198 | /* | 199 | if (link->state & DEV_CONFIG) |
199 | If the device is currently configured and active, we won't | 200 | avmcs_release(link); |
200 | actually delete it yet. Instead, it is marked so that when | ||
201 | the release() function is called, that will trigger a proper | ||
202 | detach(). | ||
203 | */ | ||
204 | if (link->state & DEV_CONFIG) { | ||
205 | link->state |= DEV_STALE_LINK; | ||
206 | return; | ||
207 | } | ||
208 | 201 | ||
209 | /* Break the link with Card Services */ | ||
210 | if (link->handle) | ||
211 | pcmcia_deregister_client(link->handle); | ||
212 | |||
213 | /* Unlink device structure, free pieces */ | 202 | /* Unlink device structure, free pieces */ |
214 | *linkp = link->next; | 203 | *linkp = link->next; |
215 | kfree(link->priv); | 204 | kfree(link->priv); |
@@ -424,10 +413,6 @@ static void avmcs_release(dev_link_t *link) | |||
424 | pcmcia_release_io(link->handle, &link->io); | 413 | pcmcia_release_io(link->handle, &link->io); |
425 | pcmcia_release_irq(link->handle, &link->irq); | 414 | pcmcia_release_irq(link->handle, &link->irq); |
426 | link->state &= ~DEV_CONFIG; | 415 | link->state &= ~DEV_CONFIG; |
427 | |||
428 | if (link->state & DEV_STALE_LINK) | ||
429 | avmcs_detach(link); | ||
430 | |||
431 | } /* avmcs_release */ | 416 | } /* avmcs_release */ |
432 | 417 | ||
433 | static int avmcs_suspend(struct pcmcia_device *dev) | 418 | static int avmcs_suspend(struct pcmcia_device *dev) |
@@ -472,11 +457,6 @@ static int avmcs_event(event_t event, int priority, | |||
472 | dev_link_t *link = args->client_data; | 457 | dev_link_t *link = args->client_data; |
473 | 458 | ||
474 | switch (event) { | 459 | switch (event) { |
475 | case CS_EVENT_CARD_REMOVAL: | ||
476 | link->state &= ~DEV_PRESENT; | ||
477 | if (link->state & DEV_CONFIG) | ||
478 | avmcs_release(link); | ||
479 | break; | ||
480 | case CS_EVENT_CARD_INSERTION: | 460 | case CS_EVENT_CARD_INSERTION: |
481 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 461 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
482 | avmcs_config(link); | 462 | avmcs_config(link); |
@@ -500,7 +480,7 @@ static struct pcmcia_driver avmcs_driver = { | |||
500 | }, | 480 | }, |
501 | .attach = avmcs_attach, | 481 | .attach = avmcs_attach, |
502 | .event = avmcs_event, | 482 | .event = avmcs_event, |
503 | .detach = avmcs_detach, | 483 | .remove = avmcs_detach, |
504 | .id_table = avmcs_ids, | 484 | .id_table = avmcs_ids, |
505 | .suspend= avmcs_suspend, | 485 | .suspend= avmcs_suspend, |
506 | .resume = avmcs_resume, | 486 | .resume = avmcs_resume, |
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 433cec4269a3..6b322e88c6c3 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c | |||
@@ -79,7 +79,7 @@ static int avma1cs_event(event_t event, int priority, | |||
79 | */ | 79 | */ |
80 | 80 | ||
81 | static dev_link_t *avma1cs_attach(void); | 81 | static dev_link_t *avma1cs_attach(void); |
82 | static void avma1cs_detach(dev_link_t *); | 82 | static void avma1cs_detach(struct pcmcia_device *p_dev); |
83 | 83 | ||
84 | /* | 84 | /* |
85 | The dev_info variable is the "key" that is used to match up this | 85 | The dev_info variable is the "key" that is used to match up this |
@@ -187,7 +187,7 @@ static dev_link_t *avma1cs_attach(void) | |||
187 | ret = pcmcia_register_client(&link->handle, &client_reg); | 187 | ret = pcmcia_register_client(&link->handle, &client_reg); |
188 | if (ret != 0) { | 188 | if (ret != 0) { |
189 | cs_error(link->handle, RegisterClient, ret); | 189 | cs_error(link->handle, RegisterClient, ret); |
190 | avma1cs_detach(link); | 190 | avma1cs_detach(link->handle); |
191 | return NULL; | 191 | return NULL; |
192 | } | 192 | } |
193 | 193 | ||
@@ -203,42 +203,26 @@ static dev_link_t *avma1cs_attach(void) | |||
203 | 203 | ||
204 | ======================================================================*/ | 204 | ======================================================================*/ |
205 | 205 | ||
206 | static void avma1cs_detach(dev_link_t *link) | 206 | static void avma1cs_detach(struct pcmcia_device *p_dev) |
207 | { | 207 | { |
208 | dev_link_t *link = dev_to_instance(p_dev); | ||
208 | dev_link_t **linkp; | 209 | dev_link_t **linkp; |
209 | 210 | ||
210 | DEBUG(0, "avma1cs_detach(0x%p)\n", link); | 211 | DEBUG(0, "avma1cs_detach(0x%p)\n", link); |
211 | 212 | ||
212 | /* Locate device structure */ | 213 | /* Locate device structure */ |
213 | for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) | 214 | for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) |
214 | if (*linkp == link) break; | 215 | if (*linkp == link) break; |
215 | if (*linkp == NULL) | 216 | if (*linkp == NULL) |
216 | return; | 217 | return; |
217 | 218 | ||
218 | /* | 219 | if (link->state & DEV_CONFIG) |
219 | If the device is currently configured and active, we won't | 220 | avma1cs_release(link); |
220 | actually delete it yet. Instead, it is marked so that when | ||
221 | the release() function is called, that will trigger a proper | ||
222 | detach(). | ||
223 | */ | ||
224 | if (link->state & DEV_CONFIG) { | ||
225 | #ifdef PCMCIA_DEBUG | ||
226 | printk(KERN_DEBUG "avma1_cs: detach postponed, '%s' " | ||
227 | "still locked\n", link->dev->dev_name); | ||
228 | #endif | ||
229 | link->state |= DEV_STALE_LINK; | ||
230 | return; | ||
231 | } | ||
232 | 221 | ||
233 | /* Break the link with Card Services */ | ||
234 | if (link->handle) | ||
235 | pcmcia_deregister_client(link->handle); | ||
236 | |||
237 | /* Unlink device structure, free pieces */ | 222 | /* Unlink device structure, free pieces */ |
238 | *linkp = link->next; | 223 | *linkp = link->next; |
239 | kfree(link->priv); | 224 | kfree(link->priv); |
240 | kfree(link); | 225 | kfree(link); |
241 | |||
242 | } /* avma1cs_detach */ | 226 | } /* avma1cs_detach */ |
243 | 227 | ||
244 | /*====================================================================== | 228 | /*====================================================================== |
@@ -440,9 +424,6 @@ static void avma1cs_release(dev_link_t *link) | |||
440 | pcmcia_release_io(link->handle, &link->io); | 424 | pcmcia_release_io(link->handle, &link->io); |
441 | pcmcia_release_irq(link->handle, &link->irq); | 425 | pcmcia_release_irq(link->handle, &link->irq); |
442 | link->state &= ~DEV_CONFIG; | 426 | link->state &= ~DEV_CONFIG; |
443 | |||
444 | if (link->state & DEV_STALE_LINK) | ||
445 | avma1cs_detach(link); | ||
446 | } /* avma1cs_release */ | 427 | } /* avma1cs_release */ |
447 | 428 | ||
448 | static int avma1cs_suspend(struct pcmcia_device *dev) | 429 | static int avma1cs_suspend(struct pcmcia_device *dev) |
@@ -489,10 +470,6 @@ static int avma1cs_event(event_t event, int priority, | |||
489 | DEBUG(1, "avma1cs_event(0x%06x)\n", event); | 470 | DEBUG(1, "avma1cs_event(0x%06x)\n", event); |
490 | 471 | ||
491 | switch (event) { | 472 | switch (event) { |
492 | case CS_EVENT_CARD_REMOVAL: | ||
493 | if (link->state & DEV_CONFIG) | ||
494 | avma1cs_release(link); | ||
495 | break; | ||
496 | case CS_EVENT_CARD_INSERTION: | 473 | case CS_EVENT_CARD_INSERTION: |
497 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 474 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
498 | avma1cs_config(link); | 475 | avma1cs_config(link); |
@@ -515,7 +492,7 @@ static struct pcmcia_driver avma1cs_driver = { | |||
515 | }, | 492 | }, |
516 | .attach = avma1cs_attach, | 493 | .attach = avma1cs_attach, |
517 | .event = avma1cs_event, | 494 | .event = avma1cs_event, |
518 | .detach = avma1cs_detach, | 495 | .remove = avma1cs_detach, |
519 | .id_table = avma1cs_ids, | 496 | .id_table = avma1cs_ids, |
520 | .suspend = avma1cs_suspend, | 497 | .suspend = avma1cs_suspend, |
521 | .resume = avma1cs_resume, | 498 | .resume = avma1cs_resume, |
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index 0cbe04593d87..48cc677249f1 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c | |||
@@ -106,7 +106,7 @@ static int elsa_cs_event(event_t event, int priority, | |||
106 | */ | 106 | */ |
107 | 107 | ||
108 | static dev_link_t *elsa_cs_attach(void); | 108 | static dev_link_t *elsa_cs_attach(void); |
109 | static void elsa_cs_detach(dev_link_t *); | 109 | static void elsa_cs_detach(struct pcmcia_device *p_dev); |
110 | 110 | ||
111 | /* | 111 | /* |
112 | The dev_info variable is the "key" that is used to match up this | 112 | The dev_info variable is the "key" that is used to match up this |
@@ -216,7 +216,7 @@ static dev_link_t *elsa_cs_attach(void) | |||
216 | ret = pcmcia_register_client(&link->handle, &client_reg); | 216 | ret = pcmcia_register_client(&link->handle, &client_reg); |
217 | if (ret != CS_SUCCESS) { | 217 | if (ret != CS_SUCCESS) { |
218 | cs_error(link->handle, RegisterClient, ret); | 218 | cs_error(link->handle, RegisterClient, ret); |
219 | elsa_cs_detach(link); | 219 | elsa_cs_detach(link->handle); |
220 | return NULL; | 220 | return NULL; |
221 | } | 221 | } |
222 | 222 | ||
@@ -232,11 +232,11 @@ static dev_link_t *elsa_cs_attach(void) | |||
232 | 232 | ||
233 | ======================================================================*/ | 233 | ======================================================================*/ |
234 | 234 | ||
235 | static void elsa_cs_detach(dev_link_t *link) | 235 | static void elsa_cs_detach(struct pcmcia_device *p_dev) |
236 | { | 236 | { |
237 | dev_link_t *link = dev_to_instance(p_dev); | ||
237 | dev_link_t **linkp; | 238 | dev_link_t **linkp; |
238 | local_info_t *info = link->priv; | 239 | local_info_t *info = link->priv; |
239 | int ret; | ||
240 | 240 | ||
241 | DEBUG(0, "elsa_cs_detach(0x%p)\n", link); | 241 | DEBUG(0, "elsa_cs_detach(0x%p)\n", link); |
242 | 242 | ||
@@ -246,14 +246,9 @@ static void elsa_cs_detach(dev_link_t *link) | |||
246 | if (*linkp == NULL) | 246 | if (*linkp == NULL) |
247 | return; | 247 | return; |
248 | 248 | ||
249 | if (link->state & DEV_CONFIG) | 249 | if (link->state & DEV_CONFIG) { |
250 | ((local_info_t*)link->priv)->busy = 1; | ||
250 | elsa_cs_release(link); | 251 | elsa_cs_release(link); |
251 | |||
252 | /* Break the link with Card Services */ | ||
253 | if (link->handle) { | ||
254 | ret = pcmcia_deregister_client(link->handle); | ||
255 | if (ret != CS_SUCCESS) | ||
256 | cs_error(link->handle, DeregisterClient, ret); | ||
257 | } | 252 | } |
258 | 253 | ||
259 | /* Unlink device structure and free it */ | 254 | /* Unlink device structure and free it */ |
@@ -495,13 +490,6 @@ static int elsa_cs_event(event_t event, int priority, | |||
495 | DEBUG(1, "elsa_cs_event(%d)\n", event); | 490 | DEBUG(1, "elsa_cs_event(%d)\n", event); |
496 | 491 | ||
497 | switch (event) { | 492 | switch (event) { |
498 | case CS_EVENT_CARD_REMOVAL: | ||
499 | link->state &= ~DEV_PRESENT; | ||
500 | if (link->state & DEV_CONFIG) { | ||
501 | ((local_info_t*)link->priv)->busy = 1; | ||
502 | elsa_cs_release(link); | ||
503 | } | ||
504 | break; | ||
505 | case CS_EVENT_CARD_INSERTION: | 493 | case CS_EVENT_CARD_INSERTION: |
506 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 494 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
507 | elsa_cs_config(link); | 495 | elsa_cs_config(link); |
@@ -524,7 +512,7 @@ static struct pcmcia_driver elsa_cs_driver = { | |||
524 | }, | 512 | }, |
525 | .attach = elsa_cs_attach, | 513 | .attach = elsa_cs_attach, |
526 | .event = elsa_cs_event, | 514 | .event = elsa_cs_event, |
527 | .detach = elsa_cs_detach, | 515 | .remove = elsa_cs_detach, |
528 | .id_table = elsa_ids, | 516 | .id_table = elsa_ids, |
529 | .suspend = elsa_suspend, | 517 | .suspend = elsa_suspend, |
530 | .resume = elsa_resume, | 518 | .resume = elsa_resume, |
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 27dce7c7b760..d2386f6867b7 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c | |||
@@ -107,7 +107,7 @@ static int sedlbauer_event(event_t event, int priority, | |||
107 | */ | 107 | */ |
108 | 108 | ||
109 | static dev_link_t *sedlbauer_attach(void); | 109 | static dev_link_t *sedlbauer_attach(void); |
110 | static void sedlbauer_detach(dev_link_t *); | 110 | static void sedlbauer_detach(struct pcmcia_device *p_dev); |
111 | 111 | ||
112 | /* | 112 | /* |
113 | You'll also need to prototype all the functions that will actually | 113 | You'll also need to prototype all the functions that will actually |
@@ -230,7 +230,7 @@ static dev_link_t *sedlbauer_attach(void) | |||
230 | ret = pcmcia_register_client(&link->handle, &client_reg); | 230 | ret = pcmcia_register_client(&link->handle, &client_reg); |
231 | if (ret != CS_SUCCESS) { | 231 | if (ret != CS_SUCCESS) { |
232 | cs_error(link->handle, RegisterClient, ret); | 232 | cs_error(link->handle, RegisterClient, ret); |
233 | sedlbauer_detach(link); | 233 | sedlbauer_detach(link->handle); |
234 | return NULL; | 234 | return NULL; |
235 | } | 235 | } |
236 | 236 | ||
@@ -246,8 +246,9 @@ static dev_link_t *sedlbauer_attach(void) | |||
246 | 246 | ||
247 | ======================================================================*/ | 247 | ======================================================================*/ |
248 | 248 | ||
249 | static void sedlbauer_detach(dev_link_t *link) | 249 | static void sedlbauer_detach(struct pcmcia_device *p_dev) |
250 | { | 250 | { |
251 | dev_link_t *link = dev_to_instance(p_dev); | ||
251 | dev_link_t **linkp; | 252 | dev_link_t **linkp; |
252 | 253 | ||
253 | DEBUG(0, "sedlbauer_detach(0x%p)\n", link); | 254 | DEBUG(0, "sedlbauer_detach(0x%p)\n", link); |
@@ -258,25 +259,11 @@ static void sedlbauer_detach(dev_link_t *link) | |||
258 | if (*linkp == NULL) | 259 | if (*linkp == NULL) |
259 | return; | 260 | return; |
260 | 261 | ||
261 | /* | ||
262 | If the device is currently configured and active, we won't | ||
263 | actually delete it yet. Instead, it is marked so that when | ||
264 | the release() function is called, that will trigger a proper | ||
265 | detach(). | ||
266 | */ | ||
267 | if (link->state & DEV_CONFIG) { | 262 | if (link->state & DEV_CONFIG) { |
268 | #ifdef PCMCIA_DEBUG | 263 | ((local_info_t *)link->priv)->stop = 1; |
269 | printk(KERN_DEBUG "sedlbauer_cs: detach postponed, '%s' " | 264 | sedlbauer_release(link); |
270 | "still locked\n", link->dev->dev_name); | ||
271 | #endif | ||
272 | link->state |= DEV_STALE_LINK; | ||
273 | return; | ||
274 | } | 265 | } |
275 | 266 | ||
276 | /* Break the link with Card Services */ | ||
277 | if (link->handle) | ||
278 | pcmcia_deregister_client(link->handle); | ||
279 | |||
280 | /* Unlink device structure, and free it */ | 267 | /* Unlink device structure, and free it */ |
281 | *linkp = link->next; | 268 | *linkp = link->next; |
282 | /* This points to the parent local_info_t struct */ | 269 | /* This points to the parent local_info_t struct */ |
@@ -547,10 +534,6 @@ static void sedlbauer_release(dev_link_t *link) | |||
547 | if (link->irq.AssignedIRQ) | 534 | if (link->irq.AssignedIRQ) |
548 | pcmcia_release_irq(link->handle, &link->irq); | 535 | pcmcia_release_irq(link->handle, &link->irq); |
549 | link->state &= ~DEV_CONFIG; | 536 | link->state &= ~DEV_CONFIG; |
550 | |||
551 | if (link->state & DEV_STALE_LINK) | ||
552 | sedlbauer_detach(link); | ||
553 | |||
554 | } /* sedlbauer_release */ | 537 | } /* sedlbauer_release */ |
555 | 538 | ||
556 | static int sedlbauer_suspend(struct pcmcia_device *p_dev) | 539 | static int sedlbauer_suspend(struct pcmcia_device *p_dev) |
@@ -599,13 +582,6 @@ static int sedlbauer_event(event_t event, int priority, | |||
599 | DEBUG(1, "sedlbauer_event(0x%06x)\n", event); | 582 | DEBUG(1, "sedlbauer_event(0x%06x)\n", event); |
600 | 583 | ||
601 | switch (event) { | 584 | switch (event) { |
602 | case CS_EVENT_CARD_REMOVAL: | ||
603 | link->state &= ~DEV_PRESENT; | ||
604 | if (link->state & DEV_CONFIG) { | ||
605 | ((local_info_t *)link->priv)->stop = 1; | ||
606 | sedlbauer_release(link); | ||
607 | } | ||
608 | break; | ||
609 | case CS_EVENT_CARD_INSERTION: | 585 | case CS_EVENT_CARD_INSERTION: |
610 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 586 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
611 | sedlbauer_config(link); | 587 | sedlbauer_config(link); |
@@ -633,7 +609,7 @@ static struct pcmcia_driver sedlbauer_driver = { | |||
633 | }, | 609 | }, |
634 | .attach = sedlbauer_attach, | 610 | .attach = sedlbauer_attach, |
635 | .event = sedlbauer_event, | 611 | .event = sedlbauer_event, |
636 | .detach = sedlbauer_detach, | 612 | .remove = sedlbauer_detach, |
637 | .id_table = sedlbauer_ids, | 613 | .id_table = sedlbauer_ids, |
638 | .suspend = sedlbauer_suspend, | 614 | .suspend = sedlbauer_suspend, |
639 | .resume = sedlbauer_resume, | 615 | .resume = sedlbauer_resume, |
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 70213bc1d30c..cd0f86f0975b 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c | |||
@@ -87,7 +87,7 @@ static int teles_cs_event(event_t event, int priority, | |||
87 | */ | 87 | */ |
88 | 88 | ||
89 | static dev_link_t *teles_attach(void); | 89 | static dev_link_t *teles_attach(void); |
90 | static void teles_detach(dev_link_t *); | 90 | static void teles_detach(struct pcmcia_device *p_dev); |
91 | 91 | ||
92 | /* | 92 | /* |
93 | The dev_info variable is the "key" that is used to match up this | 93 | The dev_info variable is the "key" that is used to match up this |
@@ -197,7 +197,7 @@ static dev_link_t *teles_attach(void) | |||
197 | ret = pcmcia_register_client(&link->handle, &client_reg); | 197 | ret = pcmcia_register_client(&link->handle, &client_reg); |
198 | if (ret != CS_SUCCESS) { | 198 | if (ret != CS_SUCCESS) { |
199 | cs_error(link->handle, RegisterClient, ret); | 199 | cs_error(link->handle, RegisterClient, ret); |
200 | teles_detach(link); | 200 | teles_detach(link->handle); |
201 | return NULL; | 201 | return NULL; |
202 | } | 202 | } |
203 | 203 | ||
@@ -213,11 +213,11 @@ static dev_link_t *teles_attach(void) | |||
213 | 213 | ||
214 | ======================================================================*/ | 214 | ======================================================================*/ |
215 | 215 | ||
216 | static void teles_detach(dev_link_t *link) | 216 | static void teles_detach(struct pcmcia_device *p_dev) |
217 | { | 217 | { |
218 | dev_link_t *link = dev_to_instance(p_dev); | ||
218 | dev_link_t **linkp; | 219 | dev_link_t **linkp; |
219 | local_info_t *info = link->priv; | 220 | local_info_t *info = link->priv; |
220 | int ret; | ||
221 | 221 | ||
222 | DEBUG(0, "teles_detach(0x%p)\n", link); | 222 | DEBUG(0, "teles_detach(0x%p)\n", link); |
223 | 223 | ||
@@ -227,14 +227,9 @@ static void teles_detach(dev_link_t *link) | |||
227 | if (*linkp == NULL) | 227 | if (*linkp == NULL) |
228 | return; | 228 | return; |
229 | 229 | ||
230 | if (link->state & DEV_CONFIG) | 230 | if (link->state & DEV_CONFIG) { |
231 | info->busy = 1; | ||
231 | teles_cs_release(link); | 232 | teles_cs_release(link); |
232 | |||
233 | /* Break the link with Card Services */ | ||
234 | if (link->handle) { | ||
235 | ret = pcmcia_deregister_client(link->handle); | ||
236 | if (ret != CS_SUCCESS) | ||
237 | cs_error(link->handle, DeregisterClient, ret); | ||
238 | } | 233 | } |
239 | 234 | ||
240 | /* Unlink device structure and free it */ | 235 | /* Unlink device structure and free it */ |
@@ -476,13 +471,6 @@ static int teles_cs_event(event_t event, int priority, | |||
476 | DEBUG(1, "teles_cs_event(%d)\n", event); | 471 | DEBUG(1, "teles_cs_event(%d)\n", event); |
477 | 472 | ||
478 | switch (event) { | 473 | switch (event) { |
479 | case CS_EVENT_CARD_REMOVAL: | ||
480 | link->state &= ~DEV_PRESENT; | ||
481 | if (link->state & DEV_CONFIG) { | ||
482 | ((local_info_t*)link->priv)->busy = 1; | ||
483 | teles_cs_release(link); | ||
484 | } | ||
485 | break; | ||
486 | case CS_EVENT_CARD_INSERTION: | 474 | case CS_EVENT_CARD_INSERTION: |
487 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 475 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
488 | teles_cs_config(link); | 476 | teles_cs_config(link); |
@@ -504,7 +492,7 @@ static struct pcmcia_driver teles_cs_driver = { | |||
504 | }, | 492 | }, |
505 | .attach = teles_attach, | 493 | .attach = teles_attach, |
506 | .event = teles_cs_event, | 494 | .event = teles_cs_event, |
507 | .detach = teles_detach, | 495 | .remove = teles_detach, |
508 | .id_table = teles_ids, | 496 | .id_table = teles_ids, |
509 | .suspend = teles_suspend, | 497 | .suspend = teles_suspend, |
510 | .resume = teles_resume, | 498 | .resume = teles_resume, |