aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/nmclan_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/nmclan_cs.c')
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index fa4921f8b9fc..011ceb090320 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -440,7 +440,7 @@ static struct ethtool_ops netdev_ethtool_ops;
440 440
441 441
442static dev_link_t *nmclan_attach(void); 442static dev_link_t *nmclan_attach(void);
443static void nmclan_detach(dev_link_t *); 443static void nmclan_detach(struct pcmcia_device *p_dev);
444 444
445/* ---------------------------------------------------------------------------- 445/* ----------------------------------------------------------------------------
446nmclan_attach 446nmclan_attach
@@ -506,7 +506,7 @@ static dev_link_t *nmclan_attach(void)
506 ret = pcmcia_register_client(&link->handle, &client_reg); 506 ret = pcmcia_register_client(&link->handle, &client_reg);
507 if (ret != 0) { 507 if (ret != 0) {
508 cs_error(link->handle, RegisterClient, ret); 508 cs_error(link->handle, RegisterClient, ret);
509 nmclan_detach(link); 509 nmclan_detach(link->handle);
510 return NULL; 510 return NULL;
511 } 511 }
512 512
@@ -521,8 +521,9 @@ nmclan_detach
521 when the device is released. 521 when the device is released.
522---------------------------------------------------------------------------- */ 522---------------------------------------------------------------------------- */
523 523
524static void nmclan_detach(dev_link_t *link) 524static void nmclan_detach(struct pcmcia_device *p_dev)
525{ 525{
526 dev_link_t *link = dev_to_instance(p_dev);
526 struct net_device *dev = link->priv; 527 struct net_device *dev = link->priv;
527 dev_link_t **linkp; 528 dev_link_t **linkp;
528 529
@@ -540,9 +541,6 @@ static void nmclan_detach(dev_link_t *link)
540 if (link->state & DEV_CONFIG) 541 if (link->state & DEV_CONFIG)
541 nmclan_release(link); 542 nmclan_release(link);
542 543
543 if (link->handle)
544 pcmcia_deregister_client(link->handle);
545
546 /* Unlink device structure, free bits */ 544 /* Unlink device structure, free bits */
547 *linkp = link->next; 545 *linkp = link->next;
548 free_netdev(dev); 546 free_netdev(dev);
@@ -845,16 +843,10 @@ static int nmclan_event(event_t event, int priority,
845 event_callback_args_t *args) 843 event_callback_args_t *args)
846{ 844{
847 dev_link_t *link = args->client_data; 845 dev_link_t *link = args->client_data;
848 struct net_device *dev = link->priv;
849 846
850 DEBUG(1, "nmclan_event(0x%06x)\n", event); 847 DEBUG(1, "nmclan_event(0x%06x)\n", event);
851 848
852 switch (event) { 849 switch (event) {
853 case CS_EVENT_CARD_REMOVAL:
854 link->state &= ~DEV_PRESENT;
855 if (link->state & DEV_CONFIG)
856 netif_device_detach(dev);
857 break;
858 case CS_EVENT_CARD_INSERTION: 850 case CS_EVENT_CARD_INSERTION:
859 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 851 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
860 nmclan_config(link); 852 nmclan_config(link);
@@ -1694,7 +1686,7 @@ static struct pcmcia_driver nmclan_cs_driver = {
1694 }, 1686 },
1695 .attach = nmclan_attach, 1687 .attach = nmclan_attach,
1696 .event = nmclan_event, 1688 .event = nmclan_event,
1697 .detach = nmclan_detach, 1689 .remove = nmclan_detach,
1698 .id_table = nmclan_ids, 1690 .id_table = nmclan_ids,
1699 .suspend = nmclan_suspend, 1691 .suspend = nmclan_suspend,
1700 .resume = nmclan_resume, 1692 .resume = nmclan_resume,