diff options
Diffstat (limited to 'drivers/net/wireless/spectrum_cs.c')
-rw-r--r-- | drivers/net/wireless/spectrum_cs.c | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index 3938a5735659..a2dcab7995c1 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -90,7 +90,7 @@ static dev_link_t *dev_list; /* = NULL */ | |||
90 | /********************************************************************/ | 90 | /********************************************************************/ |
91 | 91 | ||
92 | static void spectrum_cs_release(dev_link_t *link); | 92 | static void spectrum_cs_release(dev_link_t *link); |
93 | static void spectrum_cs_detach(dev_link_t *link); | 93 | static void spectrum_cs_detach(struct pcmcia_device *p_dev); |
94 | 94 | ||
95 | /********************************************************************/ | 95 | /********************************************************************/ |
96 | /* Firmware downloader */ | 96 | /* Firmware downloader */ |
@@ -647,7 +647,7 @@ spectrum_cs_attach(void) | |||
647 | ret = pcmcia_register_client(&link->handle, &client_reg); | 647 | ret = pcmcia_register_client(&link->handle, &client_reg); |
648 | if (ret != CS_SUCCESS) { | 648 | if (ret != CS_SUCCESS) { |
649 | cs_error(link->handle, RegisterClient, ret); | 649 | cs_error(link->handle, RegisterClient, ret); |
650 | spectrum_cs_detach(link); | 650 | spectrum_cs_detach(link->handle); |
651 | return NULL; | 651 | return NULL; |
652 | } | 652 | } |
653 | 653 | ||
@@ -660,27 +660,14 @@ spectrum_cs_attach(void) | |||
660 | * are freed. Otherwise, the structures will be freed when the device | 660 | * are freed. Otherwise, the structures will be freed when the device |
661 | * is released. | 661 | * is released. |
662 | */ | 662 | */ |
663 | static void spectrum_cs_detach(dev_link_t *link) | 663 | static void spectrum_cs_detach(struct pcmcia_device *p_dev) |
664 | { | 664 | { |
665 | dev_link_t **linkp; | 665 | dev_link_t *link = dev_to_instance(p_dev); |
666 | struct net_device *dev = link->priv; | 666 | struct net_device *dev = link->priv; |
667 | 667 | ||
668 | /* Locate device structure */ | ||
669 | for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) | ||
670 | if (*linkp == link) | ||
671 | break; | ||
672 | |||
673 | BUG_ON(*linkp == NULL); | ||
674 | |||
675 | if (link->state & DEV_CONFIG) | 668 | if (link->state & DEV_CONFIG) |
676 | spectrum_cs_release(link); | 669 | spectrum_cs_release(link); |
677 | 670 | ||
678 | /* Break the link with Card Services */ | ||
679 | if (link->handle) | ||
680 | pcmcia_deregister_client(link->handle); | ||
681 | |||
682 | /* Unlink device structure, and free it */ | ||
683 | *linkp = link->next; | ||
684 | DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev); | 671 | DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev); |
685 | if (link->dev) { | 672 | if (link->dev) { |
686 | DEBUG(0, PFX "About to unregister net device %p\n", | 673 | DEBUG(0, PFX "About to unregister net device %p\n", |
@@ -1007,22 +994,8 @@ spectrum_cs_event(event_t event, int priority, | |||
1007 | event_callback_args_t * args) | 994 | event_callback_args_t * args) |
1008 | { | 995 | { |
1009 | dev_link_t *link = args->client_data; | 996 | dev_link_t *link = args->client_data; |
1010 | struct net_device *dev = link->priv; | ||
1011 | struct orinoco_private *priv = netdev_priv(dev); | ||
1012 | 997 | ||
1013 | switch (event) { | 998 | switch (event) { |
1014 | case CS_EVENT_CARD_REMOVAL: | ||
1015 | link->state &= ~DEV_PRESENT; | ||
1016 | if (link->state & DEV_CONFIG) { | ||
1017 | unsigned long flags; | ||
1018 | |||
1019 | spin_lock_irqsave(&priv->lock, flags); | ||
1020 | netif_device_detach(dev); | ||
1021 | priv->hw_unavailable++; | ||
1022 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1023 | } | ||
1024 | break; | ||
1025 | |||
1026 | case CS_EVENT_CARD_INSERTION: | 999 | case CS_EVENT_CARD_INSERTION: |
1027 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 1000 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
1028 | spectrum_cs_config(link); | 1001 | spectrum_cs_config(link); |
@@ -1057,7 +1030,7 @@ static struct pcmcia_driver orinoco_driver = { | |||
1057 | .name = DRIVER_NAME, | 1030 | .name = DRIVER_NAME, |
1058 | }, | 1031 | }, |
1059 | .attach = spectrum_cs_attach, | 1032 | .attach = spectrum_cs_attach, |
1060 | .detach = spectrum_cs_detach, | 1033 | .remove = spectrum_cs_detach, |
1061 | .suspend = spectrum_cs_suspend, | 1034 | .suspend = spectrum_cs_suspend, |
1062 | .resume = spectrum_cs_resume, | 1035 | .resume = spectrum_cs_resume, |
1063 | .event = spectrum_cs_event, | 1036 | .event = spectrum_cs_event, |