aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/pcnet_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/pcnet_cs.c')
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c48
1 files changed, 20 insertions, 28 deletions
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 7db4d6f3db45..fb3e411d6daf 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -121,7 +121,7 @@ static int setup_dma_config(dev_link_t *link, int start_pg,
121 int stop_pg); 121 int stop_pg);
122 122
123static dev_link_t *pcnet_attach(void); 123static dev_link_t *pcnet_attach(void);
124static void pcnet_detach(dev_link_t *); 124static void pcnet_detach(struct pcmcia_device *p_dev);
125 125
126static dev_info_t dev_info = "pcnet_cs"; 126static dev_info_t dev_info = "pcnet_cs";
127static dev_link_t *dev_list; 127static dev_link_t *dev_list;
@@ -280,7 +280,7 @@ static dev_link_t *pcnet_attach(void)
280 ret = pcmcia_register_client(&link->handle, &client_reg); 280 ret = pcmcia_register_client(&link->handle, &client_reg);
281 if (ret != CS_SUCCESS) { 281 if (ret != CS_SUCCESS) {
282 cs_error(link->handle, RegisterClient, ret); 282 cs_error(link->handle, RegisterClient, ret);
283 pcnet_detach(link); 283 pcnet_detach(link->handle);
284 return NULL; 284 return NULL;
285 } 285 }
286 286
@@ -296,31 +296,29 @@ static dev_link_t *pcnet_attach(void)
296 296
297======================================================================*/ 297======================================================================*/
298 298
299static void pcnet_detach(dev_link_t *link) 299static void pcnet_detach(struct pcmcia_device *p_dev)
300{ 300{
301 struct net_device *dev = link->priv; 301 dev_link_t *link = dev_to_instance(p_dev);
302 dev_link_t **linkp; 302 struct net_device *dev = link->priv;
303 303 dev_link_t **linkp;
304 DEBUG(0, "pcnet_detach(0x%p)\n", link);
305 304
306 /* Locate device structure */ 305 DEBUG(0, "pcnet_detach(0x%p)\n", link);
307 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
308 if (*linkp == link) break;
309 if (*linkp == NULL)
310 return;
311 306
312 if (link->dev) 307 /* Locate device structure */
313 unregister_netdev(dev); 308 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
309 if (*linkp == link) break;
310 if (*linkp == NULL)
311 return;
314 312
315 if (link->state & DEV_CONFIG) 313 if (link->dev)
316 pcnet_release(link); 314 unregister_netdev(dev);
317 315
318 if (link->handle) 316 if (link->state & DEV_CONFIG)
319 pcmcia_deregister_client(link->handle); 317 pcnet_release(link);
320 318
321 /* Unlink device structure, free bits */ 319 /* Unlink device structure, free bits */
322 *linkp = link->next; 320 *linkp = link->next;
323 free_netdev(dev); 321 free_netdev(dev);
324} /* pcnet_detach */ 322} /* pcnet_detach */
325 323
326/*====================================================================== 324/*======================================================================
@@ -817,16 +815,10 @@ static int pcnet_event(event_t event, int priority,
817 event_callback_args_t *args) 815 event_callback_args_t *args)
818{ 816{
819 dev_link_t *link = args->client_data; 817 dev_link_t *link = args->client_data;
820 struct net_device *dev = link->priv;
821 818
822 DEBUG(2, "pcnet_event(0x%06x)\n", event); 819 DEBUG(2, "pcnet_event(0x%06x)\n", event);
823 820
824 switch (event) { 821 switch (event) {
825 case CS_EVENT_CARD_REMOVAL:
826 link->state &= ~DEV_PRESENT;
827 if (link->state & DEV_CONFIG)
828 netif_device_detach(dev);
829 break;
830 case CS_EVENT_CARD_INSERTION: 822 case CS_EVENT_CARD_INSERTION:
831 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 823 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
832 pcnet_config(link); 824 pcnet_config(link);
@@ -1856,7 +1848,7 @@ static struct pcmcia_driver pcnet_driver = {
1856 }, 1848 },
1857 .attach = pcnet_attach, 1849 .attach = pcnet_attach,
1858 .event = pcnet_event, 1850 .event = pcnet_event,
1859 .detach = pcnet_detach, 1851 .remove = pcnet_detach,
1860 .owner = THIS_MODULE, 1852 .owner = THIS_MODULE,
1861 .id_table = pcnet_ids, 1853 .id_table = pcnet_ids,
1862 .suspend = pcnet_suspend, 1854 .suspend = pcnet_suspend,