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/3c574_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/3c574_cs.c')
-rw-r--r-- | drivers/net/pcmcia/3c574_cs.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 80414a77fe75..60a3bc2b8fc4 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
@@ -253,7 +253,7 @@ static void set_rx_mode(struct net_device *dev); | |||
253 | static dev_info_t dev_info = "3c574_cs"; | 253 | static dev_info_t dev_info = "3c574_cs"; |
254 | 254 | ||
255 | static dev_link_t *tc574_attach(void); | 255 | static dev_link_t *tc574_attach(void); |
256 | static void tc574_detach(dev_link_t *); | 256 | static void tc574_detach(struct pcmcia_device *p_dev); |
257 | 257 | ||
258 | static dev_link_t *dev_list; | 258 | static dev_link_t *dev_list; |
259 | 259 | ||
@@ -316,7 +316,7 @@ static dev_link_t *tc574_attach(void) | |||
316 | ret = pcmcia_register_client(&link->handle, &client_reg); | 316 | ret = pcmcia_register_client(&link->handle, &client_reg); |
317 | if (ret != 0) { | 317 | if (ret != 0) { |
318 | cs_error(link->handle, RegisterClient, ret); | 318 | cs_error(link->handle, RegisterClient, ret); |
319 | tc574_detach(link); | 319 | tc574_detach(link->handle); |
320 | return NULL; | 320 | return NULL; |
321 | } | 321 | } |
322 | 322 | ||
@@ -332,8 +332,9 @@ static dev_link_t *tc574_attach(void) | |||
332 | 332 | ||
333 | */ | 333 | */ |
334 | 334 | ||
335 | static void tc574_detach(dev_link_t *link) | 335 | static void tc574_detach(struct pcmcia_device *p_dev) |
336 | { | 336 | { |
337 | dev_link_t *link = dev_to_instance(p_dev); | ||
337 | struct net_device *dev = link->priv; | 338 | struct net_device *dev = link->priv; |
338 | dev_link_t **linkp; | 339 | dev_link_t **linkp; |
339 | 340 | ||
@@ -351,9 +352,6 @@ static void tc574_detach(dev_link_t *link) | |||
351 | if (link->state & DEV_CONFIG) | 352 | if (link->state & DEV_CONFIG) |
352 | tc574_release(link); | 353 | tc574_release(link); |
353 | 354 | ||
354 | if (link->handle) | ||
355 | pcmcia_deregister_client(link->handle); | ||
356 | |||
357 | /* Unlink device structure, free bits */ | 355 | /* Unlink device structure, free bits */ |
358 | *linkp = link->next; | 356 | *linkp = link->next; |
359 | free_netdev(dev); | 357 | free_netdev(dev); |
@@ -590,16 +588,10 @@ static int tc574_event(event_t event, int priority, | |||
590 | event_callback_args_t *args) | 588 | event_callback_args_t *args) |
591 | { | 589 | { |
592 | dev_link_t *link = args->client_data; | 590 | dev_link_t *link = args->client_data; |
593 | struct net_device *dev = link->priv; | ||
594 | 591 | ||
595 | DEBUG(1, "3c574_event(0x%06x)\n", event); | 592 | DEBUG(1, "3c574_event(0x%06x)\n", event); |
596 | 593 | ||
597 | switch (event) { | 594 | switch (event) { |
598 | case CS_EVENT_CARD_REMOVAL: | ||
599 | link->state &= ~DEV_PRESENT; | ||
600 | if (link->state & DEV_CONFIG) | ||
601 | netif_device_detach(dev); | ||
602 | break; | ||
603 | case CS_EVENT_CARD_INSERTION: | 595 | case CS_EVENT_CARD_INSERTION: |
604 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 596 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
605 | tc574_config(link); | 597 | tc574_config(link); |
@@ -1304,7 +1296,7 @@ static struct pcmcia_driver tc574_driver = { | |||
1304 | }, | 1296 | }, |
1305 | .attach = tc574_attach, | 1297 | .attach = tc574_attach, |
1306 | .event = tc574_event, | 1298 | .event = tc574_event, |
1307 | .detach = tc574_detach, | 1299 | .remove = tc574_detach, |
1308 | .id_table = tc574_ids, | 1300 | .id_table = tc574_ids, |
1309 | .suspend = tc574_suspend, | 1301 | .suspend = tc574_suspend, |
1310 | .resume = tc574_resume, | 1302 | .resume = tc574_resume, |