Commit 9d66b5e4 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Russell King

[PCMCIA] kill flush_stale_links

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.
parent 6dbb44ac
......@@ -263,16 +263,6 @@ static void tc574_detach(dev_link_t *);
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
......@@ -288,7 +278,6 @@ static dev_link_t *tc574_attach(void)
int i, ret;
DEBUG(0, "3c574_attach()\n");
flush_stale_links();
/* Create the PC card device object. */
dev = alloc_etherdev(sizeof(struct el3_private));
......@@ -375,11 +364,9 @@ static void tc574_detach(dev_link_t *link)
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)
CardServices(DeregisterClient, link->handle);
......@@ -583,7 +570,9 @@ static void tc574_release(dev_link_t *link)
link->state &= ~DEV_CONFIG;
} /* tc574_release */
if (link->state & DEV_STALE_CONFIG)
tc574_detach(link);
}
/*
The card status event handler. Mostly, this schedules other
......
......@@ -174,24 +174,6 @@ static void tc589_detach(dev_link_t *);
static dev_link_t *dev_list;
/*======================================================================
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
......@@ -209,7 +191,6 @@ static dev_link_t *tc589_attach(void)
int i, ret;
DEBUG(0, "3c589_attach()\n");
flush_stale_links();
/* Create new ethernet device */
dev = alloc_etherdev(sizeof(struct el3_private));
......@@ -297,11 +278,9 @@ static void tc589_detach(dev_link_t *link)
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)
CardServices(DeregisterClient, link->handle);
......@@ -467,7 +446,9 @@ static void tc589_release(dev_link_t *link)
link->state &= ~DEV_CONFIG;
} /* tc589_release */
if (link->state & DEV_STALE_CONFIG)
tc589_detach(link);
}
/*======================================================================
......
......@@ -140,24 +140,6 @@ typedef struct axnet_dev_t {
int flags;
} axnet_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)
axnet_detach(link);
}
}
/*======================================================================
We never need to do anything when a axnet device is "initialized"
......@@ -187,7 +169,6 @@ static dev_link_t *axnet_attach(void)
int i, ret;
DEBUG(0, "axnet_attach()\n");
flush_stale_links();
/* Create new ethernet device */
info = kmalloc(sizeof(*info), GFP_KERNEL);
......@@ -258,11 +239,9 @@ static void axnet_detach(dev_link_t *link)
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)
CardServices(DeregisterClient, link->handle);
......@@ -547,7 +526,9 @@ static void axnet_release(dev_link_t *link)
link->state &= ~DEV_CONFIG;
} /* axnet_release */
if (link->state & DEV_STALE_CONFIG)
axnet_detach(link);
}
/*======================================================================
......
......@@ -145,24 +145,6 @@ typedef struct com20020_dev_t {
dev_node_t node;
} com20020_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)
com20020_detach(link);
}
}
/*======================================================================
com20020_attach() creates an "instance" of the driver, allocating
......@@ -181,7 +163,6 @@ static dev_link_t *com20020_attach(void)
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,11 +271,9 @@ static void com20020_detach(dev_link_t *link)
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)
CardServices(DeregisterClient, link->handle);
......@@ -484,7 +463,9 @@ static void com20020_release(dev_link_t *link)
link->state &= ~(DEV_CONFIG | DEV_RELEASE_PENDING);
} /* com20020_release */
if (link->state & DEV_STALE_CONFIG)
com20020_detach(link);
}
/*======================================================================
......
......@@ -242,24 +242,6 @@ typedef struct local_info_t {
#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 @@ static dev_link_t *fmvj18x_attach(void)
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,11 +334,9 @@ static void fmvj18x_detach(dev_link_t *link)
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 */
if (link->handle)
......@@ -763,7 +742,9 @@ static void fmvj18x_release(dev_link_t *link)
link->state &= ~DEV_CONFIG;
} /* fmvj18x_release */
if (link->state & DEV_STALE_CONFIG)
fmvj18x_detach(link);
}
/*====================================================================*/
......
......@@ -139,24 +139,6 @@ typedef struct ibmtr_dev_t {
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 void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
......@@ -184,7 +166,6 @@ static dev_link_t *ibmtr_attach(void)
int i, ret;
DEBUG(0, "ibmtr_attach()\n");
flush_stale_links();
/* Create new token-ring device */
dev = alloc_trdev(sizeof(*info));
......@@ -273,11 +254,9 @@ static void ibmtr_detach(dev_link_t *link)
}
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)
CardServices(DeregisterClient, link->handle);
......@@ -446,7 +425,9 @@ static void ibmtr_release(dev_link_t *link)
link->state &= ~DEV_CONFIG;
} /* ibmtr_release */
if (link->state & DEV_STALE_CONFIG)
ibmtr_detach(link);
}
/*======================================================================
......
......@@ -448,21 +448,6 @@ static struct ethtool_ops netdev_ethtool_ops;
static dev_link_t *nmclan_attach(void);
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
......@@ -480,7 +465,6 @@ static dev_link_t *nmclan_attach(void)
DEBUG(0, "nmclan_attach()\n");
DEBUG(1, "%s\n", rcsid);
flush_stale_links();
/* Create new ethernet device */
dev = alloc_etherdev(sizeof(mace_private));
......@@ -569,11 +553,9 @@ static void nmclan_detach(dev_link_t *link)
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)
CardServices(DeregisterClient, link->handle);
......@@ -843,7 +825,9 @@ static void nmclan_release(dev_link_t *link)
link->state &= ~DEV_CONFIG;
} /* nmclan_release */
if (link->state & DEV_STALE_CONFIG)
nmclan_detach(link);
}
/* ----------------------------------------------------------------------------
nmclan_event
......
......@@ -237,24 +237,6 @@ typedef struct pcnet_dev_t {
u_long mii_reset;
} pcnet_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)
pcnet_detach(link);
}
}
/*======================================================================
We never need to do anything when a pcnet device is "initialized"
......@@ -284,7 +266,6 @@ static dev_link_t *pcnet_attach(void)
int i, ret;
DEBUG(0, "pcnet_attach()\n");
flush_stale_links();
/* Create new ethernet device */
info = kmalloc(sizeof(*info), GFP_KERNEL);
......@@ -356,11 +337,9 @@ static void pcnet_detach(dev_link_t *link)
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)
CardServices(DeregisterClient, link->handle);
......@@ -821,7 +800,9 @@ static void pcnet_release(dev_link_t *link)
link->state &= ~DEV_CONFIG;
} /* pcnet_release */
if (link->state & DEV_STALE_CONFIG)
pcnet_detach(link);
}
/*======================================================================
......
......@@ -305,24 +305,6 @@ static int mdio_read(struct net_device *dev, int phy_id, int loc);
static void mdio_write(struct net_device *dev, int phy_id, int loc, int value);
static int smc_link_ok(struct net_device *dev);
/*======================================================================
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
......@@ -340,7 +322,6 @@ static dev_link_t *smc91c92_attach(void)
int i, ret;
DEBUG(0, "smc91c92_attach()\n");
flush_stale_links();
/* Create new ethernet device */
dev = alloc_etherdev(sizeof(struct smc_private));
......@@ -432,11 +413,9 @@ static void smc91c92_detach(dev_link_t *link)
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)
CardServices(DeregisterClient, link->handle);
......@@ -1103,7 +1082,9 @@ static void smc91c92_release(dev_link_t *link)
link->state &= ~DEV_CONFIG;
} /* smc91c92_release */
if (link->state & DEV_STALE_CONFIG)
smc91c92_detach(link);
}
/*======================================================================
......
......@@ -390,17 +390,6 @@ static void do_powerdown(struct net_device *dev);
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)
{
......@@ -602,7 +591,6 @@ xirc2ps_attach(void)
int err;
DEBUG(0, "attach()\n");
flush_stale_links();
/* Allocate the device structure */
dev = alloc_etherdev(sizeof(local_info_t));
......@@ -687,13 +675,8 @@ xirc2ps_detach(dev_link_t * link)
* 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)
......@@ -1183,19 +1166,6 @@ xirc2ps_release(dev_link_t *link)
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;
......@@ -2030,9 +2000,6 @@ do_stop(struct net_device *dev)
SelectPage(0);
link->open--;
if (link->state & DEV_STALE_CONFIG)
xirc2ps_release(link);
return 0;
}
......
......@@ -161,24 +161,6 @@ typedef struct local_info_t {
struct net_device *eth_dev;
} local_info_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)
airo_detach(link);
}
}
/*======================================================================
airo_attach() creates an "instance" of the driver, allocating
......@@ -199,7 +181,6 @@ static dev_link_t *airo_attach(void)
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);
......@@ -285,11 +266,9 @@ static void airo_detach(dev_link_t *link)
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 ) {
stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 );
......@@ -555,7 +534,9 @@ static void airo_release(dev_link_t *link)
CardServices(ReleaseIRQ, link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
} /* airo_release */
if (link->state & DEV_STALE_CONFIG)
airo_detach(link);
}
/*======================================================================
......
......@@ -174,24 +174,6 @@ typedef struct local_info_t {
struct net_device *eth_dev;
} local_info_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)
atmel_detach(link);
}
}
/*======================================================================
atmel_attach() creates an "instance" of the driver, allocating
......@@ -212,7 +194,6 @@ static dev_link_t *atmel_attach(void)
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);
......@@ -296,29 +277,19 @@ static void atmel_detach(dev_link_t *link)
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 */
}
/*======================================================================
......
......@@ -211,7 +211,6 @@ static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card
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 @@ static dev_link_t *netwave_attach(void)
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 @@ static void netwave_detach(dev_link_t *link)
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;
}
}
......@@ -580,31 +575,6 @@ static void netwave_detach(dev_link_t *link)
} /* 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
*/
......@@ -1181,9 +1151,11 @@ static void netwave_release(dev_link_t *link)
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 @@ static void __exit exit_netwave_cs(void)
{
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");
}
......
......@@ -153,24 +153,6 @@ orinoco_cs_error(client_handle_t handle, int func, int ret)
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 @@ orinoco_cs_attach(void)
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 @@ orinoco_cs_detach(dev_link_t * link)
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)
......
......@@ -319,24 +319,6 @@ static char hop_pattern_length[] = { 1,
static char rcsid[] = "Raylink/WebGear wireless LAN - Corey <Thomas corey@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
......@@ -354,7 +336,6 @@ static dev_link_t *ray_attach(void)
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);
......@@ -484,11 +465,9 @@ static void ray_detach(dev_link_t *link)
*/
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 */
if (link->handle)
......@@ -932,7 +911,11 @@ static void ray_release(dev_link_t *link)
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
......
......@@ -4175,50 +4175,14 @@ wv_pcmcia_release(dev_link_t *link)
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)))
if (link->state & DEV_STALE_CONFIG)
wavelan_detach(link);
}
#ifdef DEBUG_CONFIG_TRACE
printk(KERN_DEBUG "<- wv_flush_stale_links()\n");
#endif
}
/************************ INTERRUPT HANDLING ************************/
......@@ -4705,9 +4669,6 @@ wavelan_attach(void)
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 @@ wavelan_detach(dev_link_t * link)
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 @@ init_wavelan_cs(void)
static void __exit
exit_wavelan_cs(void)
{
/* Do some cleanup of the device list */
wv_flush_stale_links();
pcmcia_unregister_driver(&wavelan_driver);
}
......
......@@ -761,8 +761,7 @@ static inline void
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 */
......
......@@ -1571,7 +1571,6 @@ static void wl3501_detach(dev_link_t *link)
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 @@ static void wl3501_detach(dev_link_t *link)
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 @@ static dev_link_t *wl3501_attach(void)
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 @@ static void wl3501_release(dev_link_t *link)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment