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 *); ...@@ -263,16 +263,6 @@ static void tc574_detach(dev_link_t *);
static dev_link_t *dev_list; 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 tc574_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered local data structures for one device. The device is registered
...@@ -288,7 +278,6 @@ static dev_link_t *tc574_attach(void) ...@@ -288,7 +278,6 @@ static dev_link_t *tc574_attach(void)
int i, ret; int i, ret;
DEBUG(0, "3c574_attach()\n"); DEBUG(0, "3c574_attach()\n");
flush_stale_links();
/* Create the PC card device object. */ /* Create the PC card device object. */
dev = alloc_etherdev(sizeof(struct el3_private)); dev = alloc_etherdev(sizeof(struct el3_private));
...@@ -375,10 +364,8 @@ static void tc574_detach(dev_link_t *link) ...@@ -375,10 +364,8 @@ static void tc574_detach(dev_link_t *link)
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
tc574_release(link); tc574_release(link);
if (link->state & DEV_STALE_CONFIG) { if (link->state & DEV_STALE_CONFIG)
link->state |= DEV_STALE_LINK;
return; return;
}
} }
if (link->handle) if (link->handle)
...@@ -583,7 +570,9 @@ static void tc574_release(dev_link_t *link) ...@@ -583,7 +570,9 @@ static void tc574_release(dev_link_t *link)
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
} /* tc574_release */ if (link->state & DEV_STALE_CONFIG)
tc574_detach(link);
}
/* /*
The card status event handler. Mostly, this schedules other The card status event handler. Mostly, this schedules other
......
...@@ -174,24 +174,6 @@ static void tc589_detach(dev_link_t *); ...@@ -174,24 +174,6 @@ static void tc589_detach(dev_link_t *);
static dev_link_t *dev_list; 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 tc589_attach() creates an "instance" of the driver, allocating
...@@ -209,7 +191,6 @@ static dev_link_t *tc589_attach(void) ...@@ -209,7 +191,6 @@ static dev_link_t *tc589_attach(void)
int i, ret; int i, ret;
DEBUG(0, "3c589_attach()\n"); DEBUG(0, "3c589_attach()\n");
flush_stale_links();
/* Create new ethernet device */ /* Create new ethernet device */
dev = alloc_etherdev(sizeof(struct el3_private)); dev = alloc_etherdev(sizeof(struct el3_private));
...@@ -297,10 +278,8 @@ static void tc589_detach(dev_link_t *link) ...@@ -297,10 +278,8 @@ static void tc589_detach(dev_link_t *link)
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
tc589_release(link); tc589_release(link);
if (link->state & DEV_STALE_CONFIG) { if (link->state & DEV_STALE_CONFIG)
link->state |= DEV_STALE_LINK;
return; return;
}
} }
if (link->handle) if (link->handle)
...@@ -466,8 +445,10 @@ static void tc589_release(dev_link_t *link) ...@@ -466,8 +445,10 @@ static void tc589_release(dev_link_t *link)
CardServices(ReleaseIRQ, link->handle, &link->irq); CardServices(ReleaseIRQ, link->handle, &link->irq);
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
} /* tc589_release */ if (link->state & DEV_STALE_CONFIG)
tc589_detach(link);
}
/*====================================================================== /*======================================================================
......
...@@ -140,24 +140,6 @@ typedef struct axnet_dev_t { ...@@ -140,24 +140,6 @@ typedef struct axnet_dev_t {
int flags; int flags;
} axnet_dev_t; } 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" We never need to do anything when a axnet device is "initialized"
...@@ -187,7 +169,6 @@ static dev_link_t *axnet_attach(void) ...@@ -187,7 +169,6 @@ static dev_link_t *axnet_attach(void)
int i, ret; int i, ret;
DEBUG(0, "axnet_attach()\n"); DEBUG(0, "axnet_attach()\n");
flush_stale_links();
/* Create new ethernet device */ /* Create new ethernet device */
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kmalloc(sizeof(*info), GFP_KERNEL);
...@@ -258,10 +239,8 @@ static void axnet_detach(dev_link_t *link) ...@@ -258,10 +239,8 @@ static void axnet_detach(dev_link_t *link)
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
axnet_release(link); axnet_release(link);
if (link->state & DEV_STALE_CONFIG) { if (link->state & DEV_STALE_CONFIG)
link->state |= DEV_STALE_LINK;
return; return;
}
} }
if (link->handle) if (link->handle)
...@@ -547,7 +526,9 @@ static void axnet_release(dev_link_t *link) ...@@ -547,7 +526,9 @@ static void axnet_release(dev_link_t *link)
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
} /* axnet_release */ if (link->state & DEV_STALE_CONFIG)
axnet_detach(link);
}
/*====================================================================== /*======================================================================
......
...@@ -145,24 +145,6 @@ typedef struct com20020_dev_t { ...@@ -145,24 +145,6 @@ typedef struct com20020_dev_t {
dev_node_t node; dev_node_t node;
} com20020_dev_t; } 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 com20020_attach() creates an "instance" of the driver, allocating
...@@ -181,7 +163,6 @@ static dev_link_t *com20020_attach(void) ...@@ -181,7 +163,6 @@ static dev_link_t *com20020_attach(void)
struct arcnet_local *lp; struct arcnet_local *lp;
DEBUG(0, "com20020_attach()\n"); DEBUG(0, "com20020_attach()\n");
flush_stale_links();
/* Create new network device */ /* Create new network device */
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
...@@ -290,10 +271,8 @@ static void com20020_detach(dev_link_t *link) ...@@ -290,10 +271,8 @@ static void com20020_detach(dev_link_t *link)
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
com20020_release(link); com20020_release(link);
if (link->state & DEV_STALE_CONFIG) { if (link->state & DEV_STALE_CONFIG)
link->state |= DEV_STALE_LINK;
return; return;
}
} }
if (link->handle) if (link->handle)
...@@ -484,7 +463,9 @@ static void com20020_release(dev_link_t *link) ...@@ -484,7 +463,9 @@ static void com20020_release(dev_link_t *link)
link->state &= ~(DEV_CONFIG | DEV_RELEASE_PENDING); 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 { ...@@ -242,24 +242,6 @@ typedef struct local_info_t {
#define BANK_1U 0x24 /* bank 1 (CONFIG_1) */ #define BANK_1U 0x24 /* bank 1 (CONFIG_1) */
#define BANK_2U 0x28 /* bank 2 (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) static dev_link_t *fmvj18x_attach(void)
{ {
local_info_t *lp; local_info_t *lp;
...@@ -269,7 +251,6 @@ static dev_link_t *fmvj18x_attach(void) ...@@ -269,7 +251,6 @@ static dev_link_t *fmvj18x_attach(void)
int i, ret; int i, ret;
DEBUG(0, "fmvj18x_attach()\n"); DEBUG(0, "fmvj18x_attach()\n");
flush_stale_links();
/* Make up a FMVJ18x specific data structure */ /* Make up a FMVJ18x specific data structure */
dev = alloc_etherdev(sizeof(local_info_t)); dev = alloc_etherdev(sizeof(local_info_t));
...@@ -353,10 +334,8 @@ static void fmvj18x_detach(dev_link_t *link) ...@@ -353,10 +334,8 @@ static void fmvj18x_detach(dev_link_t *link)
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
fmvj18x_release(link); fmvj18x_release(link);
if (link->state & DEV_STALE_CONFIG) { if (link->state & DEV_STALE_CONFIG)
link->state |= DEV_STALE_LINK;
return; return;
}
} }
/* Break the link with Card Services */ /* Break the link with Card Services */
...@@ -762,8 +741,10 @@ static void fmvj18x_release(dev_link_t *link) ...@@ -762,8 +741,10 @@ static void fmvj18x_release(dev_link_t *link)
CardServices(ReleaseIRQ, link->handle, &link->irq); CardServices(ReleaseIRQ, link->handle, &link->irq);
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
} /* fmvj18x_release */ if (link->state & DEV_STALE_CONFIG)
fmvj18x_detach(link);
}
/*====================================================================*/ /*====================================================================*/
......
...@@ -139,24 +139,6 @@ typedef struct ibmtr_dev_t { ...@@ -139,24 +139,6 @@ typedef struct ibmtr_dev_t {
struct tok_info ti; struct tok_info ti;
} ibmtr_dev_t; } 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, static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info) struct ethtool_drvinfo *info)
{ {
...@@ -184,7 +166,6 @@ static dev_link_t *ibmtr_attach(void) ...@@ -184,7 +166,6 @@ static dev_link_t *ibmtr_attach(void)
int i, ret; int i, ret;
DEBUG(0, "ibmtr_attach()\n"); DEBUG(0, "ibmtr_attach()\n");
flush_stale_links();
/* Create new token-ring device */ /* Create new token-ring device */
dev = alloc_trdev(sizeof(*info)); dev = alloc_trdev(sizeof(*info));
...@@ -273,10 +254,8 @@ static void ibmtr_detach(dev_link_t *link) ...@@ -273,10 +254,8 @@ static void ibmtr_detach(dev_link_t *link)
} }
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
ibmtr_release(link); ibmtr_release(link);
if (link->state & DEV_STALE_CONFIG) { if (link->state & DEV_STALE_CONFIG)
link->state |= DEV_STALE_LINK;
return; return;
}
} }
if (link->handle) if (link->handle)
...@@ -446,7 +425,9 @@ static void ibmtr_release(dev_link_t *link) ...@@ -446,7 +425,9 @@ static void ibmtr_release(dev_link_t *link)
link->state &= ~DEV_CONFIG; 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; ...@@ -448,21 +448,6 @@ static struct ethtool_ops netdev_ethtool_ops;
static dev_link_t *nmclan_attach(void); static dev_link_t *nmclan_attach(void);
static void nmclan_detach(dev_link_t *); 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 nmclan_attach
Creates an "instance" of the driver, allocating local data Creates an "instance" of the driver, allocating local data
...@@ -480,7 +465,6 @@ static dev_link_t *nmclan_attach(void) ...@@ -480,7 +465,6 @@ static dev_link_t *nmclan_attach(void)
DEBUG(0, "nmclan_attach()\n"); DEBUG(0, "nmclan_attach()\n");
DEBUG(1, "%s\n", rcsid); DEBUG(1, "%s\n", rcsid);
flush_stale_links();
/* Create new ethernet device */ /* Create new ethernet device */
dev = alloc_etherdev(sizeof(mace_private)); dev = alloc_etherdev(sizeof(mace_private));
...@@ -569,10 +553,8 @@ static void nmclan_detach(dev_link_t *link) ...@@ -569,10 +553,8 @@ static void nmclan_detach(dev_link_t *link)
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
nmclan_release(link); nmclan_release(link);
if (link->state & DEV_STALE_CONFIG) { if (link->state & DEV_STALE_CONFIG)
link->state |= DEV_STALE_LINK;
return; return;
}
} }
if (link->handle) if (link->handle)
...@@ -843,7 +825,9 @@ static void nmclan_release(dev_link_t *link) ...@@ -843,7 +825,9 @@ static void nmclan_release(dev_link_t *link)
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
} /* nmclan_release */ if (link->state & DEV_STALE_CONFIG)
nmclan_detach(link);
}
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
nmclan_event nmclan_event
......
...@@ -237,24 +237,6 @@ typedef struct pcnet_dev_t { ...@@ -237,24 +237,6 @@ typedef struct pcnet_dev_t {
u_long mii_reset; u_long mii_reset;
} pcnet_dev_t; } 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" We never need to do anything when a pcnet device is "initialized"
...@@ -284,7 +266,6 @@ static dev_link_t *pcnet_attach(void) ...@@ -284,7 +266,6 @@ static dev_link_t *pcnet_attach(void)
int i, ret; int i, ret;
DEBUG(0, "pcnet_attach()\n"); DEBUG(0, "pcnet_attach()\n");
flush_stale_links();
/* Create new ethernet device */ /* Create new ethernet device */
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kmalloc(sizeof(*info), GFP_KERNEL);
...@@ -356,10 +337,8 @@ static void pcnet_detach(dev_link_t *link) ...@@ -356,10 +337,8 @@ static void pcnet_detach(dev_link_t *link)
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
pcnet_release(link); pcnet_release(link);
if (link->state & DEV_STALE_CONFIG) { if (link->state & DEV_STALE_CONFIG)
link->state |= DEV_STALE_LINK;
return; return;
}
} }
if (link->handle) if (link->handle)
...@@ -821,7 +800,9 @@ static void pcnet_release(dev_link_t *link) ...@@ -821,7 +800,9 @@ static void pcnet_release(dev_link_t *link)
link->state &= ~DEV_CONFIG; 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); ...@@ -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 void mdio_write(struct net_device *dev, int phy_id, int loc, int value);
static int smc_link_ok(struct net_device *dev); 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 smc91c92_attach() creates an "instance" of the driver, allocating
...@@ -340,7 +322,6 @@ static dev_link_t *smc91c92_attach(void) ...@@ -340,7 +322,6 @@ static dev_link_t *smc91c92_attach(void)
int i, ret; int i, ret;
DEBUG(0, "smc91c92_attach()\n"); DEBUG(0, "smc91c92_attach()\n");
flush_stale_links();
/* Create new ethernet device */ /* Create new ethernet device */
dev = alloc_etherdev(sizeof(struct smc_private)); dev = alloc_etherdev(sizeof(struct smc_private));
...@@ -432,10 +413,8 @@ static void smc91c92_detach(dev_link_t *link) ...@@ -432,10 +413,8 @@ static void smc91c92_detach(dev_link_t *link)
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
smc91c92_release(link); smc91c92_release(link);
if (link->state & DEV_STALE_CONFIG) { if (link->state & DEV_STALE_CONFIG)
link->state |= DEV_STALE_LINK;
return; return;
}
} }
if (link->handle) if (link->handle)
...@@ -1103,7 +1082,9 @@ static void smc91c92_release(dev_link_t *link) ...@@ -1103,7 +1082,9 @@ static void smc91c92_release(dev_link_t *link)
link->state &= ~DEV_CONFIG; 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); ...@@ -390,17 +390,6 @@ static void do_powerdown(struct net_device *dev);
static int do_stop(struct net_device *dev); static int do_stop(struct net_device *dev);
/*=============== Helper functions =========================*/ /*=============== 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 static int
get_tuple_data(int fn, client_handle_t handle, tuple_t *tuple) get_tuple_data(int fn, client_handle_t handle, tuple_t *tuple)
{ {
...@@ -602,7 +591,6 @@ xirc2ps_attach(void) ...@@ -602,7 +591,6 @@ xirc2ps_attach(void)
int err; int err;
DEBUG(0, "attach()\n"); DEBUG(0, "attach()\n");
flush_stale_links();
/* Allocate the device structure */ /* Allocate the device structure */
dev = alloc_etherdev(sizeof(local_info_t)); dev = alloc_etherdev(sizeof(local_info_t));
...@@ -687,13 +675,8 @@ xirc2ps_detach(dev_link_t * link) ...@@ -687,13 +675,8 @@ xirc2ps_detach(dev_link_t * link)
* the release() function is called, that will trigger a proper * the release() function is called, that will trigger a proper
* detach(). * detach().
*/ */
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG)
xirc2ps_release(link); xirc2ps_release(link);
if (link->state & DEV_STALE_CONFIG) {
link->state |= DEV_STALE_LINK;
return;
}
}
/* Break the link with Card Services */ /* Break the link with Card Services */
if (link->handle) if (link->handle)
...@@ -1183,19 +1166,6 @@ xirc2ps_release(dev_link_t *link) ...@@ -1183,19 +1166,6 @@ xirc2ps_release(dev_link_t *link)
DEBUG(0, "release(0x%p)\n", 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) { if (link->win) {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
local_info_t *local = dev->priv; local_info_t *local = dev->priv;
...@@ -2030,9 +2000,6 @@ do_stop(struct net_device *dev) ...@@ -2030,9 +2000,6 @@ do_stop(struct net_device *dev)
SelectPage(0); SelectPage(0);
link->open--; link->open--;
if (link->state & DEV_STALE_CONFIG)
xirc2ps_release(link);
return 0; return 0;
} }
......
...@@ -161,24 +161,6 @@ typedef struct local_info_t { ...@@ -161,24 +161,6 @@ typedef struct local_info_t {
struct net_device *eth_dev; struct net_device *eth_dev;
} local_info_t; } 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 airo_attach() creates an "instance" of the driver, allocating
...@@ -199,8 +181,7 @@ static dev_link_t *airo_attach(void) ...@@ -199,8 +181,7 @@ static dev_link_t *airo_attach(void)
int ret, i; int ret, i;
DEBUG(0, "airo_attach()\n"); DEBUG(0, "airo_attach()\n");
flush_stale_links();
/* Initialize the dev_link_t structure */ /* Initialize the dev_link_t structure */
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
if (!link) { if (!link) {
...@@ -285,10 +266,8 @@ static void airo_detach(dev_link_t *link) ...@@ -285,10 +266,8 @@ static void airo_detach(dev_link_t *link)
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
airo_release(link); airo_release(link);
if (link->state & DEV_STALE_CONFIG) { if (link->state & DEV_STALE_CONFIG)
link->state |= DEV_STALE_LINK;
return; return;
}
} }
if ( ((local_info_t*)link->priv)->eth_dev ) { if ( ((local_info_t*)link->priv)->eth_dev ) {
...@@ -554,8 +533,10 @@ static void airo_release(dev_link_t *link) ...@@ -554,8 +533,10 @@ static void airo_release(dev_link_t *link)
if (link->irq.AssignedIRQ) if (link->irq.AssignedIRQ)
CardServices(ReleaseIRQ, link->handle, &link->irq); CardServices(ReleaseIRQ, link->handle, &link->irq);
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
} /* airo_release */ if (link->state & DEV_STALE_CONFIG)
airo_detach(link);
}
/*====================================================================== /*======================================================================
......
...@@ -174,24 +174,6 @@ typedef struct local_info_t { ...@@ -174,24 +174,6 @@ typedef struct local_info_t {
struct net_device *eth_dev; struct net_device *eth_dev;
} local_info_t; } 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 atmel_attach() creates an "instance" of the driver, allocating
...@@ -212,8 +194,7 @@ static dev_link_t *atmel_attach(void) ...@@ -212,8 +194,7 @@ static dev_link_t *atmel_attach(void)
int ret, i; int ret, i;
DEBUG(0, "atmel_attach()\n"); DEBUG(0, "atmel_attach()\n");
flush_stale_links();
/* Initialize the dev_link_t structure */ /* Initialize the dev_link_t structure */
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
if (!link) { if (!link) {
...@@ -296,29 +277,19 @@ static void atmel_detach(dev_link_t *link) ...@@ -296,29 +277,19 @@ static void atmel_detach(dev_link_t *link)
if (*linkp == NULL) if (*linkp == NULL)
return; return;
if ( link->state & DEV_CONFIG ) { if (link->state & DEV_CONFIG)
atmel_release(link); atmel_release(link);
if ( link->state & DEV_STALE_CONFIG ) {
link->state |= DEV_STALE_LINK;
return;
}
}
/* Break the link with Card Services */ /* Break the link with Card Services */
if (link->handle) if (link->handle)
CardServices(DeregisterClient, link->handle); CardServices(DeregisterClient, link->handle);
/* Unlink device structure, free pieces */ /* Unlink device structure, free pieces */
*linkp = link->next; *linkp = link->next;
if (link->priv) { if (link->priv)
kfree(link->priv); kfree(link->priv);
}
kfree(link); kfree(link);
}
} /* atmel_detach */
/*====================================================================== /*======================================================================
......
...@@ -211,7 +211,6 @@ static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card ...@@ -211,7 +211,6 @@ static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card
insertion */ insertion */
static dev_link_t *netwave_attach(void); /* Create instance */ static dev_link_t *netwave_attach(void); /* Create instance */
static void netwave_detach(dev_link_t *); /* Destroy instance */ static void netwave_detach(dev_link_t *); /* Destroy instance */
static void netwave_flush_stale_links(void); /* Destroy all staled instances */
/* Hardware configuration */ /* Hardware configuration */
static void netwave_doreset(ioaddr_t iobase, u_char* ramBase); static void netwave_doreset(ioaddr_t iobase, u_char* ramBase);
...@@ -444,9 +443,6 @@ static dev_link_t *netwave_attach(void) ...@@ -444,9 +443,6 @@ static dev_link_t *netwave_attach(void)
DEBUG(0, "netwave_attach()\n"); DEBUG(0, "netwave_attach()\n");
/* Perform some cleanup */
netwave_flush_stale_links();
/* Initialize the dev_link_t structure */ /* Initialize the dev_link_t structure */
dev = alloc_etherdev(sizeof(netwave_private)); dev = alloc_etherdev(sizeof(netwave_private));
if (!dev) if (!dev)
...@@ -553,7 +549,6 @@ static void netwave_detach(dev_link_t *link) ...@@ -553,7 +549,6 @@ static void netwave_detach(dev_link_t *link)
if (link->state & DEV_STALE_CONFIG) { if (link->state & DEV_STALE_CONFIG) {
DEBUG(1, "netwave_cs: detach postponed, '%s' still " DEBUG(1, "netwave_cs: detach postponed, '%s' still "
"locked\n", link->dev->dev_name); "locked\n", link->dev->dev_name);
link->state |= DEV_STALE_LINK;
return; return;
} }
} }
...@@ -580,31 +575,6 @@ static void netwave_detach(dev_link_t *link) ...@@ -580,31 +575,6 @@ static void netwave_detach(dev_link_t *link)
} /* netwave_detach */ } /* 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 * Wireless Handler : get protocol name
*/ */
...@@ -1181,9 +1151,11 @@ static void netwave_release(dev_link_t *link) ...@@ -1181,9 +1151,11 @@ static void netwave_release(dev_link_t *link)
CardServices(ReleaseIO, link->handle, &link->io); CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq); 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) * Function netwave_event (event, priority, args)
...@@ -1755,8 +1727,6 @@ static void __exit exit_netwave_cs(void) ...@@ -1755,8 +1727,6 @@ static void __exit exit_netwave_cs(void)
{ {
pcmcia_unregister_driver(&netwave_driver); pcmcia_unregister_driver(&netwave_driver);
/* Do some cleanup of the device list */
netwave_flush_stale_links();
if (dev_list != NULL) /* Critical situation */ if (dev_list != NULL) /* Critical situation */
printk("netwave_cs: devices remaining when removing module\n"); printk("netwave_cs: devices remaining when removing module\n");
} }
......
...@@ -153,24 +153,6 @@ orinoco_cs_error(client_handle_t handle, int func, int ret) ...@@ -153,24 +153,6 @@ orinoco_cs_error(client_handle_t handle, int func, int ret)
CardServices(ReportError, handle, &err); 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 * This creates an "instance" of the driver, allocating local data
* structures for one device. The device is registered with Card * structures for one device. The device is registered with Card
...@@ -189,9 +171,6 @@ orinoco_cs_attach(void) ...@@ -189,9 +171,6 @@ orinoco_cs_attach(void)
client_reg_t client_reg; client_reg_t client_reg;
int ret, i; int ret, i;
/* A bit of cleanup */
flush_stale_links();
dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset); dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset);
if (! dev) if (! dev)
return NULL; return NULL;
...@@ -266,13 +245,8 @@ orinoco_cs_detach(dev_link_t * link) ...@@ -266,13 +245,8 @@ orinoco_cs_detach(dev_link_t * link)
return; return;
} }
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG)
orinoco_cs_release(link); orinoco_cs_release(link);
if (link->state & DEV_CONFIG) {
link->state |= DEV_STALE_LINK;
return;
}
}
/* Break the link with Card Services */ /* Break the link with Card Services */
if (link->handle) if (link->handle)
......
...@@ -319,24 +319,6 @@ static char hop_pattern_length[] = { 1, ...@@ -319,24 +319,6 @@ static char hop_pattern_length[] = { 1,
static char rcsid[] = "Raylink/WebGear wireless LAN - Corey <Thomas corey@world.std.com>"; 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 ray_attach() creates an "instance" of the driver, allocating
local data structures for one device. The device is registered local data structures for one device. The device is registered
...@@ -354,7 +336,6 @@ static dev_link_t *ray_attach(void) ...@@ -354,7 +336,6 @@ static dev_link_t *ray_attach(void)
struct net_device *dev; struct net_device *dev;
DEBUG(1, "ray_attach()\n"); DEBUG(1, "ray_attach()\n");
flush_stale_links();
/* Initialize the dev_link_t structure */ /* Initialize the dev_link_t structure */
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
...@@ -484,10 +465,8 @@ static void ray_detach(dev_link_t *link) ...@@ -484,10 +465,8 @@ static void ray_detach(dev_link_t *link)
*/ */
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
ray_release(link); ray_release(link);
if(link->state & DEV_STALE_CONFIG) { if(link->state & DEV_STALE_CONFIG)
link->state |= DEV_STALE_LINK;
return; return;
}
} }
/* Break the link with Card Services */ /* Break the link with Card Services */
...@@ -932,7 +911,11 @@ static void ray_release(dev_link_t *link) ...@@ -932,7 +911,11 @@ static void ray_release(dev_link_t *link)
if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseIRQ ret = %x\n",i); if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseIRQ ret = %x\n",i);
DEBUG(2,"ray_release ending\n"); 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 The card status event handler. Mostly, this schedules other
stuff to run after an event is received. A CARD_REMOVAL event stuff to run after an event is received. A CARD_REMOVAL event
......
...@@ -4175,50 +4175,14 @@ wv_pcmcia_release(dev_link_t *link) ...@@ -4175,50 +4175,14 @@ wv_pcmcia_release(dev_link_t *link)
CardServices(ReleaseIO, link->handle, &link->io); CardServices(ReleaseIO, link->handle, &link->io);
CardServices(ReleaseIRQ, link->handle, &link->irq); CardServices(ReleaseIRQ, link->handle, &link->irq);
link->state &= ~(DEV_CONFIG | DEV_STALE_CONFIG); link->state &= ~DEV_CONFIG;
#ifdef DEBUG_CONFIG_TRACE #ifdef DEBUG_CONFIG_TRACE
printk(KERN_DEBUG "%s: <- wv_pcmcia_release()\n", dev->name); printk(KERN_DEBUG "%s: <- wv_pcmcia_release()\n", dev->name);
#endif #endif
} /* wv_pcmcia_release */
/*------------------------------------------------------------------*/ if (link->state & DEV_STALE_CONFIG)
/* wavelan_detach(link);
* 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
} }
/************************ INTERRUPT HANDLING ************************/ /************************ INTERRUPT HANDLING ************************/
...@@ -4705,9 +4669,6 @@ wavelan_attach(void) ...@@ -4705,9 +4669,6 @@ wavelan_attach(void)
printk(KERN_DEBUG "-> wavelan_attach()\n"); printk(KERN_DEBUG "-> wavelan_attach()\n");
#endif #endif
/* Perform some cleanup */
wv_flush_stale_links();
/* Initialize the dev_link_t structure */ /* Initialize the dev_link_t structure */
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
if (!link) return NULL; if (!link) return NULL;
...@@ -4859,7 +4820,6 @@ wavelan_detach(dev_link_t * link) ...@@ -4859,7 +4820,6 @@ wavelan_detach(dev_link_t * link)
printk(KERN_DEBUG "wavelan_detach: detach postponed," printk(KERN_DEBUG "wavelan_detach: detach postponed,"
" '%s' still locked\n", link->dev->dev_name); " '%s' still locked\n", link->dev->dev_name);
#endif #endif
link->state |= DEV_STALE_LINK;
return; return;
} }
} }
...@@ -5039,9 +4999,6 @@ init_wavelan_cs(void) ...@@ -5039,9 +4999,6 @@ init_wavelan_cs(void)
static void __exit static void __exit
exit_wavelan_cs(void) exit_wavelan_cs(void)
{ {
/* Do some cleanup of the device list */
wv_flush_stale_links();
pcmcia_unregister_driver(&wavelan_driver); pcmcia_unregister_driver(&wavelan_driver);
} }
......
...@@ -761,8 +761,7 @@ static inline void ...@@ -761,8 +761,7 @@ static inline void
static inline int static inline int
wv_pcmcia_config(dev_link_t *); /* Configure the pcmcia interface */ wv_pcmcia_config(dev_link_t *); /* Configure the pcmcia interface */
static void static void
wv_pcmcia_release(dev_link_t *),/* Remove a device */ wv_pcmcia_release(dev_link_t *);/* Remove a device */
wv_flush_stale_links(void); /* "detach" all possible devices */
/* ---------------------- INTERRUPT HANDLING ---------------------- */ /* ---------------------- INTERRUPT HANDLING ---------------------- */
static irqreturn_t static irqreturn_t
wavelan_interrupt(int, /* Interrupt handler */ wavelan_interrupt(int, /* Interrupt handler */
......
...@@ -1571,7 +1571,6 @@ static void wl3501_detach(dev_link_t *link) ...@@ -1571,7 +1571,6 @@ static void wl3501_detach(dev_link_t *link)
printk(KERN_DEBUG "wl3501_cs: detach postponed, '%s' " printk(KERN_DEBUG "wl3501_cs: detach postponed, '%s' "
"still locked\n", link->dev->dev_name); "still locked\n", link->dev->dev_name);
#endif #endif
link->state |= DEV_STALE_LINK;
goto out; goto out;
} }
...@@ -1589,22 +1588,6 @@ static void wl3501_detach(dev_link_t *link) ...@@ -1589,22 +1588,6 @@ static void wl3501_detach(dev_link_t *link)
return; 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, static int wl3501_get_name(struct net_device *dev, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
...@@ -2033,8 +2016,6 @@ static dev_link_t *wl3501_attach(void) ...@@ -2033,8 +2016,6 @@ static dev_link_t *wl3501_attach(void)
struct net_device *dev; struct net_device *dev;
int ret, i; int ret, i;
wl3501_flush_stale_links();
/* Initialize the dev_link_t structure */ /* Initialize the dev_link_t structure */
link = kmalloc(sizeof(*link), GFP_KERNEL); link = kmalloc(sizeof(*link), GFP_KERNEL);
if (!link) if (!link)
...@@ -2263,7 +2244,7 @@ static void wl3501_release(dev_link_t *link) ...@@ -2263,7 +2244,7 @@ static void wl3501_release(dev_link_t *link)
CardServices(ReleaseIRQ, link->handle, &link->irq); CardServices(ReleaseIRQ, link->handle, &link->irq);
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
if (link->state & DEV_STALE_LINK) if (link->state & DEV_STALE_CONFIG)
wl3501_detach(link); wl3501_detach(link);
out: out:
return; 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