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/wireless | |
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/wireless')
-rw-r--r-- | drivers/net/wireless/airo_cs.c | 31 | ||||
-rw-r--r-- | drivers/net/wireless/atmel_cs.c | 25 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_cs.c | 28 | ||||
-rw-r--r-- | drivers/net/wireless/netwave_cs.c | 31 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco_cs.c | 30 | ||||
-rw-r--r-- | drivers/net/wireless/ray_cs.c | 43 | ||||
-rw-r--r-- | drivers/net/wireless/spectrum_cs.c | 37 | ||||
-rw-r--r-- | drivers/net/wireless/wavelan_cs.c | 31 | ||||
-rw-r--r-- | drivers/net/wireless/wavelan_cs.p.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/wl3501_cs.c | 32 |
10 files changed, 72 insertions, 218 deletions
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 80c9de749b52..7a28139544c0 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -92,7 +92,7 @@ static int airo_event(event_t event, int priority, | |||
92 | */ | 92 | */ |
93 | 93 | ||
94 | static dev_link_t *airo_attach(void); | 94 | static dev_link_t *airo_attach(void); |
95 | static void airo_detach(dev_link_t *); | 95 | static void airo_detach(struct pcmcia_device *p_dev); |
96 | 96 | ||
97 | /* | 97 | /* |
98 | You'll also need to prototype all the functions that will actually | 98 | You'll also need to prototype all the functions that will actually |
@@ -210,7 +210,7 @@ static dev_link_t *airo_attach(void) | |||
210 | ret = pcmcia_register_client(&link->handle, &client_reg); | 210 | ret = pcmcia_register_client(&link->handle, &client_reg); |
211 | if (ret != 0) { | 211 | if (ret != 0) { |
212 | cs_error(link->handle, RegisterClient, ret); | 212 | cs_error(link->handle, RegisterClient, ret); |
213 | airo_detach(link); | 213 | airo_detach(link->handle); |
214 | return NULL; | 214 | return NULL; |
215 | } | 215 | } |
216 | 216 | ||
@@ -226,8 +226,9 @@ static dev_link_t *airo_attach(void) | |||
226 | 226 | ||
227 | ======================================================================*/ | 227 | ======================================================================*/ |
228 | 228 | ||
229 | static void airo_detach(dev_link_t *link) | 229 | static void airo_detach(struct pcmcia_device *p_dev) |
230 | { | 230 | { |
231 | dev_link_t *link = dev_to_instance(p_dev); | ||
231 | dev_link_t **linkp; | 232 | dev_link_t **linkp; |
232 | 233 | ||
233 | DEBUG(0, "airo_detach(0x%p)\n", link); | 234 | DEBUG(0, "airo_detach(0x%p)\n", link); |
@@ -244,14 +245,8 @@ static void airo_detach(dev_link_t *link) | |||
244 | if ( ((local_info_t*)link->priv)->eth_dev ) { | 245 | if ( ((local_info_t*)link->priv)->eth_dev ) { |
245 | stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 ); | 246 | stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 ); |
246 | } | 247 | } |
247 | ((local_info_t*)link->priv)->eth_dev = NULL; | 248 | ((local_info_t*)link->priv)->eth_dev = NULL; |
248 | 249 | ||
249 | /* Break the link with Card Services */ | ||
250 | if (link->handle) | ||
251 | pcmcia_deregister_client(link->handle); | ||
252 | |||
253 | |||
254 | |||
255 | /* Unlink device structure, free pieces */ | 250 | /* Unlink device structure, free pieces */ |
256 | *linkp = link->next; | 251 | *linkp = link->next; |
257 | kfree(link->priv); | 252 | kfree(link->priv); |
@@ -537,18 +532,10 @@ static int airo_event(event_t event, int priority, | |||
537 | event_callback_args_t *args) | 532 | event_callback_args_t *args) |
538 | { | 533 | { |
539 | dev_link_t *link = args->client_data; | 534 | dev_link_t *link = args->client_data; |
540 | local_info_t *local = link->priv; | 535 | |
541 | |||
542 | DEBUG(1, "airo_event(0x%06x)\n", event); | 536 | DEBUG(1, "airo_event(0x%06x)\n", event); |
543 | 537 | ||
544 | switch (event) { | 538 | switch (event) { |
545 | case CS_EVENT_CARD_REMOVAL: | ||
546 | link->state &= ~DEV_PRESENT; | ||
547 | if (link->state & DEV_CONFIG) { | ||
548 | netif_device_detach(local->eth_dev); | ||
549 | airo_release(link); | ||
550 | } | ||
551 | break; | ||
552 | case CS_EVENT_CARD_INSERTION: | 539 | case CS_EVENT_CARD_INSERTION: |
553 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 540 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
554 | airo_config(link); | 541 | airo_config(link); |
@@ -573,7 +560,7 @@ static struct pcmcia_driver airo_driver = { | |||
573 | }, | 560 | }, |
574 | .attach = airo_attach, | 561 | .attach = airo_attach, |
575 | .event = airo_event, | 562 | .event = airo_event, |
576 | .detach = airo_detach, | 563 | .remove = airo_detach, |
577 | .id_table = airo_ids, | 564 | .id_table = airo_ids, |
578 | .suspend = airo_suspend, | 565 | .suspend = airo_suspend, |
579 | .resume = airo_resume, | 566 | .resume = airo_resume, |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 598a9cd0f83e..3ab33dd49ea2 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -103,7 +103,7 @@ static int atmel_event(event_t event, int priority, | |||
103 | */ | 103 | */ |
104 | 104 | ||
105 | static dev_link_t *atmel_attach(void); | 105 | static dev_link_t *atmel_attach(void); |
106 | static void atmel_detach(dev_link_t *); | 106 | static void atmel_detach(struct pcmcia_device *p_dev); |
107 | 107 | ||
108 | /* | 108 | /* |
109 | You'll also need to prototype all the functions that will actually | 109 | You'll also need to prototype all the functions that will actually |
@@ -221,7 +221,7 @@ static dev_link_t *atmel_attach(void) | |||
221 | ret = pcmcia_register_client(&link->handle, &client_reg); | 221 | ret = pcmcia_register_client(&link->handle, &client_reg); |
222 | if (ret != 0) { | 222 | if (ret != 0) { |
223 | cs_error(link->handle, RegisterClient, ret); | 223 | cs_error(link->handle, RegisterClient, ret); |
224 | atmel_detach(link); | 224 | atmel_detach(link->handle); |
225 | return NULL; | 225 | return NULL; |
226 | } | 226 | } |
227 | 227 | ||
@@ -237,8 +237,9 @@ static dev_link_t *atmel_attach(void) | |||
237 | 237 | ||
238 | ======================================================================*/ | 238 | ======================================================================*/ |
239 | 239 | ||
240 | static void atmel_detach(dev_link_t *link) | 240 | static void atmel_detach(struct pcmcia_device *p_dev) |
241 | { | 241 | { |
242 | dev_link_t *link = dev_to_instance(p_dev); | ||
242 | dev_link_t **linkp; | 243 | dev_link_t **linkp; |
243 | 244 | ||
244 | DEBUG(0, "atmel_detach(0x%p)\n", link); | 245 | DEBUG(0, "atmel_detach(0x%p)\n", link); |
@@ -252,10 +253,6 @@ static void atmel_detach(dev_link_t *link) | |||
252 | if (link->state & DEV_CONFIG) | 253 | if (link->state & DEV_CONFIG) |
253 | atmel_release(link); | 254 | atmel_release(link); |
254 | 255 | ||
255 | /* Break the link with Card Services */ | ||
256 | if (link->handle) | ||
257 | pcmcia_deregister_client(link->handle); | ||
258 | |||
259 | /* Unlink device structure, free pieces */ | 256 | /* Unlink device structure, free pieces */ |
260 | *linkp = link->next; | 257 | *linkp = link->next; |
261 | kfree(link->priv); | 258 | kfree(link->priv); |
@@ -522,18 +519,10 @@ static int atmel_event(event_t event, int priority, | |||
522 | event_callback_args_t *args) | 519 | event_callback_args_t *args) |
523 | { | 520 | { |
524 | dev_link_t *link = args->client_data; | 521 | dev_link_t *link = args->client_data; |
525 | local_info_t *local = link->priv; | 522 | |
526 | |||
527 | DEBUG(1, "atmel_event(0x%06x)\n", event); | 523 | DEBUG(1, "atmel_event(0x%06x)\n", event); |
528 | 524 | ||
529 | switch (event) { | 525 | switch (event) { |
530 | case CS_EVENT_CARD_REMOVAL: | ||
531 | link->state &= ~DEV_PRESENT; | ||
532 | if (link->state & DEV_CONFIG) { | ||
533 | netif_device_detach(local->eth_dev); | ||
534 | atmel_release(link); | ||
535 | } | ||
536 | break; | ||
537 | case CS_EVENT_CARD_INSERTION: | 526 | case CS_EVENT_CARD_INSERTION: |
538 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 527 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
539 | atmel_config(link); | 528 | atmel_config(link); |
@@ -593,7 +582,7 @@ static struct pcmcia_driver atmel_driver = { | |||
593 | }, | 582 | }, |
594 | .attach = atmel_attach, | 583 | .attach = atmel_attach, |
595 | .event = atmel_event, | 584 | .event = atmel_event, |
596 | .detach = atmel_detach, | 585 | .remove = atmel_detach, |
597 | .id_table = atmel_ids, | 586 | .id_table = atmel_ids, |
598 | .suspend = atmel_suspend, | 587 | .suspend = atmel_suspend, |
599 | .resume = atmel_resume, | 588 | .resume = atmel_resume, |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index ba4a7da98ccd..866142af7d92 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -203,7 +203,7 @@ static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len) | |||
203 | 203 | ||
204 | 204 | ||
205 | 205 | ||
206 | static void prism2_detach(dev_link_t *link); | 206 | static void prism2_detach(struct pcmcia_device *p_dev); |
207 | static void prism2_release(u_long arg); | 207 | static void prism2_release(u_long arg); |
208 | static int prism2_event(event_t event, int priority, | 208 | static int prism2_event(event_t event, int priority, |
209 | event_callback_args_t *args); | 209 | event_callback_args_t *args); |
@@ -528,15 +528,16 @@ static dev_link_t *prism2_attach(void) | |||
528 | ret = pcmcia_register_client(&link->handle, &client_reg); | 528 | ret = pcmcia_register_client(&link->handle, &client_reg); |
529 | if (ret != CS_SUCCESS) { | 529 | if (ret != CS_SUCCESS) { |
530 | cs_error(link->handle, RegisterClient, ret); | 530 | cs_error(link->handle, RegisterClient, ret); |
531 | prism2_detach(link); | 531 | prism2_detach(link->handle); |
532 | return NULL; | 532 | return NULL; |
533 | } | 533 | } |
534 | return link; | 534 | return link; |
535 | } | 535 | } |
536 | 536 | ||
537 | 537 | ||
538 | static void prism2_detach(dev_link_t *link) | 538 | static void prism2_detach(struct pcmcia_device *p_dev) |
539 | { | 539 | { |
540 | dev_link_t *link = dev_to_instance(p_dev); | ||
540 | dev_link_t **linkp; | 541 | dev_link_t **linkp; |
541 | 542 | ||
542 | PDEBUG(DEBUG_FLOW, "prism2_detach\n"); | 543 | PDEBUG(DEBUG_FLOW, "prism2_detach\n"); |
@@ -554,14 +555,6 @@ static void prism2_detach(dev_link_t *link) | |||
554 | prism2_release((u_long)link); | 555 | prism2_release((u_long)link); |
555 | } | 556 | } |
556 | 557 | ||
557 | if (link->handle) { | ||
558 | int res = pcmcia_deregister_client(link->handle); | ||
559 | if (res) { | ||
560 | printk("CardService(DeregisterClient) => %d\n", res); | ||
561 | cs_error(link->handle, DeregisterClient, res); | ||
562 | } | ||
563 | } | ||
564 | |||
565 | *linkp = link->next; | 558 | *linkp = link->next; |
566 | /* release net devices */ | 559 | /* release net devices */ |
567 | if (link->priv) { | 560 | if (link->priv) { |
@@ -902,7 +895,6 @@ static int prism2_event(event_t event, int priority, | |||
902 | event_callback_args_t *args) | 895 | event_callback_args_t *args) |
903 | { | 896 | { |
904 | dev_link_t *link = args->client_data; | 897 | dev_link_t *link = args->client_data; |
905 | struct net_device *dev = (struct net_device *) link->priv; | ||
906 | 898 | ||
907 | switch (event) { | 899 | switch (event) { |
908 | case CS_EVENT_CARD_INSERTION: | 900 | case CS_EVENT_CARD_INSERTION: |
@@ -913,16 +905,6 @@ static int prism2_event(event_t event, int priority, | |||
913 | } | 905 | } |
914 | break; | 906 | break; |
915 | 907 | ||
916 | case CS_EVENT_CARD_REMOVAL: | ||
917 | PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_CARD_REMOVAL\n", dev_info); | ||
918 | link->state &= ~DEV_PRESENT; | ||
919 | if (link->state & DEV_CONFIG) { | ||
920 | netif_stop_queue(dev); | ||
921 | netif_device_detach(dev); | ||
922 | prism2_release((u_long) link); | ||
923 | } | ||
924 | break; | ||
925 | |||
926 | default: | 908 | default: |
927 | PDEBUG(DEBUG_EXTRA, "%s: prism2_event() - unknown event %d\n", | 909 | PDEBUG(DEBUG_EXTRA, "%s: prism2_event() - unknown event %d\n", |
928 | dev_info, event); | 910 | dev_info, event); |
@@ -991,7 +973,7 @@ static struct pcmcia_driver hostap_driver = { | |||
991 | .name = "hostap_cs", | 973 | .name = "hostap_cs", |
992 | }, | 974 | }, |
993 | .attach = prism2_attach, | 975 | .attach = prism2_attach, |
994 | .detach = prism2_detach, | 976 | .remove = prism2_detach, |
995 | .owner = THIS_MODULE, | 977 | .owner = THIS_MODULE, |
996 | .event = prism2_event, | 978 | .event = prism2_event, |
997 | .id_table = hostap_cs_ids, | 979 | .id_table = hostap_cs_ids, |
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index 7ab2d70ffddf..1770677d9e10 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -200,7 +200,7 @@ static int netwave_event(event_t event, int priority, | |||
200 | static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card | 200 | static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card |
201 | insertion */ | 201 | insertion */ |
202 | static dev_link_t *netwave_attach(void); /* Create instance */ | 202 | static dev_link_t *netwave_attach(void); /* Create instance */ |
203 | static void netwave_detach(dev_link_t *); /* Destroy instance */ | 203 | static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */ |
204 | 204 | ||
205 | /* Hardware configuration */ | 205 | /* Hardware configuration */ |
206 | static void netwave_doreset(kio_addr_t iobase, u_char __iomem *ramBase); | 206 | static void netwave_doreset(kio_addr_t iobase, u_char __iomem *ramBase); |
@@ -459,7 +459,7 @@ static dev_link_t *netwave_attach(void) | |||
459 | ret = pcmcia_register_client(&link->handle, &client_reg); | 459 | ret = pcmcia_register_client(&link->handle, &client_reg); |
460 | if (ret != 0) { | 460 | if (ret != 0) { |
461 | cs_error(link->handle, RegisterClient, ret); | 461 | cs_error(link->handle, RegisterClient, ret); |
462 | netwave_detach(link); | 462 | netwave_detach(link->handle); |
463 | return NULL; | 463 | return NULL; |
464 | } | 464 | } |
465 | 465 | ||
@@ -474,8 +474,9 @@ static dev_link_t *netwave_attach(void) | |||
474 | * structures are freed. Otherwise, the structures will be freed | 474 | * structures are freed. Otherwise, the structures will be freed |
475 | * when the device is released. | 475 | * when the device is released. |
476 | */ | 476 | */ |
477 | static void netwave_detach(dev_link_t *link) | 477 | static void netwave_detach(struct pcmcia_device *p_dev) |
478 | { | 478 | { |
479 | dev_link_t *link = dev_to_instance(p_dev); | ||
479 | struct net_device *dev = link->priv; | 480 | struct net_device *dev = link->priv; |
480 | dev_link_t **linkp; | 481 | dev_link_t **linkp; |
481 | 482 | ||
@@ -489,11 +490,7 @@ static void netwave_detach(dev_link_t *link) | |||
489 | */ | 490 | */ |
490 | if (link->state & DEV_CONFIG) | 491 | if (link->state & DEV_CONFIG) |
491 | netwave_release(link); | 492 | netwave_release(link); |
492 | 493 | ||
493 | /* Break the link with Card Services */ | ||
494 | if (link->handle) | ||
495 | pcmcia_deregister_client(link->handle); | ||
496 | |||
497 | /* Locate device structure */ | 494 | /* Locate device structure */ |
498 | for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) | 495 | for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) |
499 | if (*linkp == link) break; | 496 | if (*linkp == link) break; |
@@ -986,22 +983,10 @@ static int netwave_event(event_t event, int priority, | |||
986 | event_callback_args_t *args) | 983 | event_callback_args_t *args) |
987 | { | 984 | { |
988 | dev_link_t *link = args->client_data; | 985 | dev_link_t *link = args->client_data; |
989 | struct net_device *dev = link->priv; | 986 | |
990 | |||
991 | DEBUG(1, "netwave_event(0x%06x)\n", event); | 987 | DEBUG(1, "netwave_event(0x%06x)\n", event); |
992 | |||
993 | switch (event) { | ||
994 | case CS_EVENT_REGISTRATION_COMPLETE: | ||
995 | DEBUG(0, "netwave_cs: registration complete\n"); | ||
996 | break; | ||
997 | 988 | ||
998 | case CS_EVENT_CARD_REMOVAL: | 989 | switch (event) { |
999 | link->state &= ~DEV_PRESENT; | ||
1000 | if (link->state & DEV_CONFIG) { | ||
1001 | netif_device_detach(dev); | ||
1002 | netwave_release(link); | ||
1003 | } | ||
1004 | break; | ||
1005 | case CS_EVENT_CARD_INSERTION: | 990 | case CS_EVENT_CARD_INSERTION: |
1006 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 991 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
1007 | netwave_pcmcia_config( link); | 992 | netwave_pcmcia_config( link); |
@@ -1504,7 +1489,7 @@ static struct pcmcia_driver netwave_driver = { | |||
1504 | }, | 1489 | }, |
1505 | .attach = netwave_attach, | 1490 | .attach = netwave_attach, |
1506 | .event = netwave_event, | 1491 | .event = netwave_event, |
1507 | .detach = netwave_detach, | 1492 | .remove = netwave_detach, |
1508 | .id_table = netwave_ids, | 1493 | .id_table = netwave_ids, |
1509 | .suspend = netwave_suspend, | 1494 | .suspend = netwave_suspend, |
1510 | .resume = netwave_resume, | 1495 | .resume = netwave_resume, |
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index 1d66050e3d6a..00679b6c87c1 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -81,7 +81,7 @@ static dev_link_t *dev_list; /* = NULL */ | |||
81 | /********************************************************************/ | 81 | /********************************************************************/ |
82 | 82 | ||
83 | static void orinoco_cs_release(dev_link_t *link); | 83 | static void orinoco_cs_release(dev_link_t *link); |
84 | static void orinoco_cs_detach(dev_link_t *link); | 84 | static void orinoco_cs_detach(struct pcmcia_device *p_dev); |
85 | 85 | ||
86 | /********************************************************************/ | 86 | /********************************************************************/ |
87 | /* Device methods */ | 87 | /* Device methods */ |
@@ -165,7 +165,7 @@ orinoco_cs_attach(void) | |||
165 | ret = pcmcia_register_client(&link->handle, &client_reg); | 165 | ret = pcmcia_register_client(&link->handle, &client_reg); |
166 | if (ret != CS_SUCCESS) { | 166 | if (ret != CS_SUCCESS) { |
167 | cs_error(link->handle, RegisterClient, ret); | 167 | cs_error(link->handle, RegisterClient, ret); |
168 | orinoco_cs_detach(link); | 168 | orinoco_cs_detach(link->handle); |
169 | return NULL; | 169 | return NULL; |
170 | } | 170 | } |
171 | 171 | ||
@@ -178,8 +178,9 @@ orinoco_cs_attach(void) | |||
178 | * are freed. Otherwise, the structures will be freed when the device | 178 | * are freed. Otherwise, the structures will be freed when the device |
179 | * is released. | 179 | * is released. |
180 | */ | 180 | */ |
181 | static void orinoco_cs_detach(dev_link_t *link) | 181 | static void orinoco_cs_detach(struct pcmcia_device *p_dev) |
182 | { | 182 | { |
183 | dev_link_t *link = dev_to_instance(p_dev); | ||
183 | dev_link_t **linkp; | 184 | dev_link_t **linkp; |
184 | struct net_device *dev = link->priv; | 185 | struct net_device *dev = link->priv; |
185 | 186 | ||
@@ -193,10 +194,6 @@ static void orinoco_cs_detach(dev_link_t *link) | |||
193 | if (link->state & DEV_CONFIG) | 194 | if (link->state & DEV_CONFIG) |
194 | orinoco_cs_release(link); | 195 | orinoco_cs_release(link); |
195 | 196 | ||
196 | /* Break the link with Card Services */ | ||
197 | if (link->handle) | ||
198 | pcmcia_deregister_client(link->handle); | ||
199 | |||
200 | /* Unlink device structure, and free it */ | 197 | /* Unlink device structure, and free it */ |
201 | *linkp = link->next; | 198 | *linkp = link->next; |
202 | DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev); | 199 | DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev); |
@@ -551,30 +548,15 @@ orinoco_cs_event(event_t event, int priority, | |||
551 | event_callback_args_t * args) | 548 | event_callback_args_t * args) |
552 | { | 549 | { |
553 | dev_link_t *link = args->client_data; | 550 | dev_link_t *link = args->client_data; |
554 | struct net_device *dev = link->priv; | ||
555 | struct orinoco_private *priv = netdev_priv(dev); | ||
556 | int err = 0; | ||
557 | 551 | ||
558 | switch (event) { | 552 | switch (event) { |
559 | case CS_EVENT_CARD_REMOVAL: | ||
560 | link->state &= ~DEV_PRESENT; | ||
561 | if (link->state & DEV_CONFIG) { | ||
562 | unsigned long flags; | ||
563 | |||
564 | spin_lock_irqsave(&priv->lock, flags); | ||
565 | netif_device_detach(dev); | ||
566 | priv->hw_unavailable++; | ||
567 | spin_unlock_irqrestore(&priv->lock, flags); | ||
568 | } | ||
569 | break; | ||
570 | |||
571 | case CS_EVENT_CARD_INSERTION: | 553 | case CS_EVENT_CARD_INSERTION: |
572 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 554 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
573 | orinoco_cs_config(link); | 555 | orinoco_cs_config(link); |
574 | break; | 556 | break; |
575 | } | 557 | } |
576 | 558 | ||
577 | return err; | 559 | return 0; |
578 | } /* orinoco_cs_event */ | 560 | } /* orinoco_cs_event */ |
579 | 561 | ||
580 | /********************************************************************/ | 562 | /********************************************************************/ |
@@ -677,7 +659,7 @@ static struct pcmcia_driver orinoco_driver = { | |||
677 | .name = DRIVER_NAME, | 659 | .name = DRIVER_NAME, |
678 | }, | 660 | }, |
679 | .attach = orinoco_cs_attach, | 661 | .attach = orinoco_cs_attach, |
680 | .detach = orinoco_cs_detach, | 662 | .remove = orinoco_cs_detach, |
681 | .event = orinoco_cs_event, | 663 | .event = orinoco_cs_event, |
682 | .id_table = orinoco_cs_ids, | 664 | .id_table = orinoco_cs_ids, |
683 | .suspend = orinoco_cs_suspend, | 665 | .suspend = orinoco_cs_suspend, |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index c2cb6c8e6d7c..33a89e292126 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -94,7 +94,7 @@ static void ray_config(dev_link_t *link); | |||
94 | static void ray_release(dev_link_t *link); | 94 | static void ray_release(dev_link_t *link); |
95 | static int ray_event(event_t event, int priority, event_callback_args_t *args); | 95 | static int ray_event(event_t event, int priority, event_callback_args_t *args); |
96 | static dev_link_t *ray_attach(void); | 96 | static dev_link_t *ray_attach(void); |
97 | static void ray_detach(dev_link_t *); | 97 | static void ray_detach(struct pcmcia_device *p_dev); |
98 | 98 | ||
99 | /***** Prototypes indicated by device structure ******************************/ | 99 | /***** Prototypes indicated by device structure ******************************/ |
100 | static int ray_dev_close(struct net_device *dev); | 100 | static int ray_dev_close(struct net_device *dev); |
@@ -402,7 +402,7 @@ static dev_link_t *ray_attach(void) | |||
402 | if (ret != 0) { | 402 | if (ret != 0) { |
403 | printk("ray_cs ray_attach RegisterClient unhappy - detaching\n"); | 403 | printk("ray_cs ray_attach RegisterClient unhappy - detaching\n"); |
404 | cs_error(link->handle, RegisterClient, ret); | 404 | cs_error(link->handle, RegisterClient, ret); |
405 | ray_detach(link); | 405 | ray_detach(link->handle); |
406 | return NULL; | 406 | return NULL; |
407 | } | 407 | } |
408 | DEBUG(2,"ray_cs ray_attach ending\n"); | 408 | DEBUG(2,"ray_cs ray_attach ending\n"); |
@@ -418,9 +418,12 @@ fail_alloc_dev: | |||
418 | structures are freed. Otherwise, the structures will be freed | 418 | structures are freed. Otherwise, the structures will be freed |
419 | when the device is released. | 419 | when the device is released. |
420 | =============================================================================*/ | 420 | =============================================================================*/ |
421 | static void ray_detach(dev_link_t *link) | 421 | static void ray_detach(struct pcmcia_device *p_dev) |
422 | { | 422 | { |
423 | dev_link_t *link = dev_to_instance(p_dev); | ||
423 | dev_link_t **linkp; | 424 | dev_link_t **linkp; |
425 | struct net_device *dev; | ||
426 | ray_dev_t *local; | ||
424 | 427 | ||
425 | DEBUG(1, "ray_detach(0x%p)\n", link); | 428 | DEBUG(1, "ray_detach(0x%p)\n", link); |
426 | 429 | ||
@@ -430,22 +433,18 @@ static void ray_detach(dev_link_t *link) | |||
430 | if (*linkp == NULL) | 433 | if (*linkp == NULL) |
431 | return; | 434 | return; |
432 | 435 | ||
433 | /* If the device is currently configured and active, we won't | 436 | dev = link->priv; |
434 | actually delete it yet. Instead, it is marked so that when | 437 | |
435 | the release() function is called, that will trigger a proper | 438 | if (link->state & DEV_CONFIG) { |
436 | detach(). | 439 | ray_release(link); |
437 | */ | 440 | |
438 | if (link->state & DEV_CONFIG) | 441 | local = (ray_dev_t *)dev->priv; |
439 | ray_release(link); | 442 | del_timer(&local->timer); |
443 | } | ||
440 | 444 | ||
441 | /* Break the link with Card Services */ | ||
442 | if (link->handle) | ||
443 | pcmcia_deregister_client(link->handle); | ||
444 | |||
445 | /* Unlink device structure, free pieces */ | 445 | /* Unlink device structure, free pieces */ |
446 | *linkp = link->next; | 446 | *linkp = link->next; |
447 | if (link->priv) { | 447 | if (link->priv) { |
448 | struct net_device *dev = link->priv; | ||
449 | if (link->dev) unregister_netdev(dev); | 448 | if (link->dev) unregister_netdev(dev); |
450 | free_netdev(dev); | 449 | free_netdev(dev); |
451 | } | 450 | } |
@@ -940,19 +939,9 @@ static int ray_event(event_t event, int priority, | |||
940 | event_callback_args_t *args) | 939 | event_callback_args_t *args) |
941 | { | 940 | { |
942 | dev_link_t *link = args->client_data; | 941 | dev_link_t *link = args->client_data; |
943 | struct net_device *dev = link->priv; | ||
944 | ray_dev_t *local = (ray_dev_t *)dev->priv; | ||
945 | DEBUG(1, "ray_event(0x%06x)\n", event); | 942 | DEBUG(1, "ray_event(0x%06x)\n", event); |
946 | 943 | ||
947 | switch (event) { | 944 | switch (event) { |
948 | case CS_EVENT_CARD_REMOVAL: | ||
949 | link->state &= ~DEV_PRESENT; | ||
950 | netif_device_detach(dev); | ||
951 | if (link->state & DEV_CONFIG) { | ||
952 | ray_release(link); | ||
953 | del_timer(&local->timer); | ||
954 | } | ||
955 | break; | ||
956 | case CS_EVENT_CARD_INSERTION: | 945 | case CS_EVENT_CARD_INSERTION: |
957 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 946 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
958 | ray_config(link); | 947 | ray_config(link); |
@@ -2958,7 +2947,7 @@ static struct pcmcia_driver ray_driver = { | |||
2958 | }, | 2947 | }, |
2959 | .attach = ray_attach, | 2948 | .attach = ray_attach, |
2960 | .event = ray_event, | 2949 | .event = ray_event, |
2961 | .detach = ray_detach, | 2950 | .remove = ray_detach, |
2962 | .id_table = ray_ids, | 2951 | .id_table = ray_ids, |
2963 | .suspend = ray_suspend, | 2952 | .suspend = ray_suspend, |
2964 | .resume = ray_resume, | 2953 | .resume = ray_resume, |
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index 3938a5735659..a2dcab7995c1 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -90,7 +90,7 @@ static dev_link_t *dev_list; /* = NULL */ | |||
90 | /********************************************************************/ | 90 | /********************************************************************/ |
91 | 91 | ||
92 | static void spectrum_cs_release(dev_link_t *link); | 92 | static void spectrum_cs_release(dev_link_t *link); |
93 | static void spectrum_cs_detach(dev_link_t *link); | 93 | static void spectrum_cs_detach(struct pcmcia_device *p_dev); |
94 | 94 | ||
95 | /********************************************************************/ | 95 | /********************************************************************/ |
96 | /* Firmware downloader */ | 96 | /* Firmware downloader */ |
@@ -647,7 +647,7 @@ spectrum_cs_attach(void) | |||
647 | ret = pcmcia_register_client(&link->handle, &client_reg); | 647 | ret = pcmcia_register_client(&link->handle, &client_reg); |
648 | if (ret != CS_SUCCESS) { | 648 | if (ret != CS_SUCCESS) { |
649 | cs_error(link->handle, RegisterClient, ret); | 649 | cs_error(link->handle, RegisterClient, ret); |
650 | spectrum_cs_detach(link); | 650 | spectrum_cs_detach(link->handle); |
651 | return NULL; | 651 | return NULL; |
652 | } | 652 | } |
653 | 653 | ||
@@ -660,27 +660,14 @@ spectrum_cs_attach(void) | |||
660 | * are freed. Otherwise, the structures will be freed when the device | 660 | * are freed. Otherwise, the structures will be freed when the device |
661 | * is released. | 661 | * is released. |
662 | */ | 662 | */ |
663 | static void spectrum_cs_detach(dev_link_t *link) | 663 | static void spectrum_cs_detach(struct pcmcia_device *p_dev) |
664 | { | 664 | { |
665 | dev_link_t **linkp; | 665 | dev_link_t *link = dev_to_instance(p_dev); |
666 | struct net_device *dev = link->priv; | 666 | struct net_device *dev = link->priv; |
667 | 667 | ||
668 | /* Locate device structure */ | ||
669 | for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) | ||
670 | if (*linkp == link) | ||
671 | break; | ||
672 | |||
673 | BUG_ON(*linkp == NULL); | ||
674 | |||
675 | if (link->state & DEV_CONFIG) | 668 | if (link->state & DEV_CONFIG) |
676 | spectrum_cs_release(link); | 669 | spectrum_cs_release(link); |
677 | 670 | ||
678 | /* Break the link with Card Services */ | ||
679 | if (link->handle) | ||
680 | pcmcia_deregister_client(link->handle); | ||
681 | |||
682 | /* Unlink device structure, and free it */ | ||
683 | *linkp = link->next; | ||
684 | DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev); | 671 | DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev); |
685 | if (link->dev) { | 672 | if (link->dev) { |
686 | DEBUG(0, PFX "About to unregister net device %p\n", | 673 | DEBUG(0, PFX "About to unregister net device %p\n", |
@@ -1007,22 +994,8 @@ spectrum_cs_event(event_t event, int priority, | |||
1007 | event_callback_args_t * args) | 994 | event_callback_args_t * args) |
1008 | { | 995 | { |
1009 | dev_link_t *link = args->client_data; | 996 | dev_link_t *link = args->client_data; |
1010 | struct net_device *dev = link->priv; | ||
1011 | struct orinoco_private *priv = netdev_priv(dev); | ||
1012 | 997 | ||
1013 | switch (event) { | 998 | switch (event) { |
1014 | case CS_EVENT_CARD_REMOVAL: | ||
1015 | link->state &= ~DEV_PRESENT; | ||
1016 | if (link->state & DEV_CONFIG) { | ||
1017 | unsigned long flags; | ||
1018 | |||
1019 | spin_lock_irqsave(&priv->lock, flags); | ||
1020 | netif_device_detach(dev); | ||
1021 | priv->hw_unavailable++; | ||
1022 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1023 | } | ||
1024 | break; | ||
1025 | |||
1026 | case CS_EVENT_CARD_INSERTION: | 999 | case CS_EVENT_CARD_INSERTION: |
1027 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 1000 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
1028 | spectrum_cs_config(link); | 1001 | spectrum_cs_config(link); |
@@ -1057,7 +1030,7 @@ static struct pcmcia_driver orinoco_driver = { | |||
1057 | .name = DRIVER_NAME, | 1030 | .name = DRIVER_NAME, |
1058 | }, | 1031 | }, |
1059 | .attach = spectrum_cs_attach, | 1032 | .attach = spectrum_cs_attach, |
1060 | .detach = spectrum_cs_detach, | 1033 | .remove = spectrum_cs_detach, |
1061 | .suspend = spectrum_cs_suspend, | 1034 | .suspend = spectrum_cs_suspend, |
1062 | .resume = spectrum_cs_resume, | 1035 | .resume = spectrum_cs_resume, |
1063 | .event = spectrum_cs_event, | 1036 | .event = spectrum_cs_event, |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 3e3532830c26..255952d8cea0 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -4692,7 +4692,7 @@ wavelan_attach(void) | |||
4692 | if(ret != 0) | 4692 | if(ret != 0) |
4693 | { | 4693 | { |
4694 | cs_error(link->handle, RegisterClient, ret); | 4694 | cs_error(link->handle, RegisterClient, ret); |
4695 | wavelan_detach(link); | 4695 | wavelan_detach(link->handle); |
4696 | return NULL; | 4696 | return NULL; |
4697 | } | 4697 | } |
4698 | 4698 | ||
@@ -4711,8 +4711,10 @@ wavelan_attach(void) | |||
4711 | * is released. | 4711 | * is released. |
4712 | */ | 4712 | */ |
4713 | static void | 4713 | static void |
4714 | wavelan_detach(dev_link_t * link) | 4714 | wavelan_detach(struct pcmcia_device *p_dev) |
4715 | { | 4715 | { |
4716 | dev_link_t *link = dev_to_instance(p_dev); | ||
4717 | |||
4716 | #ifdef DEBUG_CALLBACK_TRACE | 4718 | #ifdef DEBUG_CALLBACK_TRACE |
4717 | printk(KERN_DEBUG "-> wavelan_detach(0x%p)\n", link); | 4719 | printk(KERN_DEBUG "-> wavelan_detach(0x%p)\n", link); |
4718 | #endif | 4720 | #endif |
@@ -4729,10 +4731,6 @@ wavelan_detach(dev_link_t * link) | |||
4729 | wv_pcmcia_release(link); | 4731 | wv_pcmcia_release(link); |
4730 | } | 4732 | } |
4731 | 4733 | ||
4732 | /* Break the link with Card Services */ | ||
4733 | if(link->handle) | ||
4734 | pcmcia_deregister_client(link->handle); | ||
4735 | |||
4736 | /* Remove the interface data from the linked list */ | 4734 | /* Remove the interface data from the linked list */ |
4737 | if(dev_list == link) | 4735 | if(dev_list == link) |
4738 | dev_list = link->next; | 4736 | dev_list = link->next; |
@@ -4854,25 +4852,6 @@ wavelan_event(event_t event, /* The event received */ | |||
4854 | 4852 | ||
4855 | switch(event) | 4853 | switch(event) |
4856 | { | 4854 | { |
4857 | case CS_EVENT_REGISTRATION_COMPLETE: | ||
4858 | #ifdef DEBUG_CONFIG_INFO | ||
4859 | printk(KERN_DEBUG "wavelan_cs: registration complete\n"); | ||
4860 | #endif | ||
4861 | break; | ||
4862 | |||
4863 | case CS_EVENT_CARD_REMOVAL: | ||
4864 | /* Oups ! The card is no more there */ | ||
4865 | link->state &= ~DEV_PRESENT; | ||
4866 | if(link->state & DEV_CONFIG) | ||
4867 | { | ||
4868 | /* Accept no more transmissions */ | ||
4869 | netif_device_detach(dev); | ||
4870 | |||
4871 | /* Release the card */ | ||
4872 | wv_pcmcia_release(link); | ||
4873 | } | ||
4874 | break; | ||
4875 | |||
4876 | case CS_EVENT_CARD_INSERTION: | 4855 | case CS_EVENT_CARD_INSERTION: |
4877 | /* Reset and configure the card */ | 4856 | /* Reset and configure the card */ |
4878 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 4857 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
@@ -4906,7 +4885,7 @@ static struct pcmcia_driver wavelan_driver = { | |||
4906 | }, | 4885 | }, |
4907 | .attach = wavelan_attach, | 4886 | .attach = wavelan_attach, |
4908 | .event = wavelan_event, | 4887 | .event = wavelan_event, |
4909 | .detach = wavelan_detach, | 4888 | .remove = wavelan_detach, |
4910 | .id_table = wavelan_ids, | 4889 | .id_table = wavelan_ids, |
4911 | .suspend = wavelan_suspend, | 4890 | .suspend = wavelan_suspend, |
4912 | .resume = wavelan_resume, | 4891 | .resume = wavelan_resume, |
diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h index 724a715089c9..3cb34817c039 100644 --- a/drivers/net/wireless/wavelan_cs.p.h +++ b/drivers/net/wireless/wavelan_cs.p.h | |||
@@ -757,7 +757,7 @@ static int | |||
757 | static dev_link_t * | 757 | static dev_link_t * |
758 | wavelan_attach(void); /* Create a new device */ | 758 | wavelan_attach(void); /* Create a new device */ |
759 | static void | 759 | static void |
760 | wavelan_detach(dev_link_t *); /* Destroy a removed device */ | 760 | wavelan_detach(struct pcmcia_device *p_dev); /* Destroy a removed device */ |
761 | static int | 761 | static int |
762 | wavelan_event(event_t, /* Manage pcmcia events */ | 762 | wavelan_event(event_t, /* Manage pcmcia events */ |
763 | int, | 763 | int, |
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 75114318457e..21e498fe7b14 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
@@ -1498,9 +1498,11 @@ static struct ethtool_ops ops = { | |||
1498 | * Services. If it has been released, all local data structures are freed. | 1498 | * Services. If it has been released, all local data structures are freed. |
1499 | * Otherwise, the structures will be freed when the device is released. | 1499 | * Otherwise, the structures will be freed when the device is released. |
1500 | */ | 1500 | */ |
1501 | static void wl3501_detach(dev_link_t *link) | 1501 | static void wl3501_detach(struct pcmcia_device *p_dev) |
1502 | { | 1502 | { |
1503 | dev_link_t *link = dev_to_instance(p_dev); | ||
1503 | dev_link_t **linkp; | 1504 | dev_link_t **linkp; |
1505 | struct net_device *dev = link->priv; | ||
1504 | 1506 | ||
1505 | /* Locate device structure */ | 1507 | /* Locate device structure */ |
1506 | for (linkp = &wl3501_dev_list; *linkp; linkp = &(*linkp)->next) | 1508 | for (linkp = &wl3501_dev_list; *linkp; linkp = &(*linkp)->next) |
@@ -1514,16 +1516,12 @@ static void wl3501_detach(dev_link_t *link) | |||
1514 | * function is called, that will trigger a proper detach(). */ | 1516 | * function is called, that will trigger a proper detach(). */ |
1515 | 1517 | ||
1516 | if (link->state & DEV_CONFIG) { | 1518 | if (link->state & DEV_CONFIG) { |
1517 | #ifdef PCMCIA_DEBUG | 1519 | while (link->open > 0) |
1518 | printk(KERN_DEBUG "wl3501_cs: detach postponed, '%s' " | 1520 | wl3501_close(dev); |
1519 | "still locked\n", link->dev->dev_name); | ||
1520 | #endif | ||
1521 | goto out; | ||
1522 | } | ||
1523 | 1521 | ||
1524 | /* Break the link with Card Services */ | 1522 | netif_device_detach(dev); |
1525 | if (link->handle) | 1523 | wl3501_release(link); |
1526 | pcmcia_deregister_client(link->handle); | 1524 | } |
1527 | 1525 | ||
1528 | /* Unlink device structure, free pieces */ | 1526 | /* Unlink device structure, free pieces */ |
1529 | *linkp = link->next; | 1527 | *linkp = link->next; |
@@ -2012,7 +2010,7 @@ static dev_link_t *wl3501_attach(void) | |||
2012 | ret = pcmcia_register_client(&link->handle, &client_reg); | 2010 | ret = pcmcia_register_client(&link->handle, &client_reg); |
2013 | if (ret) { | 2011 | if (ret) { |
2014 | cs_error(link->handle, RegisterClient, ret); | 2012 | cs_error(link->handle, RegisterClient, ret); |
2015 | wl3501_detach(link); | 2013 | wl3501_detach(link->handle); |
2016 | link = NULL; | 2014 | link = NULL; |
2017 | } | 2015 | } |
2018 | out: | 2016 | out: |
@@ -2225,18 +2223,8 @@ static int wl3501_resume(struct pcmcia_device *p_dev) | |||
2225 | static int wl3501_event(event_t event, int pri, event_callback_args_t *args) | 2223 | static int wl3501_event(event_t event, int pri, event_callback_args_t *args) |
2226 | { | 2224 | { |
2227 | dev_link_t *link = args->client_data; | 2225 | dev_link_t *link = args->client_data; |
2228 | struct net_device *dev = link->priv; | ||
2229 | 2226 | ||
2230 | switch (event) { | 2227 | switch (event) { |
2231 | case CS_EVENT_CARD_REMOVAL: | ||
2232 | link->state &= ~DEV_PRESENT; | ||
2233 | if (link->state & DEV_CONFIG) { | ||
2234 | while (link->open > 0) | ||
2235 | wl3501_close(dev); | ||
2236 | netif_device_detach(dev); | ||
2237 | wl3501_release(link); | ||
2238 | } | ||
2239 | break; | ||
2240 | case CS_EVENT_CARD_INSERTION: | 2228 | case CS_EVENT_CARD_INSERTION: |
2241 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 2229 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
2242 | wl3501_config(link); | 2230 | wl3501_config(link); |
@@ -2258,7 +2246,7 @@ static struct pcmcia_driver wl3501_driver = { | |||
2258 | }, | 2246 | }, |
2259 | .attach = wl3501_attach, | 2247 | .attach = wl3501_attach, |
2260 | .event = wl3501_event, | 2248 | .event = wl3501_event, |
2261 | .detach = wl3501_detach, | 2249 | .remove = wl3501_detach, |
2262 | .id_table = wl3501_ids, | 2250 | .id_table = wl3501_ids, |
2263 | .suspend = wl3501_suspend, | 2251 | .suspend = wl3501_suspend, |
2264 | .resume = wl3501_resume, | 2252 | .resume = wl3501_resume, |