diff options
Diffstat (limited to 'drivers/net/pcmcia/3c589_cs.c')
-rw-r--r-- | drivers/net/pcmcia/3c589_cs.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index bbda681ac102..09b96c76216e 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -164,7 +164,7 @@ static struct ethtool_ops netdev_ethtool_ops; | |||
164 | static dev_info_t dev_info = "3c589_cs"; | 164 | static dev_info_t dev_info = "3c589_cs"; |
165 | 165 | ||
166 | static dev_link_t *tc589_attach(void); | 166 | static dev_link_t *tc589_attach(void); |
167 | static void tc589_detach(dev_link_t *); | 167 | static void tc589_detach(struct pcmcia_device *p_dev); |
168 | 168 | ||
169 | static dev_link_t *dev_list; | 169 | static dev_link_t *dev_list; |
170 | 170 | ||
@@ -230,7 +230,7 @@ static dev_link_t *tc589_attach(void) | |||
230 | ret = pcmcia_register_client(&link->handle, &client_reg); | 230 | ret = pcmcia_register_client(&link->handle, &client_reg); |
231 | if (ret != 0) { | 231 | if (ret != 0) { |
232 | cs_error(link->handle, RegisterClient, ret); | 232 | cs_error(link->handle, RegisterClient, ret); |
233 | tc589_detach(link); | 233 | tc589_detach(link->handle); |
234 | return NULL; | 234 | return NULL; |
235 | } | 235 | } |
236 | 236 | ||
@@ -246,8 +246,9 @@ static dev_link_t *tc589_attach(void) | |||
246 | 246 | ||
247 | ======================================================================*/ | 247 | ======================================================================*/ |
248 | 248 | ||
249 | static void tc589_detach(dev_link_t *link) | 249 | static void tc589_detach(struct pcmcia_device *p_dev) |
250 | { | 250 | { |
251 | dev_link_t *link = dev_to_instance(p_dev); | ||
251 | struct net_device *dev = link->priv; | 252 | struct net_device *dev = link->priv; |
252 | dev_link_t **linkp; | 253 | dev_link_t **linkp; |
253 | 254 | ||
@@ -264,10 +265,7 @@ static void tc589_detach(dev_link_t *link) | |||
264 | 265 | ||
265 | if (link->state & DEV_CONFIG) | 266 | if (link->state & DEV_CONFIG) |
266 | tc589_release(link); | 267 | tc589_release(link); |
267 | 268 | ||
268 | if (link->handle) | ||
269 | pcmcia_deregister_client(link->handle); | ||
270 | |||
271 | /* Unlink device structure, free bits */ | 269 | /* Unlink device structure, free bits */ |
272 | *linkp = link->next; | 270 | *linkp = link->next; |
273 | free_netdev(dev); | 271 | free_netdev(dev); |
@@ -466,16 +464,10 @@ static int tc589_event(event_t event, int priority, | |||
466 | event_callback_args_t *args) | 464 | event_callback_args_t *args) |
467 | { | 465 | { |
468 | dev_link_t *link = args->client_data; | 466 | dev_link_t *link = args->client_data; |
469 | struct net_device *dev = link->priv; | ||
470 | 467 | ||
471 | DEBUG(1, "3c589_event(0x%06x)\n", event); | 468 | DEBUG(1, "3c589_event(0x%06x)\n", event); |
472 | 469 | ||
473 | switch (event) { | 470 | switch (event) { |
474 | case CS_EVENT_CARD_REMOVAL: | ||
475 | link->state &= ~DEV_PRESENT; | ||
476 | if (link->state & DEV_CONFIG) | ||
477 | netif_device_detach(dev); | ||
478 | break; | ||
479 | case CS_EVENT_CARD_INSERTION: | 471 | case CS_EVENT_CARD_INSERTION: |
480 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 472 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
481 | tc589_config(link); | 473 | tc589_config(link); |
@@ -1079,7 +1071,7 @@ static struct pcmcia_driver tc589_driver = { | |||
1079 | }, | 1071 | }, |
1080 | .attach = tc589_attach, | 1072 | .attach = tc589_attach, |
1081 | .event = tc589_event, | 1073 | .event = tc589_event, |
1082 | .detach = tc589_detach, | 1074 | .remove = tc589_detach, |
1083 | .id_table = tc589_ids, | 1075 | .id_table = tc589_ids, |
1084 | .suspend = tc589_suspend, | 1076 | .suspend = tc589_suspend, |
1085 | .resume = tc589_resume, | 1077 | .resume = tc589_resume, |