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/xirc2ps_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/xirc2ps_cs.c')
-rw-r--r-- | drivers/net/pcmcia/xirc2ps_cs.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 917e50ac37f3..804e56771baf 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -302,7 +302,7 @@ static int xirc2ps_event(event_t event, int priority, | |||
302 | */ | 302 | */ |
303 | 303 | ||
304 | static dev_link_t *xirc2ps_attach(void); | 304 | static dev_link_t *xirc2ps_attach(void); |
305 | static void xirc2ps_detach(dev_link_t *); | 305 | static void xirc2ps_detach(struct pcmcia_device *p_dev); |
306 | 306 | ||
307 | /**************** | 307 | /**************** |
308 | * You'll also need to prototype all the functions that will actually | 308 | * You'll also need to prototype all the functions that will actually |
@@ -622,7 +622,7 @@ xirc2ps_attach(void) | |||
622 | client_reg.event_callback_args.client_data = link; | 622 | client_reg.event_callback_args.client_data = link; |
623 | if ((err = pcmcia_register_client(&link->handle, &client_reg))) { | 623 | if ((err = pcmcia_register_client(&link->handle, &client_reg))) { |
624 | cs_error(link->handle, RegisterClient, err); | 624 | cs_error(link->handle, RegisterClient, err); |
625 | xirc2ps_detach(link); | 625 | xirc2ps_detach(link->handle); |
626 | return NULL; | 626 | return NULL; |
627 | } | 627 | } |
628 | 628 | ||
@@ -637,8 +637,9 @@ xirc2ps_attach(void) | |||
637 | */ | 637 | */ |
638 | 638 | ||
639 | static void | 639 | static void |
640 | xirc2ps_detach(dev_link_t * link) | 640 | xirc2ps_detach(struct pcmcia_device *p_dev) |
641 | { | 641 | { |
642 | dev_link_t *link = dev_to_instance(p_dev); | ||
642 | struct net_device *dev = link->priv; | 643 | struct net_device *dev = link->priv; |
643 | dev_link_t **linkp; | 644 | dev_link_t **linkp; |
644 | 645 | ||
@@ -656,19 +657,9 @@ xirc2ps_detach(dev_link_t * link) | |||
656 | if (link->dev) | 657 | if (link->dev) |
657 | unregister_netdev(dev); | 658 | unregister_netdev(dev); |
658 | 659 | ||
659 | /* | ||
660 | * If the device is currently configured and active, we won't | ||
661 | * actually delete it yet. Instead, it is marked so that when | ||
662 | * the release() function is called, that will trigger a proper | ||
663 | * detach(). | ||
664 | */ | ||
665 | if (link->state & DEV_CONFIG) | 660 | if (link->state & DEV_CONFIG) |
666 | xirc2ps_release(link); | 661 | xirc2ps_release(link); |
667 | 662 | ||
668 | /* Break the link with Card Services */ | ||
669 | if (link->handle) | ||
670 | pcmcia_deregister_client(link->handle); | ||
671 | |||
672 | /* Unlink device structure, free it */ | 663 | /* Unlink device structure, free it */ |
673 | *linkp = link->next; | 664 | *linkp = link->next; |
674 | free_netdev(dev); | 665 | free_netdev(dev); |
@@ -1209,19 +1200,10 @@ xirc2ps_event(event_t event, int priority, | |||
1209 | event_callback_args_t * args) | 1200 | event_callback_args_t * args) |
1210 | { | 1201 | { |
1211 | dev_link_t *link = args->client_data; | 1202 | dev_link_t *link = args->client_data; |
1212 | struct net_device *dev = link->priv; | ||
1213 | 1203 | ||
1214 | DEBUG(0, "event(%d)\n", (int)event); | 1204 | DEBUG(0, "event(%d)\n", (int)event); |
1215 | 1205 | ||
1216 | switch (event) { | 1206 | switch (event) { |
1217 | case CS_EVENT_REGISTRATION_COMPLETE: | ||
1218 | DEBUG(0, "registration complete\n"); | ||
1219 | break; | ||
1220 | case CS_EVENT_CARD_REMOVAL: | ||
1221 | link->state &= ~DEV_PRESENT; | ||
1222 | if (link->state & DEV_CONFIG) | ||
1223 | netif_device_detach(dev); | ||
1224 | break; | ||
1225 | case CS_EVENT_CARD_INSERTION: | 1207 | case CS_EVENT_CARD_INSERTION: |
1226 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 1208 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
1227 | xirc2ps_config(link); | 1209 | xirc2ps_config(link); |
@@ -2022,7 +2004,7 @@ static struct pcmcia_driver xirc2ps_cs_driver = { | |||
2022 | }, | 2004 | }, |
2023 | .attach = xirc2ps_attach, | 2005 | .attach = xirc2ps_attach, |
2024 | .event = xirc2ps_event, | 2006 | .event = xirc2ps_event, |
2025 | .detach = xirc2ps_detach, | 2007 | .remove = xirc2ps_detach, |
2026 | .id_table = xirc2ps_ids, | 2008 | .id_table = xirc2ps_ids, |
2027 | .suspend = xirc2ps_suspend, | 2009 | .suspend = xirc2ps_suspend, |
2028 | .resume = xirc2ps_resume, | 2010 | .resume = xirc2ps_resume, |