aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/atmel_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/atmel_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/atmel_cs.c')
-rw-r--r--drivers/net/wireless/atmel_cs.c25
1 files changed, 7 insertions, 18 deletions
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
105static dev_link_t *atmel_attach(void); 105static dev_link_t *atmel_attach(void);
106static void atmel_detach(dev_link_t *); 106static 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
240static void atmel_detach(dev_link_t *link) 240static 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,