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/net/pcmcia/com20020_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/net/pcmcia/com20020_cs.c')
-rw-r--r-- | drivers/net/pcmcia/com20020_cs.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index 68612222de6e..6970888cba10 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c | |||
@@ -126,7 +126,7 @@ static int com20020_event(event_t event, int priority, | |||
126 | static dev_info_t dev_info = "com20020_cs"; | 126 | static dev_info_t dev_info = "com20020_cs"; |
127 | 127 | ||
128 | static dev_link_t *com20020_attach(void); | 128 | static dev_link_t *com20020_attach(void); |
129 | static void com20020_detach(dev_link_t *); | 129 | static void com20020_detach(struct pcmcia_device *p_dev); |
130 | 130 | ||
131 | static dev_link_t *dev_list; | 131 | static dev_link_t *dev_list; |
132 | 132 | ||
@@ -204,7 +204,7 @@ static dev_link_t *com20020_attach(void) | |||
204 | ret = pcmcia_register_client(&link->handle, &client_reg); | 204 | ret = pcmcia_register_client(&link->handle, &client_reg); |
205 | if (ret != 0) { | 205 | if (ret != 0) { |
206 | cs_error(link->handle, RegisterClient, ret); | 206 | cs_error(link->handle, RegisterClient, ret); |
207 | com20020_detach(link); | 207 | com20020_detach(link->handle); |
208 | return NULL; | 208 | return NULL; |
209 | } | 209 | } |
210 | 210 | ||
@@ -226,8 +226,9 @@ fail_alloc_info: | |||
226 | 226 | ||
227 | ======================================================================*/ | 227 | ======================================================================*/ |
228 | 228 | ||
229 | static void com20020_detach(dev_link_t *link) | 229 | static void com20020_detach(struct pcmcia_device *p_dev) |
230 | { | 230 | { |
231 | dev_link_t *link = dev_to_instance(p_dev); | ||
231 | struct com20020_dev_t *info = link->priv; | 232 | struct com20020_dev_t *info = link->priv; |
232 | dev_link_t **linkp; | 233 | dev_link_t **linkp; |
233 | struct net_device *dev; | 234 | struct net_device *dev; |
@@ -260,9 +261,6 @@ static void com20020_detach(dev_link_t *link) | |||
260 | if (link->state & DEV_CONFIG) | 261 | if (link->state & DEV_CONFIG) |
261 | com20020_release(link); | 262 | com20020_release(link); |
262 | 263 | ||
263 | if (link->handle) | ||
264 | pcmcia_deregister_client(link->handle); | ||
265 | |||
266 | /* Unlink device structure, free bits */ | 264 | /* Unlink device structure, free bits */ |
267 | DEBUG(1,"unlinking...\n"); | 265 | DEBUG(1,"unlinking...\n"); |
268 | *linkp = link->next; | 266 | *linkp = link->next; |
@@ -470,17 +468,10 @@ static int com20020_event(event_t event, int priority, | |||
470 | event_callback_args_t *args) | 468 | event_callback_args_t *args) |
471 | { | 469 | { |
472 | dev_link_t *link = args->client_data; | 470 | dev_link_t *link = args->client_data; |
473 | com20020_dev_t *info = link->priv; | ||
474 | struct net_device *dev = info->dev; | ||
475 | 471 | ||
476 | DEBUG(1, "com20020_event(0x%06x)\n", event); | 472 | DEBUG(1, "com20020_event(0x%06x)\n", event); |
477 | 473 | ||
478 | switch (event) { | 474 | switch (event) { |
479 | case CS_EVENT_CARD_REMOVAL: | ||
480 | link->state &= ~DEV_PRESENT; | ||
481 | if (link->state & DEV_CONFIG) | ||
482 | netif_device_detach(dev); | ||
483 | break; | ||
484 | case CS_EVENT_CARD_INSERTION: | 475 | case CS_EVENT_CARD_INSERTION: |
485 | link->state |= DEV_PRESENT; | 476 | link->state |= DEV_PRESENT; |
486 | com20020_config(link); | 477 | com20020_config(link); |
@@ -502,7 +493,7 @@ static struct pcmcia_driver com20020_cs_driver = { | |||
502 | }, | 493 | }, |
503 | .attach = com20020_attach, | 494 | .attach = com20020_attach, |
504 | .event = com20020_event, | 495 | .event = com20020_event, |
505 | .detach = com20020_detach, | 496 | .remove = com20020_detach, |
506 | .id_table = com20020_ids, | 497 | .id_table = com20020_ids, |
507 | .suspend = com20020_suspend, | 498 | .suspend = com20020_suspend, |
508 | .resume = com20020_resume, | 499 | .resume = com20020_resume, |