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/hisax/elsa_cs.c | |
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/hisax/elsa_cs.c')
-rw-r--r-- | drivers/isdn/hisax/elsa_cs.c | 26 |
1 files changed, 7 insertions, 19 deletions
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, |