aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/netwave_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:23:14 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 18:03:10 -0500
commitcc3b4866bee996c922e875b8c8efe9f0d8803aae (patch)
tree6632837b6986f33566f75ed971cecbdc210e3201 /drivers/net/wireless/netwave_cs.c
parent8e9e793d68fcda6cc84c18cedf85ca0f91d801a8 (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/wireless/netwave_cs.c')
-rw-r--r--drivers/net/wireless/netwave_cs.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index 7ab2d70ffddf..1770677d9e10 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -200,7 +200,7 @@ static int netwave_event(event_t event, int priority,
200static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card 200static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card
201 insertion */ 201 insertion */
202static dev_link_t *netwave_attach(void); /* Create instance */ 202static dev_link_t *netwave_attach(void); /* Create instance */
203static void netwave_detach(dev_link_t *); /* Destroy instance */ 203static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */
204 204
205/* Hardware configuration */ 205/* Hardware configuration */
206static void netwave_doreset(kio_addr_t iobase, u_char __iomem *ramBase); 206static void netwave_doreset(kio_addr_t iobase, u_char __iomem *ramBase);
@@ -459,7 +459,7 @@ static dev_link_t *netwave_attach(void)
459 ret = pcmcia_register_client(&link->handle, &client_reg); 459 ret = pcmcia_register_client(&link->handle, &client_reg);
460 if (ret != 0) { 460 if (ret != 0) {
461 cs_error(link->handle, RegisterClient, ret); 461 cs_error(link->handle, RegisterClient, ret);
462 netwave_detach(link); 462 netwave_detach(link->handle);
463 return NULL; 463 return NULL;
464 } 464 }
465 465
@@ -474,8 +474,9 @@ static dev_link_t *netwave_attach(void)
474 * structures are freed. Otherwise, the structures will be freed 474 * structures are freed. Otherwise, the structures will be freed
475 * when the device is released. 475 * when the device is released.
476 */ 476 */
477static void netwave_detach(dev_link_t *link) 477static void netwave_detach(struct pcmcia_device *p_dev)
478{ 478{
479 dev_link_t *link = dev_to_instance(p_dev);
479 struct net_device *dev = link->priv; 480 struct net_device *dev = link->priv;
480 dev_link_t **linkp; 481 dev_link_t **linkp;
481 482
@@ -489,11 +490,7 @@ static void netwave_detach(dev_link_t *link)
489 */ 490 */
490 if (link->state & DEV_CONFIG) 491 if (link->state & DEV_CONFIG)
491 netwave_release(link); 492 netwave_release(link);
492 493
493 /* Break the link with Card Services */
494 if (link->handle)
495 pcmcia_deregister_client(link->handle);
496
497 /* Locate device structure */ 494 /* Locate device structure */
498 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 495 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
499 if (*linkp == link) break; 496 if (*linkp == link) break;
@@ -986,22 +983,10 @@ static int netwave_event(event_t event, int priority,
986 event_callback_args_t *args) 983 event_callback_args_t *args)
987{ 984{
988 dev_link_t *link = args->client_data; 985 dev_link_t *link = args->client_data;
989 struct net_device *dev = link->priv; 986
990
991 DEBUG(1, "netwave_event(0x%06x)\n", event); 987 DEBUG(1, "netwave_event(0x%06x)\n", event);
992
993 switch (event) {
994 case CS_EVENT_REGISTRATION_COMPLETE:
995 DEBUG(0, "netwave_cs: registration complete\n");
996 break;
997 988
998 case CS_EVENT_CARD_REMOVAL: 989 switch (event) {
999 link->state &= ~DEV_PRESENT;
1000 if (link->state & DEV_CONFIG) {
1001 netif_device_detach(dev);
1002 netwave_release(link);
1003 }
1004 break;
1005 case CS_EVENT_CARD_INSERTION: 990 case CS_EVENT_CARD_INSERTION:
1006 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 991 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1007 netwave_pcmcia_config( link); 992 netwave_pcmcia_config( link);
@@ -1504,7 +1489,7 @@ static struct pcmcia_driver netwave_driver = {
1504 }, 1489 },
1505 .attach = netwave_attach, 1490 .attach = netwave_attach,
1506 .event = netwave_event, 1491 .event = netwave_event,
1507 .detach = netwave_detach, 1492 .remove = netwave_detach,
1508 .id_table = netwave_ids, 1493 .id_table = netwave_ids,
1509 .suspend = netwave_suspend, 1494 .suspend = netwave_suspend,
1510 .resume = netwave_resume, 1495 .resume = netwave_resume,