aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/airo_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:23:14 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 18:03:10 -0500
commitcc3b4866bee996c922e875b8c8efe9f0d8803aae (patch)
tree6632837b6986f33566f75ed971cecbdc210e3201 /drivers/net/wireless/airo_cs.c
parent8e9e793d68fcda6cc84c18cedf85ca0f91d801a8 (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/airo_cs.c')
-rw-r--r--drivers/net/wireless/airo_cs.c31
1 files changed, 9 insertions, 22 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
94static dev_link_t *airo_attach(void); 94static dev_link_t *airo_attach(void);
95static void airo_detach(dev_link_t *); 95static 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
229static void airo_detach(dev_link_t *link) 229static 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,