Commit 0d918abe authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://bk.arm.linux.org.uk/linux-2.6-pcmcia

into home.osdl.org:/home/torvalds/v2.5/linux
parents a7e79f17 2066934f
......@@ -725,14 +725,6 @@ static void mgslpc_release(u_long arg)
if (debug_level >= DEBUG_LEVEL_INFO)
printk("mgslpc_release(0x%p)\n", link);
if (link->open) {
if (debug_level >= DEBUG_LEVEL_INFO)
printk("synclink_cs: release postponed, '%s' still open\n",
link->dev->dev_name);
link->state |= DEV_STALE_CONFIG;
return;
}
/* Unlink the device chain */
link->dev = NULL;
link->state &= ~DEV_CONFIG;
......
......@@ -431,15 +431,6 @@ static void avmcs_config(dev_link_t *link)
static void avmcs_release(dev_link_t *link)
{
/*
If the device is currently in use, we won't release until it
is actually closed.
*/
if (link->open) {
link->state |= DEV_STALE_CONFIG;
return;
}
b1pcmcia_delcard(link->io.BasePort1, link->irq.AssignedIRQ);
/* Unlink the device chain */
......
......@@ -438,17 +438,6 @@ static void avma1cs_release(dev_link_t *link)
DEBUG(0, "avma1cs_release(0x%p)\n", link);
/*
If the device is currently in use, we won't release until it
is actually closed.
*/
if (link->open) {
DEBUG(1, "avma1_cs: release postponed, '%s' still open\n",
link->dev->dev_name);
link->state |= DEV_STALE_CONFIG;
return;
}
/* no unregister function with hisax */
HiSax_closecard(local->node.minor);
......@@ -463,7 +452,6 @@ static void avma1cs_release(dev_link_t *link)
if (link->state & DEV_STALE_LINK)
avma1cs_detach(link);
} /* avma1cs_release */
/*======================================================================
......
......@@ -442,18 +442,6 @@ static void elsa_cs_release(dev_link_t *link)
DEBUG(0, "elsa_cs_release(0x%p)\n", link);
/*
If the device is currently in use, we won't release until it
is actually closed, because until then, we can't be sure that
no one will try to access the device or its data structures.
*/
if (link->open) {
DEBUG(1, "elsa_cs: release postponed, '%s' "
"still open\n", link->dev->dev_name);
link->state |= DEV_STALE_CONFIG;
return;
}
/* Unlink the device chain */
link->dev = NULL;
......
......@@ -535,18 +535,6 @@ static void sedlbauer_release(dev_link_t *link)
{
DEBUG(0, "sedlbauer_release(0x%p)\n", link);
/*
If the device is currently in use, we won't release until it
is actually closed, because until then, we can't be sure that
no one will try to access the device or its data structures.
*/
if (link->open) {
DEBUG(1, "sedlbauer_cs: release postponed, '%s' still open\n",
link->dev->dev_name);
link->state |= DEV_STALE_CONFIG;
return;
}
/* Unlink the device chain */
link->dev = NULL;
......
......@@ -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,10 +364,8 @@ 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)
......@@ -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,10 +278,8 @@ 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)
......@@ -466,8 +445,10 @@ static void tc589_release(dev_link_t *link)
CardServices(ReleaseIRQ, link->handle, &link->irq);
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,10 +239,8 @@ 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)
......@@ -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,10 +271,8 @@ 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)
......@@ -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,10 +334,8 @@ 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 */
......@@ -762,8 +741,10 @@ static void fmvj18x_release(dev_link_t *link)
CardServices(ReleaseIRQ, link->handle, &link->irq);
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,10 +254,8 @@ 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)
......@@ -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,10 +553,8 @@ 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)
......@@ -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,10 +337,8 @@ 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)
......@@ -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,10 +413,8 @@ 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)
......@@ -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,8 +181,7 @@ 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);
if (!link) {
......@@ -285,10 +266,8 @@ 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 ) {
......@@ -554,8 +533,10 @@ static void airo_release(dev_link_t *link)
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);
}
/*======================================================================
......
......@@ -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,8 +194,7 @@ 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);
if (!link) {
......@@ -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,10 +465,8 @@ 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 */
......@@ -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)))
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 @@ 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 */
......
......@@ -1581,7 +1581,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;
}
......@@ -1599,22 +1598,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)
{
......@@ -2043,8 +2026,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)
......@@ -2273,7 +2254,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;
......
......@@ -29,18 +29,11 @@
the provisions above, a recipient may use your version of this
file under either the MPL or the GPL.
These routines handle allocating resources for Cardbus cards, as
well as setting up and shutting down Cardbus sockets. They are
called from cs.c in response to Request/ReleaseConfiguration and
Request/ReleaseIO calls.
======================================================================*/
/*
* This file is going away. Cardbus handling has been re-written to be
* more of a PCI bridge thing, and the PCI code basically does all the
* resource handling. This has wrappers to make the rest of the PCMCIA
* subsystem not notice that it's not here any more.
* Cardbus handling has been re-written to be more of a PCI bridge thing,
* and the PCI code basically does all the resource handling.
*
* Linus, Jan 2000
*/
......
......@@ -244,13 +244,10 @@ static const lookup_t service_table[] = {
static int socket_resume(struct pcmcia_socket *skt);
static int socket_suspend(struct pcmcia_socket *skt);
int pcmcia_socket_dev_suspend(struct device *dev, u32 state, u32 level)
int pcmcia_socket_dev_suspend(struct device *dev, u32 state)
{
struct pcmcia_socket *socket;
if (level != SUSPEND_SAVE_STATE)
return 0;
down_read(&pcmcia_socket_list_rwsem);
list_for_each_entry(socket, &pcmcia_socket_list, socket_list) {
if (socket->dev.dev != dev)
......@@ -265,13 +262,10 @@ int pcmcia_socket_dev_suspend(struct device *dev, u32 state, u32 level)
}
EXPORT_SYMBOL(pcmcia_socket_dev_suspend);
int pcmcia_socket_dev_resume(struct device *dev, u32 level)
int pcmcia_socket_dev_resume(struct device *dev)
{
struct pcmcia_socket *socket;
if (level != RESUME_RESTORE_STATE)
return 0;
down_read(&pcmcia_socket_list_rwsem);
list_for_each_entry(socket, &pcmcia_socket_list, socket_list) {
if (socket->dev.dev != dev)
......@@ -657,7 +651,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
pcmcia_error(skt, "unsupported voltage key.\n");
return CS_BAD_TYPE;
}
skt->socket.flags = SS_DEBOUNCED;
skt->socket.flags = 0;
skt->ops->set_socket(skt, &skt->socket);
/*
......@@ -690,7 +684,6 @@ static int socket_insert(struct pcmcia_socket *skt)
}
#endif
send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
skt->socket.flags &= ~SS_DEBOUNCED;
} else {
socket_shutdown(skt);
cs_socket_put(skt);
......@@ -739,7 +732,6 @@ static int socket_resume(struct pcmcia_socket *skt)
} else {
send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
}
skt->socket.flags &= ~SS_DEBOUNCED;
} else {
socket_shutdown(skt);
cs_socket_put(skt);
......
......@@ -100,11 +100,8 @@ struct cis_cache_entry {
/* Flags in socket state */
#define SOCKET_PRESENT 0x0008
#define SOCKET_INUSE 0x0010
#define SOCKET_SHUTDOWN_PENDING 0x0020
#define SOCKET_RESET_PENDING 0x0040
#define SOCKET_SUSPEND 0x0080
#define SOCKET_WIN_REQ(i) (0x0100<<(i))
#define SOCKET_IO_REQ(i) (0x1000<<(i))
#define SOCKET_REGION_INFO 0x4000
#define SOCKET_CARDBUS 0x8000
#define SOCKET_CARDBUS_CONFIG 0x10000
......
......@@ -867,19 +867,32 @@ static void hs_exit_socket(hs_socket_t *sp)
local_irq_restore(flags);
}
static int hd64465_suspend(struct device *dev, u32 state, u32 level)
{
int ret = 0;
if (level == SUSPEND_SAVE_STATE)
ret = pcmcia_socket_dev_suspend(dev, state);
return ret;
}
static int hd64465_resume(struct device *dev, u32 level)
{
int ret = 0;
if (level == RESUME_RESTORE_STATE)
ret = pcmcia_socket_dev_resume(dev);
return ret;
}
static struct device_driver hd64465_driver = {
.name = "hd64465-pcmcia",
.bus = &platform_bus_type,
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
.suspend = hd64465_suspend,
.resume = hd64465_resume,
};
static struct platform_device hd64465_device = {
.name = "hd64465-pcmcia",
.id = 0,
.dev = {
.name = "hd64465-pcmcia",
},
};
static int __init init_hs(void)
......
......@@ -44,12 +44,12 @@ MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids);
static int i82092aa_socket_suspend (struct pci_dev *dev, u32 state)
{
return pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);
return pcmcia_socket_dev_suspend(&dev->dev, state);
}
static int i82092aa_socket_resume (struct pci_dev *dev)
{
return pcmcia_socket_dev_resume(&dev->dev, RESUME_RESTORE_STATE);
return pcmcia_socket_dev_resume(&dev->dev);
}
static struct pci_driver i82092aa_pci_drv = {
......
......@@ -1351,11 +1351,27 @@ static struct pccard_operations pcic_operations = {
/*====================================================================*/
static int i82365_suspend(struct device *dev, u32 state, u32 level)
{
int ret = 0;
if (level == SUSPEND_SAVE_STATE)
ret = pcmcia_socket_dev_suspend(dev, state);
return ret;
}
static int i82365_resume(struct device *dev, u32 level)
{
int ret = 0;
if (level == RESUME_RESTORE_STATE)
ret = pcmcia_socket_dev_resume(dev);
return ret;
}
static struct device_driver i82365_driver = {
.name = "i82365",
.bus = &platform_bus_type,
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
.suspend = i82365_suspend,
.resume = i82365_resume,
};
static struct platform_device i82365_device = {
......
......@@ -109,7 +109,7 @@
/* 16-bit IO and memory timing registers */
#define RL5C4XX_16BIT_IO_0 0x0088 /* 16 bit */
#define RL5C4XX_16BIT_MEM_0 0x0088 /* 16 bit */
#define RL5C4XX_16BIT_MEM_0 0x008a /* 16 bit */
#define RL5C4XX_SETUP_MASK 0x0007
#define RL5C4XX_SETUP_SHIFT 0
#define RL5C4XX_CMD_MASK 0x01f0
......
......@@ -100,13 +100,29 @@ static int sa11x0_drv_pcmcia_probe(struct device *dev)
return ret;
}
static int sa11x0_drv_pcmcia_suspend(struct device *dev, u32 state, u32 level)
{
int ret = 0;
if (level == SUSPEND_SAVE_STATE)
ret = pcmcia_socket_dev_suspend(dev, state);
return ret;
}
static int sa11x0_drv_pcmcia_resume(struct device *dev, u32 level)
{
int ret = 0;
if (level == RESUME_RESTORE_STATE)
ret = pcmcia_socket_dev_resume(dev);
return ret;
}
static struct device_driver sa11x0_pcmcia_driver = {
.probe = sa11x0_drv_pcmcia_probe,
.remove = sa11xx_drv_pcmcia_remove,
.name = "sa11x0-pcmcia",
.bus = &platform_bus_type,
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
.suspend = sa11x0_drv_pcmcia_suspend,
.resume = sa11x0_drv_pcmcia_resume,
};
/* sa11x0_pcmcia_init()
......
......@@ -171,12 +171,12 @@ static int __devexit pcmcia_remove(struct sa1111_dev *dev)
static int pcmcia_suspend(struct sa1111_dev *dev, u32 state)
{
return pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);
return pcmcia_socket_dev_suspend(&dev->dev, state);
}
static int pcmcia_resume(struct sa1111_dev *dev)
{
return pcmcia_socket_dev_resume(&dev->dev, RESUME_RESTORE_STATE);
return pcmcia_socket_dev_resume(&dev->dev);
}
static struct sa1111_driver pcmcia_driver = {
......
......@@ -556,7 +556,6 @@ static struct bittbl conf_bits[] = {
{ SS_DMA_MODE, "SS_DMA_MODE" },
{ SS_SPKR_ENA, "SS_SPKR_ENA" },
{ SS_OUTPUT_ENA, "SS_OUTPUT_ENA" },
{ SS_DEBOUNCED, "SS_DEBOUNCED" },
};
static void
......
......@@ -362,11 +362,27 @@ static int __init get_tcic_id(void)
/*====================================================================*/
static int tcic_drv_suspend(struct device *dev, u32 state, u32 level)
{
int ret = 0;
if (level == SUSPEND_SAVE_STATE)
ret = pcmcia_socket_dev_suspend(dev, state);
return ret;
}
static int tcic_drv_resume(struct device *dev, u32 level)
{
int ret = 0;
if (level == RESUME_RESTORE_STATE)
ret = pcmcia_socket_dev_resume(dev);
return ret;
}
static struct device_driver tcic_driver = {
.name = "tcic-pcmcia",
.bus = &platform_bus_type,
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
.suspend = tcic_drv_suspend,
.resume = tcic_drv_resume,
};
static struct platform_device tcic_device = {
......
......@@ -248,10 +248,6 @@ static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
u16 bridge;
if (state->flags & SS_DEBOUNCED) {
/* The insertion debounce period has ended. Clear any pending insertion events */
state->flags &= ~SS_DEBOUNCED; /* SS_DEBOUNCED is oneshot */
}
yenta_set_power(socket, state);
socket->io_irq = state->io_irq;
bridge = config_readw(socket, CB_BRIDGE_CONTROL) & ~(CB_BRIDGE_CRST | CB_BRIDGE_INTR);
......@@ -937,7 +933,7 @@ static int yenta_dev_suspend (struct pci_dev *dev, u32 state)
struct yenta_socket *socket = pci_get_drvdata(dev);
int ret;
ret = pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);
ret = pcmcia_socket_dev_suspend(&dev->dev, state);
if (socket) {
if (socket->type && socket->type->save_state)
......@@ -969,7 +965,7 @@ static int yenta_dev_resume (struct pci_dev *dev)
socket->type->restore_state(socket);
}
return pcmcia_socket_dev_resume(&dev->dev, RESUME_RESTORE_STATE);
return pcmcia_socket_dev_resume(&dev->dev);
}
......
......@@ -78,7 +78,6 @@ extern socket_state_t dead_socket;
#define SS_DMA_MODE 0x0080
#define SS_SPKR_ENA 0x0100
#define SS_OUTPUT_ENA 0x0200
#define SS_DEBOUNCED 0x0400 /* Tell driver that the debounce delay has ended */
/* Flags for I/O port and memory windows */
#define MAP_ACTIVE 0x01
......@@ -176,7 +175,6 @@ struct pcmcia_socket {
u_short functions;
u_short lock_count;
client_handle_t clients;
u_int real_clients;
pccard_mem_map cis_mem;
u_char *cis_virt;
struct config_t *config;
......@@ -249,7 +247,7 @@ extern void pcmcia_unregister_socket(struct pcmcia_socket *socket);
extern struct class pcmcia_socket_class;
/* socket drivers are expected to use these callbacks in their .drv struct */
extern int pcmcia_socket_dev_suspend(struct device *dev, u32 state, u32 level);
extern int pcmcia_socket_dev_resume(struct device *dev, u32 level);
extern int pcmcia_socket_dev_suspend(struct device *dev, u32 state);
extern int pcmcia_socket_dev_resume(struct device *dev);
#endif /* _LINUX_SS_H */
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