[PATCH] kill flush_stale_links
Christoph Hellwig
hch at lst.de
Mon Aug 25 16:25:04 BST 2003
following Dave's guide it's replaced by calling foo_detach in
foo_release if the links is stale. Note that I killed DEV_STALE_LINK
aswell as DEV_STALE_CONFIG isn't ever cleared so we don't need two
flags.
Also some dead codepathes related to DEV_STALE_* are killed.
--- 1.22/drivers/net/pcmcia/3c574_cs.c Wed Aug 20 05:55:09 2003
+++ edited/drivers/net/pcmcia/3c574_cs.c Mon Aug 25 13:29:12 2003
@@ -262,16 +262,6 @@
static dev_link_t *dev_list;
-static void flush_stale_links(void)
-{
- dev_link_t *link, *next;
- for (link = dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK)
- tc574_detach(link);
- }
-}
-
/*
tc574_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
@@ -287,7 +277,6 @@
int i, ret;
DEBUG(0, "3c574_attach()\n");
- flush_stale_links();
/* Create the PC card device object. */
dev = alloc_etherdev(sizeof(struct el3_private));
@@ -373,10 +362,8 @@
if (link->state & DEV_CONFIG) {
tc574_release(link);
- if (link->state & DEV_STALE_CONFIG) {
- link->state |= DEV_STALE_LINK;
+ if (link->state & DEV_STALE_CONFIG)
return;
- }
}
if (link->handle)
@@ -581,7 +568,9 @@
link->state &= ~DEV_CONFIG;
-} /* tc574_release */
+ if (link->state & DEV_STALE_CONFIG)
+ tc574_detach(link);
+}
/*
The card status event handler. Mostly, this schedules other
===== drivers/net/pcmcia/3c589_cs.c 1.21 vs edited =====
--- 1.21/drivers/net/pcmcia/3c589_cs.c Wed Aug 20 05:55:09 2003
+++ edited/drivers/net/pcmcia/3c589_cs.c Mon Aug 25 13:43:49 2003
@@ -176,24 +176,6 @@
/*======================================================================
- This bit of code is used to avoid unregistering network devices
- at inappropriate times. 2.2 and later kernels are fairly picky
- about when this can happen.
-
-======================================================================*/
-
-static void flush_stale_links(void)
-{
- dev_link_t *link, *next;
- for (link = dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK)
- tc589_detach(link);
- }
-}
-
-/*======================================================================
-
tc589_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
@@ -209,7 +191,6 @@
int i, ret;
DEBUG(0, "3c589_attach()\n");
- flush_stale_links();
/* Create new ethernet device */
dev = alloc_etherdev(sizeof(struct el3_private));
@@ -297,10 +278,8 @@
if (link->state & DEV_CONFIG) {
tc589_release(link);
- if (link->state & DEV_STALE_CONFIG) {
- link->state |= DEV_STALE_LINK;
+ if (link->state & DEV_STALE_CONFIG)
return;
- }
}
if (link->handle)
@@ -466,8 +445,10 @@
CardServices(ReleaseIRQ, link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
-
-} /* tc589_release */
+
+ if (link->state & DEV_STALE_CONFIG)
+ tc589_detach(link);
+}
/*======================================================================
===== drivers/net/pcmcia/axnet_cs.c 1.16 vs edited =====
--- 1.16/drivers/net/pcmcia/axnet_cs.c Wed Aug 20 05:55:09 2003
+++ edited/drivers/net/pcmcia/axnet_cs.c Mon Aug 25 13:28:50 2003
@@ -141,24 +141,6 @@
/*======================================================================
- This bit of code is used to avoid unregistering network devices
- at inappropriate times. 2.2 and later kernels are fairly picky
- about when this can happen.
-
-======================================================================*/
-
-static void flush_stale_links(void)
-{
- dev_link_t *link, *next;
- for (link = dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK)
- axnet_detach(link);
- }
-}
-
-/*======================================================================
-
We never need to do anything when a axnet device is "initialized"
by the net software, because we only register already-found cards.
@@ -186,7 +168,6 @@
int i, ret;
DEBUG(0, "axnet_attach()\n");
- flush_stale_links();
/* Create new ethernet device */
info = kmalloc(sizeof(*info), GFP_KERNEL);
@@ -256,10 +237,8 @@
if (link->state & DEV_CONFIG) {
axnet_release(link);
- if (link->state & DEV_STALE_CONFIG) {
- link->state |= DEV_STALE_LINK;
+ if (link->state & DEV_STALE_CONFIG)
return;
- }
}
if (link->handle)
@@ -545,7 +524,9 @@
link->state &= ~DEV_CONFIG;
-} /* axnet_release */
+ if (link->state & DEV_STALE_CONFIG)
+ axnet_detach(link);
+}
/*======================================================================
===== drivers/net/pcmcia/com20020_cs.c 1.11 vs edited =====
--- 1.11/drivers/net/pcmcia/com20020_cs.c Wed Aug 20 05:55:09 2003
+++ edited/drivers/net/pcmcia/com20020_cs.c Mon Aug 25 13:28:28 2003
@@ -147,24 +147,6 @@
/*======================================================================
- This bit of code is used to avoid unregistering network devices
- at inappropriate times. 2.2 and later kernels are fairly picky
- about when this can happen.
-
-======================================================================*/
-
-static void flush_stale_links(void)
-{
- dev_link_t *link, *next;
- for (link = dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK)
- com20020_detach(link);
- }
-}
-
-/*======================================================================
-
com20020_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
@@ -181,7 +163,6 @@
struct arcnet_local *lp;
DEBUG(0, "com20020_attach()\n");
- flush_stale_links();
/* Create new network device */
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
@@ -290,10 +271,8 @@
if (link->state & DEV_CONFIG) {
com20020_release(link);
- if (link->state & DEV_STALE_CONFIG) {
- link->state |= DEV_STALE_LINK;
+ if (link->state & DEV_STALE_CONFIG)
return;
- }
}
if (link->handle)
@@ -484,7 +463,9 @@
link->state &= ~(DEV_CONFIG | DEV_RELEASE_PENDING);
-} /* com20020_release */
+ if (link->state & DEV_STALE_CONFIG)
+ com20020_detach(link);
+}
/*======================================================================
===== drivers/net/pcmcia/fmvj18x_cs.c 1.24 vs edited =====
--- 1.24/drivers/net/pcmcia/fmvj18x_cs.c Wed Aug 20 05:55:09 2003
+++ edited/drivers/net/pcmcia/fmvj18x_cs.c Mon Aug 25 13:28:07 2003
@@ -242,24 +242,6 @@
#define BANK_1U 0x24 /* bank 1 (CONFIG_1) */
#define BANK_2U 0x28 /* bank 2 (CONFIG_1) */
-/*======================================================================
-
- This bit of code is used to avoid unregistering network devices
- at inappropriate times. 2.2 and later kernels are fairly picky
- about when this can happen.
-
-======================================================================*/
-
-static void flush_stale_links(void)
-{
- dev_link_t *link, *next;
- for (link = dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK)
- fmvj18x_detach(link);
- }
-}
-
static dev_link_t *fmvj18x_attach(void)
{
local_info_t *lp;
@@ -269,7 +251,6 @@
int i, ret;
DEBUG(0, "fmvj18x_attach()\n");
- flush_stale_links();
/* Make up a FMVJ18x specific data structure */
dev = alloc_etherdev(sizeof(local_info_t));
@@ -353,10 +334,8 @@
if (link->state & DEV_CONFIG) {
fmvj18x_release(link);
- if (link->state & DEV_STALE_CONFIG) {
- link->state |= DEV_STALE_LINK;
+ if (link->state & DEV_STALE_CONFIG)
return;
- }
}
/* Break the link with Card Services */
@@ -762,8 +741,10 @@
CardServices(ReleaseIRQ, link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
-
-} /* fmvj18x_release */
+
+ if (link->state & DEV_STALE_CONFIG)
+ fmvj18x_detach(link);
+}
/*====================================================================*/
===== drivers/net/pcmcia/ibmtr_cs.c 1.17 vs edited =====
--- 1.17/drivers/net/pcmcia/ibmtr_cs.c Wed Aug 20 05:55:09 2003
+++ edited/drivers/net/pcmcia/ibmtr_cs.c Mon Aug 25 13:26:57 2003
@@ -139,24 +139,6 @@
struct tok_info ti;
} ibmtr_dev_t;
-/*======================================================================
-
- This bit of code is used to avoid unregistering network devices
- at inappropriate times. 2.2 and later kernels are fairly picky
- about when this can happen.
-
-======================================================================*/
-
-static void flush_stale_links(void)
-{
- dev_link_t *link, *next;
- for (link = dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK)
- ibmtr_detach(link);
- }
-}
-
static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
{
u32 ethcmd;
@@ -205,7 +187,6 @@
int i, ret;
DEBUG(0, "ibmtr_attach()\n");
- flush_stale_links();
/* Create new token-ring device */
dev = alloc_trdev(sizeof(*info));
@@ -294,10 +275,8 @@
}
if (link->state & DEV_CONFIG) {
ibmtr_release(link);
- if (link->state & DEV_STALE_CONFIG) {
- link->state |= DEV_STALE_LINK;
+ if (link->state & DEV_STALE_CONFIG)
return;
- }
}
if (link->handle)
@@ -467,7 +446,9 @@
link->state &= ~DEV_CONFIG;
-} /* ibmtr_release */
+ if (link->state & DEV_STALE_CONFIG)
+ ibmtr_detach(link);
+}
/*======================================================================
===== drivers/net/pcmcia/nmclan_cs.c 1.19 vs edited =====
--- 1.19/drivers/net/pcmcia/nmclan_cs.c Wed Aug 20 05:55:09 2003
+++ edited/drivers/net/pcmcia/nmclan_cs.c Mon Aug 25 13:27:46 2003
@@ -448,21 +448,6 @@
static void nmclan_detach(dev_link_t *);
/* ----------------------------------------------------------------------------
-flush_stale_links
- Clean up stale device structures
----------------------------------------------------------------------------- */
-
-static void flush_stale_links(void)
-{
- dev_link_t *link, *next;
- for (link = dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK)
- nmclan_detach(link);
- }
-}
-
-/* ----------------------------------------------------------------------------
nmclan_attach
Creates an "instance" of the driver, allocating local data
structures for one device. The device is registered with Card
@@ -479,7 +464,6 @@
DEBUG(0, "nmclan_attach()\n");
DEBUG(1, "%s\n", rcsid);
- flush_stale_links();
/* Create new ethernet device */
dev = alloc_etherdev(sizeof(mace_private));
@@ -568,10 +552,8 @@
if (link->state & DEV_CONFIG) {
nmclan_release(link);
- if (link->state & DEV_STALE_CONFIG) {
- link->state |= DEV_STALE_LINK;
+ if (link->state & DEV_STALE_CONFIG)
return;
- }
}
if (link->handle)
@@ -842,7 +824,9 @@
link->state &= ~DEV_CONFIG;
-} /* nmclan_release */
+ if (link->state & DEV_STALE_CONFIG)
+ nmclan_detach(link);
+}
/* ----------------------------------------------------------------------------
nmclan_event
===== drivers/net/pcmcia/pcnet_cs.c 1.22 vs edited =====
--- 1.22/drivers/net/pcmcia/pcnet_cs.c Wed Aug 20 05:55:09 2003
+++ edited/drivers/net/pcmcia/pcnet_cs.c Mon Aug 25 13:25:55 2003
@@ -239,24 +239,6 @@
/*======================================================================
- This bit of code is used to avoid unregistering network devices
- at inappropriate times. 2.2 and later kernels are fairly picky
- about when this can happen.
-
-======================================================================*/
-
-static void flush_stale_links(void)
-{
- dev_link_t *link, *next;
- for (link = dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK)
- pcnet_detach(link);
- }
-}
-
-/*======================================================================
-
We never need to do anything when a pcnet device is "initialized"
by the net software, because we only register already-found cards.
@@ -284,7 +266,6 @@
int i, ret;
DEBUG(0, "pcnet_attach()\n");
- flush_stale_links();
/* Create new ethernet device */
info = kmalloc(sizeof(*info), GFP_KERNEL);
@@ -356,10 +337,8 @@
if (link->state & DEV_CONFIG) {
pcnet_release(link);
- if (link->state & DEV_STALE_CONFIG) {
- link->state |= DEV_STALE_LINK;
+ if (link->state & DEV_STALE_CONFIG)
return;
- }
}
if (link->handle)
@@ -821,7 +800,9 @@
link->state &= ~DEV_CONFIG;
-} /* pcnet_release */
+ if (link->state & DEV_STALE_CONFIG)
+ pcnet_detach(link);
+}
/*======================================================================
===== drivers/net/pcmcia/smc91c92_cs.c 1.23 vs edited =====
--- 1.23/drivers/net/pcmcia/smc91c92_cs.c Wed Aug 20 05:55:09 2003
+++ edited/drivers/net/pcmcia/smc91c92_cs.c Mon Aug 25 13:27:23 2003
@@ -307,24 +307,6 @@
/*======================================================================
- This bit of code is used to avoid unregistering network devices
- at inappropriate times. 2.2 and later kernels are fairly picky
- about when this can happen.
-
-======================================================================*/
-
-static void flush_stale_links(void)
-{
- dev_link_t *link, *next;
- for (link = dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK)
- smc91c92_detach(link);
- }
-}
-
-/*======================================================================
-
smc91c92_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
@@ -340,7 +322,6 @@
int i, ret;
DEBUG(0, "smc91c92_attach()\n");
- flush_stale_links();
/* Create new ethernet device */
dev = alloc_etherdev(sizeof(struct smc_private));
@@ -432,10 +413,8 @@
if (link->state & DEV_CONFIG) {
smc91c92_release(link);
- if (link->state & DEV_STALE_CONFIG) {
- link->state |= DEV_STALE_LINK;
+ if (link->state & DEV_STALE_CONFIG)
return;
- }
}
if (link->handle)
@@ -1103,7 +1082,9 @@
link->state &= ~DEV_CONFIG;
-} /* smc91c92_release */
+ if (link->state & DEV_STALE_CONFIG)
+ smc91c92_detach(link);
+}
/*======================================================================
===== drivers/net/pcmcia/xirc2ps_cs.c 1.25 vs edited =====
--- 1.25/drivers/net/pcmcia/xirc2ps_cs.c Wed Aug 20 05:55:09 2003
+++ edited/drivers/net/pcmcia/xirc2ps_cs.c Mon Aug 25 12:59:48 2003
@@ -389,17 +389,6 @@
static int do_stop(struct net_device *dev);
/*=============== Helper functions =========================*/
-static void
-flush_stale_links(void)
-{
- dev_link_t *link, *next;
- for (link = dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK)
- xirc2ps_detach(link);
- }
-}
-
static int
get_tuple_data(int fn, client_handle_t handle, tuple_t *tuple)
{
@@ -601,7 +590,6 @@
int err;
DEBUG(0, "attach()\n");
- flush_stale_links();
/* Allocate the device structure */
dev = alloc_etherdev(sizeof(local_info_t));
@@ -685,13 +673,8 @@
* the release() function is called, that will trigger a proper
* detach().
*/
- if (link->state & DEV_CONFIG) {
+ if (link->state & DEV_CONFIG)
xirc2ps_release(link);
- if (link->state & DEV_STALE_CONFIG) {
- link->state |= DEV_STALE_LINK;
- return;
- }
- }
/* Break the link with Card Services */
if (link->handle)
@@ -1181,19 +1164,6 @@
DEBUG(0, "release(0x%p)\n", link);
-#if 0
- /*
- * If the device is currently in use, we won't release until it
- * is actually closed.
- */
- if (link->open) {
- DEBUG(0, "release postponed, '%s' "
- "still open\n", link->dev->dev_name);
- link->state |= DEV_STALE_CONFIG;
- return;
- }
-#endif
-
if (link->win) {
struct net_device *dev = link->priv;
local_info_t *local = dev->priv;
@@ -2040,9 +2010,6 @@
SelectPage(0);
link->open--;
- if (link->state & DEV_STALE_CONFIG)
- xirc2ps_release(link);
-
return 0;
}
===== drivers/net/wireless/airo_cs.c 1.9 vs edited =====
--- 1.9/drivers/net/wireless/airo_cs.c Thu Aug 7 18:17:56 2003
+++ edited/drivers/net/wireless/airo_cs.c Mon Aug 25 13:30:10 2003
@@ -163,24 +163,6 @@
/*======================================================================
- This bit of code is used to avoid unregistering network devices
- at inappropriate times. 2.2 and later kernels are fairly picky
- about when this can happen.
-
- ======================================================================*/
-
-static void flush_stale_links(void)
-{
- dev_link_t *link, *next;
- for (link = dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK)
- airo_detach(link);
- }
-}
-
-/*======================================================================
-
airo_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
@@ -199,8 +181,7 @@
int ret, i;
DEBUG(0, "airo_attach()\n");
- flush_stale_links();
-
+
/* Initialize the dev_link_t structure */
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
if (!link) {
@@ -285,10 +266,8 @@
if (link->state & DEV_CONFIG) {
airo_release(link);
- if (link->state & DEV_STALE_CONFIG) {
- link->state |= DEV_STALE_LINK;
+ if (link->state & DEV_STALE_CONFIG)
return;
- }
}
if ( ((local_info_t*)link->priv)->eth_dev ) {
@@ -554,8 +533,10 @@
if (link->irq.AssignedIRQ)
CardServices(ReleaseIRQ, link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
-
-} /* airo_release */
+
+ if (link->state & DEV_STALE_CONFIG)
+ airo_detach(link);
+}
/*======================================================================
===== drivers/net/wireless/atmel_cs.c 1.5 vs edited =====
--- 1.5/drivers/net/wireless/atmel_cs.c Tue Aug 19 06:03:49 2003
+++ edited/drivers/net/wireless/atmel_cs.c Mon Aug 25 12:47:49 2003
@@ -176,24 +176,6 @@
/*======================================================================
- This bit of code is used to avoid unregistering network devices
- at inappropriate times. 2.2 and later kernels are fairly picky
- about when this can happen.
-
- ======================================================================*/
-
-static void flush_stale_links(void)
-{
- dev_link_t *link, *next;
- for (link = dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK)
- atmel_detach(link);
- }
-}
-
-/*======================================================================
-
atmel_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
with Card Services.
@@ -212,8 +194,7 @@
int ret, i;
DEBUG(0, "atmel_attach()\n");
- flush_stale_links();
-
+
/* Initialize the dev_link_t structure */
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
if (!link) {
@@ -296,29 +277,19 @@
if (*linkp == NULL)
return;
- if ( link->state & DEV_CONFIG ) {
+ if (link->state & DEV_CONFIG)
atmel_release(link);
- if ( link->state & DEV_STALE_CONFIG ) {
- link->state |= DEV_STALE_LINK;
- return;
- }
- }
-
/* Break the link with Card Services */
if (link->handle)
CardServices(DeregisterClient, link->handle);
-
-
-
+
/* Unlink device structure, free pieces */
*linkp = link->next;
- if (link->priv) {
+ if (link->priv)
kfree(link->priv);
- }
kfree(link);
-
-} /* atmel_detach */
+}
/*======================================================================
===== drivers/net/wireless/netwave_cs.c 1.21 vs edited =====
--- 1.21/drivers/net/wireless/netwave_cs.c Wed Aug 20 05:53:17 2003
+++ edited/drivers/net/wireless/netwave_cs.c Mon Aug 25 13:33:00 2003
@@ -211,7 +211,6 @@
insertion */
static dev_link_t *netwave_attach(void); /* Create instance */
static void netwave_detach(dev_link_t *); /* Destroy instance */
-static void netwave_flush_stale_links(void); /* Destroy all staled instances */
/* Hardware configuration */
static void netwave_doreset(ioaddr_t iobase, u_char* ramBase);
@@ -444,9 +443,6 @@
DEBUG(0, "netwave_attach()\n");
- /* Perform some cleanup */
- netwave_flush_stale_links();
-
/* Initialize the dev_link_t structure */
dev = alloc_etherdev(sizeof(netwave_private));
if (!dev)
@@ -553,7 +549,6 @@
if (link->state & DEV_STALE_CONFIG) {
DEBUG(1, "netwave_cs: detach postponed, '%s' still "
"locked\n", link->dev->dev_name);
- link->state |= DEV_STALE_LINK;
return;
}
}
@@ -581,31 +576,6 @@
} /* netwave_detach */
/*
- * Function netwave_flush_stale_links (void)
- *
- * This deletes all driver "instances" that need to be deleted.
- * Sometimes, netwave_detach can't be performed following a call from
- * cardmgr (device still open) and the device is put in a STALE_LINK
- * state.
- * This function is in charge of making the cleanup...
- */
-static void netwave_flush_stale_links(void)
-{
- dev_link_t * link; /* Current node in linked list */
- dev_link_t * next; /* Next node in linked list */
-
- DEBUG(1, "netwave_flush_stale_links(0x%p)\n", dev_list);
-
- /* Go through the list */
- for (link = dev_list; link; link = next) {
- next = link->next;
- /* Check if in need of being removed */
- if(link->state & DEV_STALE_LINK)
- netwave_detach(link);
- }
-} /* netwave_flush_stale_links */
-
-/*
* Wireless Handler : get protocol name
*/
static int netwave_get_name(struct net_device *dev,
@@ -1181,9 +1151,11 @@
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
- link->state &= ~(DEV_CONFIG | DEV_STALE_CONFIG);
+ link->state &= ~DEV_CONFIG;
-} /* netwave_release */
+ if (link->state & DEV_STALE_CONFIG)
+ netwave_detach(link);
+}
/*
* Function netwave_event (event, priority, args)
@@ -1755,8 +1727,6 @@
{
pcmcia_unregister_driver(&netwave_driver);
- /* Do some cleanup of the device list */
- netwave_flush_stale_links();
if (dev_list != NULL) /* Critical situation */
printk("netwave_cs: devices remaining when removing module\n");
}
===== drivers/net/wireless/orinoco_cs.c 1.24 vs edited =====
--- 1.24/drivers/net/wireless/orinoco_cs.c Wed Aug 20 05:53:17 2003
+++ edited/drivers/net/wireless/orinoco_cs.c Mon Aug 25 12:47:04 2003
@@ -153,24 +153,6 @@
CardServices(ReportError, handle, &err);
}
-
-/* Remove zombie instances (card removed, detach pending) */
-static void
-flush_stale_links(void)
-{
- dev_link_t *link, *next;
-
- TRACE_ENTER("");
-
- for (link = dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK) {
- orinoco_cs_detach(link);
- }
- }
- TRACE_EXIT("");
-}
-
/*
* This creates an "instance" of the driver, allocating local data
* structures for one device. The device is registered with Card
@@ -189,9 +171,6 @@
client_reg_t client_reg;
int ret, i;
- /* A bit of cleanup */
- flush_stale_links();
-
dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset);
if (! dev)
return NULL;
@@ -266,13 +245,8 @@
return;
}
- if (link->state & DEV_CONFIG) {
+ if (link->state & DEV_CONFIG)
orinoco_cs_release(link);
- if (link->state & DEV_CONFIG) {
- link->state |= DEV_STALE_LINK;
- return;
- }
- }
/* Break the link with Card Services */
if (link->handle)
===== drivers/net/wireless/ray_cs.c 1.20 vs edited =====
--- 1.20/drivers/net/wireless/ray_cs.c Thu Aug 7 18:17:57 2003
+++ edited/drivers/net/wireless/ray_cs.c Mon Aug 25 13:31:46 2003
@@ -316,24 +316,6 @@
static char rcsid[] = "Raylink/WebGear wireless LAN - Corey <Thomas corey at world.std.com>";
-/*======================================================================
-
- This bit of code is used to avoid unregistering network devices
- at inappropriate times. 2.2 and later kernels are fairly picky
- about when this can happen.
-
-======================================================================*/
-
-static void flush_stale_links(void)
-{
- dev_link_t *link, *next;
- for (link = dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK)
- ray_detach(link);
- }
-}
-
/*=============================================================================
ray_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered
@@ -351,7 +333,6 @@
struct net_device *dev;
DEBUG(1, "ray_attach()\n");
- flush_stale_links();
/* Initialize the dev_link_t structure */
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
@@ -480,10 +461,8 @@
*/
if (link->state & DEV_CONFIG) {
ray_release(link);
- if(link->state & DEV_STALE_CONFIG) {
- link->state |= DEV_STALE_LINK;
+ if(link->state & DEV_STALE_CONFIG)
return;
- }
}
/* Break the link with Card Services */
@@ -928,7 +907,11 @@
if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseIRQ ret = %x\n",i);
DEBUG(2,"ray_release ending\n");
-} /* ray_release */
+
+ if (link->state & DEV_STALE_CONFIG)
+ ray_detach(link);
+}
+
/*=============================================================================
The card status event handler. Mostly, this schedules other
stuff to run after an event is received. A CARD_REMOVAL event
===== drivers/net/wireless/wavelan_cs.c 1.25 vs edited =====
--- 1.25/drivers/net/wireless/wavelan_cs.c Thu Aug 7 18:17:57 2003
+++ edited/drivers/net/wireless/wavelan_cs.c Mon Aug 25 13:32:03 2003
@@ -4175,50 +4175,14 @@
CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq);
- link->state &= ~(DEV_CONFIG | DEV_STALE_CONFIG);
+ link->state &= ~DEV_CONFIG;
#ifdef DEBUG_CONFIG_TRACE
printk(KERN_DEBUG "%s: <- wv_pcmcia_release()\n", dev->name);
#endif
-} /* wv_pcmcia_release */
-/*------------------------------------------------------------------*/
-/*
- * Sometimes, wavelan_detach can't be performed following a call from
- * cardmgr (device still open, pcmcia_release not done) and the device
- * is put in a STALE_LINK state and remains in memory.
- *
- * This function run through our current list of device and attempt
- * another time to remove them. We hope that since last time the
- * device has properly been closed.
- *
- * (called by wavelan_attach() & cleanup_module())
- */
-static void
-wv_flush_stale_links(void)
-{
- dev_link_t * link; /* Current node in linked list */
- dev_link_t * next; /* Next node in linked list */
-
-#ifdef DEBUG_CONFIG_TRACE
- printk(KERN_DEBUG "-> wv_flush_stale_links(0x%p)\n", dev_list);
-#endif
-
- /* Go through the list */
- for (link = dev_list; link; link = next)
- {
- next = link->next;
-
- /* Check if in need of being removed */
- if((link->state & DEV_STALE_LINK) ||
- (! (link->state & DEV_PRESENT)))
- wavelan_detach(link);
-
- }
-
-#ifdef DEBUG_CONFIG_TRACE
- printk(KERN_DEBUG "<- wv_flush_stale_links()\n");
-#endif
+ if (link->state & DEV_STALE_CONFIG)
+ wavelan_detach(link);
}
/************************ INTERRUPT HANDLING ************************/
@@ -4705,9 +4669,6 @@
printk(KERN_DEBUG "-> wavelan_attach()\n");
#endif
- /* Perform some cleanup */
- wv_flush_stale_links();
-
/* Initialize the dev_link_t structure */
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
if (!link) return NULL;
@@ -4859,7 +4820,6 @@
printk(KERN_DEBUG "wavelan_detach: detach postponed,"
" '%s' still locked\n", link->dev->dev_name);
#endif
- link->state |= DEV_STALE_LINK;
return;
}
}
@@ -5039,9 +4999,6 @@
static void __exit
exit_wavelan_cs(void)
{
- /* Do some cleanup of the device list */
- wv_flush_stale_links();
-
pcmcia_unregister_driver(&wavelan_driver);
}
===== drivers/net/wireless/wavelan_cs.p.h 1.9 vs edited =====
--- 1.9/drivers/net/wireless/wavelan_cs.p.h Thu Aug 7 18:17:57 2003
+++ edited/drivers/net/wireless/wavelan_cs.p.h Mon Aug 25 12:56:44 2003
@@ -761,8 +761,7 @@
static inline int
wv_pcmcia_config(dev_link_t *); /* Configure the pcmcia interface */
static void
- wv_pcmcia_release(dev_link_t *),/* Remove a device */
- wv_flush_stale_links(void); /* "detach" all possible devices */
+ wv_pcmcia_release(dev_link_t *);/* Remove a device */
/* ---------------------- INTERRUPT HANDLING ---------------------- */
static irqreturn_t
wavelan_interrupt(int, /* Interrupt handler */
===== drivers/net/wireless/wl3501_cs.c 1.70 vs edited =====
--- 1.70/drivers/net/wireless/wl3501_cs.c Tue Aug 19 16:24:34 2003
+++ edited/drivers/net/wireless/wl3501_cs.c Mon Aug 25 13:30:55 2003
@@ -1571,7 +1571,6 @@
printk(KERN_DEBUG "wl3501_cs: detach postponed, '%s' "
"still locked\n", link->dev->dev_name);
#endif
- link->state |= DEV_STALE_LINK;
goto out;
}
@@ -1589,22 +1588,6 @@
return;
}
-/**
- * wl3501_flush_stale_links - Remove zombie instances
- *
- * Remove zombie instances (card removed, detach pending)
- */
-static void wl3501_flush_stale_links(void)
-{
- dev_link_t *link, *next;
-
- for (link = wl3501_dev_list; link; link = next) {
- next = link->next;
- if (link->state & DEV_STALE_LINK)
- wl3501_detach(link);
- }
-}
-
static int wl3501_get_name(struct net_device *dev, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -2033,8 +2016,6 @@
struct net_device *dev;
int ret, i;
- wl3501_flush_stale_links();
-
/* Initialize the dev_link_t structure */
link = kmalloc(sizeof(*link), GFP_KERNEL);
if (!link)
@@ -2263,7 +2244,7 @@
CardServices(ReleaseIRQ, link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
- if (link->state & DEV_STALE_LINK)
+ if (link->state & DEV_STALE_CONFIG)
wl3501_detach(link);
out:
return;
More information about the linux-pcmcia
mailing list