aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-02 00:09:29 +0100
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 17:26:33 +0200
commite2d4096365e06b9a3799afbadc28b4519c0b3526 (patch)
tree90ec691d71f9c0309048714e359b8ba351b533f7 /drivers/net/wireless
parentf6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b (diff)
downloadkernel_samsung_smdk4412-e2d4096365e06b9a3799afbadc28b4519c0b3526.tar.gz
kernel_samsung_smdk4412-e2d4096365e06b9a3799afbadc28b4519c0b3526.tar.bz2
kernel_samsung_smdk4412-e2d4096365e06b9a3799afbadc28b4519c0b3526.zip
[PATCH] pcmcia: use bitfield instead of p_state and state
Instead of the two status values struct pcmcia_device->p_state and state, use descriptive bitfields. Most value-checking in drivers was invalid, as the core now only calls the ->remove() (a.k.a. detach) function in case the attachement _and_ configuration was successful. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/airo_cs.c16
-rw-r--r--drivers/net/wireless/atmel_cs.c25
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c56
-rw-r--r--drivers/net/wireless/netwave_cs.c12
-rw-r--r--drivers/net/wireless/orinoco_cs.c70
-rw-r--r--drivers/net/wireless/ray_cs.c53
-rw-r--r--drivers/net/wireless/spectrum_cs.c37
-rw-r--r--drivers/net/wireless/wavelan_cs.c24
-rw-r--r--drivers/net/wireless/wl3501_cs.c19
9 files changed, 117 insertions, 195 deletions
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index 97f41565fca..af0cbb6c5c0 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -170,7 +170,6 @@ static int airo_probe(struct pcmcia_device *p_dev)
}
p_dev->priv = local;
- p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return airo_config(p_dev);
} /* airo_attach */
@@ -187,8 +186,7 @@ static void airo_detach(struct pcmcia_device *link)
{
DEBUG(0, "airo_detach(0x%p)\n", link);
- if (link->state & DEV_CONFIG)
- airo_release(link);
+ airo_release(link);
if ( ((local_info_t*)link->priv)->eth_dev ) {
stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 );
@@ -237,10 +235,7 @@ static int airo_config(struct pcmcia_device *link)
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
-
- /* Configure card */
- link->state |= DEV_CONFIG;
-
+
/*
In this loop, we scan the CIS for configuration table entries,
each of which describes a valid card configuration, including
@@ -382,8 +377,6 @@ static int airo_config(struct pcmcia_device *link)
printk(", mem 0x%06lx-0x%06lx", req.Base,
req.Base+req.Size-1);
printk("\n");
-
- link->state &= ~DEV_CONFIG_PENDING;
return 0;
cs_failed:
@@ -410,8 +403,7 @@ static int airo_suspend(struct pcmcia_device *link)
{
local_info_t *local = link->priv;
- if (link->state & DEV_CONFIG)
- netif_device_detach(local->eth_dev);
+ netif_device_detach(local->eth_dev);
return 0;
}
@@ -420,7 +412,7 @@ static int airo_resume(struct pcmcia_device *link)
{
local_info_t *local = link->priv;
- if ((link->state & DEV_CONFIG) && (link->open)) {
+ if (link->open) {
reset_airo_card(local->eth_dev);
netif_device_attach(local->eth_dev);
}
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index d09b1472e67..25fb919b379 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -181,7 +181,6 @@ static int atmel_probe(struct pcmcia_device *p_dev)
}
p_dev->priv = local;
- p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return atmel_config(p_dev);
} /* atmel_attach */
@@ -198,8 +197,7 @@ static void atmel_detach(struct pcmcia_device *link)
{
DEBUG(0, "atmel_detach(0x%p)\n", link);
- if (link->state & DEV_CONFIG)
- atmel_release(link);
+ atmel_release(link);
kfree(link->priv);
}
@@ -222,7 +220,7 @@ static int card_present(void *arg)
struct pcmcia_device *link = (struct pcmcia_device *)arg;
if (link->suspended)
return 0;
- else if (link->state & DEV_PRESENT)
+ else if (pcmcia_dev_present(link))
return 1;
return 0;
@@ -257,10 +255,7 @@ static int atmel_config(struct pcmcia_device *link)
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
-
- /* Configure card */
- link->state |= DEV_CONFIG;
-
+
/*
In this loop, we scan the CIS for configuration table entries,
each of which describes a valid card configuration, including
@@ -373,10 +368,9 @@ static int atmel_config(struct pcmcia_device *link)
strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name );
dev->node.major = dev->node.minor = 0;
link->dev_node = &dev->node;
-
- link->state &= ~DEV_CONFIG_PENDING;
+
return 0;
-
+
cs_failed:
cs_error(link, last_fn, last_ret);
atmel_release(link);
@@ -408,8 +402,7 @@ static int atmel_suspend(struct pcmcia_device *link)
{
local_info_t *local = link->priv;
- if (link->state & DEV_CONFIG)
- netif_device_detach(local->eth_dev);
+ netif_device_detach(local->eth_dev);
return 0;
}
@@ -418,10 +411,8 @@ static int atmel_resume(struct pcmcia_device *link)
{
local_info_t *local = link->priv;
- if (link->state & DEV_CONFIG) {
- atmel_open(local->eth_dev);
- netif_device_attach(local->eth_dev);
- }
+ atmel_open(local->eth_dev);
+ netif_device_attach(local->eth_dev);
return 0;
}
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 88dc383a3da..a2cb9b0fa3d 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -210,9 +210,7 @@ static int prism2_config(struct pcmcia_device *link);
static int prism2_pccard_card_present(local_info_t *local)
{
struct hostap_cs_priv *hw_priv = local->hw_priv;
- if (hw_priv != NULL && hw_priv->link != NULL &&
- ((hw_priv->link->state & (DEV_PRESENT | DEV_CONFIG)) ==
- (DEV_PRESENT | DEV_CONFIG)))
+ if (hw_priv != NULL && hw_priv->link != NULL && DEV_OK(hw_priv->link))
return 1;
return 0;
}
@@ -508,7 +506,6 @@ static int hostap_cs_probe(struct pcmcia_device *p_dev)
PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info);
p_dev->conf.IntType = INT_MEMORY_AND_IO;
- p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
ret = prism2_config(p_dev);
if (ret) {
PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n");
@@ -522,9 +519,7 @@ static void prism2_detach(struct pcmcia_device *link)
{
PDEBUG(DEBUG_FLOW, "prism2_detach\n");
- if (link->state & DEV_CONFIG) {
- prism2_release((u_long)link);
- }
+ prism2_release((u_long)link);
/* release net devices */
if (link->priv) {
@@ -746,9 +741,6 @@ static int prism2_config(struct pcmcia_device *link)
link->io.BasePort2+link->io.NumPorts2-1);
printk("\n");
- link->state |= DEV_CONFIG;
- link->state &= ~DEV_CONFIG_PENDING;
-
local->shutdown = 0;
sandisk_enable_wireless(dev);
@@ -784,8 +776,7 @@ static void prism2_release(u_long arg)
struct hostap_interface *iface;
iface = netdev_priv(dev);
- if (link->state & DEV_CONFIG)
- prism2_hw_shutdown(dev, 0);
+ prism2_hw_shutdown(dev, 0);
iface->local->shutdown = 1;
}
@@ -797,19 +788,19 @@ static int hostap_cs_suspend(struct pcmcia_device *link)
{
struct net_device *dev = (struct net_device *) link->priv;
int dev_open = 0;
+ struct hostap_interface *iface = NULL;
- PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info);
+ if (dev)
+ iface = netdev_priv(dev);
- if (link->state & DEV_CONFIG) {
- struct hostap_interface *iface = netdev_priv(dev);
- if (iface && iface->local)
- dev_open = iface->local->num_dev_open > 0;
- if (dev_open) {
- netif_stop_queue(dev);
- netif_device_detach(dev);
- }
- prism2_suspend(dev);
+ PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info);
+ if (iface && iface->local)
+ dev_open = iface->local->num_dev_open > 0;
+ if (dev_open) {
+ netif_stop_queue(dev);
+ netif_device_detach(dev);
}
+ prism2_suspend(dev);
return 0;
}
@@ -818,20 +809,21 @@ static int hostap_cs_resume(struct pcmcia_device *link)
{
struct net_device *dev = (struct net_device *) link->priv;
int dev_open = 0;
+ struct hostap_interface *iface = NULL;
+
+ if (dev)
+ iface = netdev_priv(dev);
PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_RESUME\n", dev_info);
- if (link->state & DEV_CONFIG) {
- struct hostap_interface *iface = netdev_priv(dev);
- if (iface && iface->local)
- dev_open = iface->local->num_dev_open > 0;
+ if (iface && iface->local)
+ dev_open = iface->local->num_dev_open > 0;
- prism2_hw_shutdown(dev, 1);
- prism2_hw_config(dev, dev_open ? 0 : 1);
- if (dev_open) {
- netif_device_attach(dev);
- netif_start_queue(dev);
- }
+ prism2_hw_shutdown(dev, 1);
+ prism2_hw_config(dev, dev_open ? 0 : 1);
+ if (dev_open) {
+ netif_device_attach(dev);
+ netif_start_queue(dev);
}
return 0;
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index 2689f3bbc88..fbc8595cde3 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -428,7 +428,6 @@ static int netwave_probe(struct pcmcia_device *link)
dev->stop = &netwave_close;
link->irq.Instance = dev;
- link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return netwave_pcmcia_config( link);
} /* netwave_attach */
@@ -446,8 +445,7 @@ static void netwave_detach(struct pcmcia_device *link)
DEBUG(0, "netwave_detach(0x%p)\n", link);
- if (link->state & DEV_CONFIG)
- netwave_release(link);
+ netwave_release(link);
if (link->dev_node)
unregister_netdev(dev);
@@ -763,9 +761,6 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
- /* Configure card */
- link->state |= DEV_CONFIG;
-
/*
* Try allocating IO ports. This tries a few fixed addresses.
* If you want, you can also read the card's config table to
@@ -823,7 +818,6 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
strcpy(priv->node.dev_name, dev->name);
link->dev_node = &priv->node;
- link->state &= ~DEV_CONFIG_PENDING;
/* Reset card before reading physical address */
netwave_doreset(dev->base_addr, ramBase);
@@ -875,7 +869,7 @@ static int netwave_suspend(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
- if ((link->state & DEV_CONFIG) && (link->open))
+ if (link->open)
netif_device_detach(dev);
return 0;
@@ -885,7 +879,7 @@ static int netwave_resume(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
- if ((link->state & DEV_CONFIG) && (link->open)) {
+ if (link->open) {
netwave_reset(dev);
netif_device_attach(dev);
}
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 0e92bee16c9..434f7d7ad84 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -134,7 +134,6 @@ orinoco_cs_probe(struct pcmcia_device *link)
link->conf.Attributes = 0;
link->conf.IntType = INT_MEMORY_AND_IO;
- link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return orinoco_cs_config(link);
} /* orinoco_cs_attach */
@@ -148,8 +147,7 @@ static void orinoco_cs_detach(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
- if (link->state & DEV_CONFIG)
- orinoco_cs_release(link);
+ orinoco_cs_release(link);
DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node);
if (link->dev_node) {
@@ -202,9 +200,6 @@ orinoco_cs_config(struct pcmcia_device *link)
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
- /* Configure card */
- link->state |= DEV_CONFIG;
-
/* Look up the current Vcc */
CS_CHECK(GetConfigurationInfo,
pcmcia_get_configuration_info(link, &conf));
@@ -358,7 +353,6 @@ orinoco_cs_config(struct pcmcia_device *link)
link->dev_node = &card->node; /* link->dev_node being non-NULL is also
used to indicate that the
net_device has been registered */
- link->state &= ~DEV_CONFIG_PENDING;
/* Finally, report what we've done */
printk(KERN_DEBUG "%s: index 0x%02x: ",
@@ -416,23 +410,21 @@ static int orinoco_cs_suspend(struct pcmcia_device *link)
int err = 0;
unsigned long flags;
- if (link->state & DEV_CONFIG) {
- /* This is probably racy, but I can't think of
- a better way, short of rewriting the PCMCIA
- layer to not suck :-( */
- if (! test_bit(0, &card->hard_reset_in_progress)) {
- spin_lock_irqsave(&priv->lock, flags);
+ /* This is probably racy, but I can't think of
+ a better way, short of rewriting the PCMCIA
+ layer to not suck :-( */
+ if (! test_bit(0, &card->hard_reset_in_progress)) {
+ spin_lock_irqsave(&priv->lock, flags);
- err = __orinoco_down(dev);
- if (err)
- printk(KERN_WARNING "%s: Error %d downing interface\n",
- dev->name, err);
+ err = __orinoco_down(dev);
+ if (err)
+ printk(KERN_WARNING "%s: Error %d downing interface\n",
+ dev->name, err);
- netif_device_detach(dev);
- priv->hw_unavailable++;
+ netif_device_detach(dev);
+ priv->hw_unavailable++;
- spin_unlock_irqrestore(&priv->lock, flags);
- }
+ spin_unlock_irqrestore(&priv->lock, flags);
}
return 0;
@@ -446,29 +438,27 @@ static int orinoco_cs_resume(struct pcmcia_device *link)
int err = 0;
unsigned long flags;
- if (link->state & DEV_CONFIG) {
- if (! test_bit(0, &card->hard_reset_in_progress)) {
- err = orinoco_reinit_firmware(dev);
- if (err) {
- printk(KERN_ERR "%s: Error %d re-initializing firmware\n",
- dev->name, err);
- return -EIO;
- }
-
- spin_lock_irqsave(&priv->lock, flags);
+ if (! test_bit(0, &card->hard_reset_in_progress)) {
+ err = orinoco_reinit_firmware(dev);
+ if (err) {
+ printk(KERN_ERR "%s: Error %d re-initializing firmware\n",
+ dev->name, err);
+ return -EIO;
+ }
- netif_device_attach(dev);
- priv->hw_unavailable--;
+ spin_lock_irqsave(&priv->lock, flags);
- if (priv->open && ! priv->hw_unavailable) {
- err = __orinoco_up(dev);
- if (err)
- printk(KERN_ERR "%s: Error %d restarting card\n",
- dev->name, err);
- }
+ netif_device_attach(dev);
+ priv->hw_unavailable--;
- spin_unlock_irqrestore(&priv->lock, flags);
+ if (priv->open && ! priv->hw_unavailable) {
+ err = __orinoco_up(dev);
+ if (err)
+ printk(KERN_ERR "%s: Error %d restarting card\n",
+ dev->name, err);
}
+
+ spin_unlock_irqrestore(&priv->lock, flags);
}
return 0;
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index e3924339fab..85712ffb842 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -366,7 +366,6 @@ static int ray_probe(struct pcmcia_device *p_dev)
init_timer(&local->timer);
- p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
this_device = p_dev;
return ray_config(p_dev);
@@ -389,12 +388,10 @@ static void ray_detach(struct pcmcia_device *link)
this_device = NULL;
dev = link->priv;
- if (link->state & DEV_CONFIG) {
- ray_release(link);
+ ray_release(link);
- local = (ray_dev_t *)dev->priv;
- del_timer(&local->timer);
- }
+ local = (ray_dev_t *)dev->priv;
+ del_timer(&local->timer);
if (link->priv) {
if (link->dev_node) unregister_netdev(dev);
@@ -448,9 +445,6 @@ static int ray_config(struct pcmcia_device *link)
if (buf[i] == 0) buf[i] = ' ';
printk(KERN_INFO "ray_cs Detected: %s\n",buf);
- /* Configure card */
- link->state |= DEV_CONFIG;
-
/* Now allocate an interrupt line. Note that this does not
actually assign a handler to the interrupt.
*/
@@ -511,7 +505,6 @@ static int ray_config(struct pcmcia_device *link)
strcpy(local->node.dev_name, dev->name);
link->dev_node = &local->node;
- link->state &= ~DEV_CONFIG_PENDING;
printk(KERN_INFO "%s: RayLink, irq %d, hw_addr ",
dev->name, dev->irq);
for (i = 0; i < 6; i++)
@@ -552,7 +545,7 @@ static int ray_init(struct net_device *dev)
ray_dev_t *local = (ray_dev_t *)dev->priv;
struct pcmcia_device *link = local->finder;
DEBUG(1, "ray_init(0x%p)\n", dev);
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(0,"ray_init - device not present\n");
return -1;
}
@@ -615,7 +608,7 @@ static int dl_startup_params(struct net_device *dev)
struct pcmcia_device *link = local->finder;
DEBUG(1,"dl_startup_params entered\n");
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_cs dl_startup_params - device not present\n");
return -1;
}
@@ -721,7 +714,7 @@ static void verify_dl_startup(u_long data)
UCHAR status;
struct pcmcia_device *link = local->finder;
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_cs verify_dl_startup - device not present\n");
return;
}
@@ -760,7 +753,7 @@ static void start_net(u_long data)
struct ccs __iomem *pccs;
int ccsindex;
struct pcmcia_device *link = local->finder;
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_cs start_net - device not present\n");
return;
}
@@ -788,7 +781,7 @@ static void join_net(u_long data)
int ccsindex;
struct pcmcia_device *link = local->finder;
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_cs join_net - device not present\n");
return;
}
@@ -839,7 +832,7 @@ static int ray_suspend(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
- if ((link->state & DEV_CONFIG) && (link->open))
+ if (link->open)
netif_device_detach(dev);
return 0;
@@ -849,7 +842,7 @@ static int ray_resume(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
- if ((link->state & DEV_CONFIG) && (link->open)) {
+ if (link->open) {
ray_reset(dev);
netif_device_attach(dev);
}
@@ -867,7 +860,7 @@ int ray_dev_init(struct net_device *dev)
struct pcmcia_device *link = local->finder;
DEBUG(1,"ray_dev_init(dev=%p)\n",dev);
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_dev_init - device not present\n");
return -1;
}
@@ -901,7 +894,7 @@ static int ray_dev_config(struct net_device *dev, struct ifmap *map)
struct pcmcia_device *link = local->finder;
/* Dummy routine to satisfy device structure */
DEBUG(1,"ray_dev_config(dev=%p,ifmap=%p)\n",dev,map);
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_dev_config - device not present\n");
return -1;
}
@@ -915,7 +908,7 @@ static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev)
struct pcmcia_device *link = local->finder;
short length = skb->len;
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_dev_start_xmit - device not present\n");
return -1;
}
@@ -1542,7 +1535,7 @@ static iw_stats * ray_get_wireless_stats(struct net_device * dev)
}
#endif /* WIRELESS_SPY */
- if((link->state & DEV_PRESENT)) {
+ if(pcmcia_dev_present(link)) {
local->wstats.qual.noise = readb(&p->rxnoise);
local->wstats.qual.updated |= 4;
}
@@ -1674,7 +1667,7 @@ static int interrupt_ecf(ray_dev_t *local, int ccs)
int i = 50;
struct pcmcia_device *link = local->finder;
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_cs interrupt_ecf - device not present\n");
return -1;
}
@@ -1701,7 +1694,7 @@ static int get_free_tx_ccs(ray_dev_t *local)
struct ccs __iomem *pccs = ccs_base(local);
struct pcmcia_device *link = local->finder;
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_cs get_free_tx_ccs - device not present\n");
return ECARDGONE;
}
@@ -1732,7 +1725,7 @@ static int get_free_ccs(ray_dev_t *local)
struct ccs __iomem *pccs = ccs_base(local);
struct pcmcia_device *link = local->finder;
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_cs get_free_ccs - device not present\n");
return ECARDGONE;
}
@@ -1807,7 +1800,7 @@ static struct net_device_stats *ray_get_stats(struct net_device *dev)
ray_dev_t *local = (ray_dev_t *)dev->priv;
struct pcmcia_device *link = local->finder;
struct status __iomem *p = local->sram + STATUS_BASE;
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_cs net_device_stats - device not present\n");
return &local->stats;
}
@@ -1840,7 +1833,7 @@ static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, i
int i;
struct ccs __iomem *pccs;
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_update_parm - device not present\n");
return;
}
@@ -1875,7 +1868,7 @@ static void ray_update_multi_list(struct net_device *dev, int all)
struct pcmcia_device *link = local->finder;
void __iomem *p = local->sram + HOST_TO_ECF_BASE;
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_update_multi_list - device not present\n");
return;
}
@@ -1968,7 +1961,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id, struct pt_regs * regs)
local = (ray_dev_t *)dev->priv;
link = (struct pcmcia_device *)local->finder;
- if ( ! (link->state & DEV_PRESENT) || link->suspended ) {
+ if (!(pcmcia_dev_present(link)) || link->suspended ) {
DEBUG(2,"ray_cs interrupt from device not present or suspended.\n");
return IRQ_NONE;
}
@@ -2489,7 +2482,7 @@ static void authenticate(ray_dev_t *local)
{
struct pcmcia_device *link = local->finder;
DEBUG(0,"ray_cs Starting authentication.\n");
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_cs authenticate - device not present\n");
return;
}
@@ -2556,7 +2549,7 @@ static void associate(ray_dev_t *local)
struct pcmcia_device *link = local->finder;
struct net_device *dev = link->priv;
int ccsindex;
- if (!(link->state & DEV_PRESENT)) {
+ if (!(pcmcia_dev_present(link))) {
DEBUG(2,"ray_cs associate - device not present\n");
return;
}
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c
index 118b2c6e5a2..f7b77ce54d7 100644
--- a/drivers/net/wireless/spectrum_cs.c
+++ b/drivers/net/wireless/spectrum_cs.c
@@ -245,7 +245,7 @@ spectrum_reset(struct pcmcia_device *link, int idle)
u_int save_cor;
/* Doing it if hardware is gone is guaranteed crash */
- if (!(link->state & DEV_CONFIG))
+ if (pcmcia_dev_present(link))
return -ENODEV;
/* Save original COR value */
@@ -613,7 +613,6 @@ spectrum_cs_probe(struct pcmcia_device *link)
link->conf.Attributes = 0;
link->conf.IntType = INT_MEMORY_AND_IO;
- link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return spectrum_cs_config(link);
} /* spectrum_cs_attach */
@@ -627,8 +626,7 @@ static void spectrum_cs_detach(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
- if (link->state & DEV_CONFIG)
- spectrum_cs_release(link);
+ spectrum_cs_release(link);
DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node);
if (link->dev_node) {
@@ -677,9 +675,6 @@ spectrum_cs_config(struct pcmcia_device *link)
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
- /* Configure card */
- link->state |= DEV_CONFIG;
-
/* Look up the current Vcc */
CS_CHECK(GetConfigurationInfo,
pcmcia_get_configuration_info(link, &conf));
@@ -838,7 +833,6 @@ spectrum_cs_config(struct pcmcia_device *link)
link->dev_node = &card->node; /* link->dev_node being non-NULL is also
used to indicate that the
net_device has been registered */
- link->state &= ~DEV_CONFIG_PENDING;
/* Finally, report what we've done */
printk(KERN_DEBUG "%s: index 0x%02x: ",
@@ -898,19 +892,17 @@ spectrum_cs_suspend(struct pcmcia_device *link)
int err = 0;
/* Mark the device as stopped, to block IO until later */
- if (link->state & DEV_CONFIG) {
- spin_lock_irqsave(&priv->lock, flags);
+ spin_lock_irqsave(&priv->lock, flags);
- err = __orinoco_down(dev);
- if (err)
- printk(KERN_WARNING "%s: Error %d downing interface\n",
- dev->name, err);
+ err = __orinoco_down(dev);
+ if (err)
+ printk(KERN_WARNING "%s: Error %d downing interface\n",
+ dev->name, err);
- netif_device_detach(dev);
- priv->hw_unavailable++;
+ netif_device_detach(dev);
+ priv->hw_unavailable++;
- spin_unlock_irqrestore(&priv->lock, flags);
- }
+ spin_unlock_irqrestore(&priv->lock, flags);
return 0;
}
@@ -921,11 +913,10 @@ spectrum_cs_resume(struct pcmcia_device *link)
struct net_device *dev = link->priv;
struct orinoco_private *priv = netdev_priv(dev);
- if (link->state & DEV_CONFIG) {
- netif_device_attach(dev);
- priv->hw_unavailable--;
- schedule_work(&priv->reset_work);
- }
+ netif_device_attach(dev);
+ priv->hw_unavailable--;
+ schedule_work(&priv->reset_work);
+
return 0;
}
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 6b676965477..f7724eb2fa7 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -3983,12 +3983,9 @@ wv_pcmcia_config(struct pcmcia_device * link)
if(i != CS_SUCCESS)
{
cs_error(link, ParseTuple, i);
- link->state &= ~DEV_CONFIG_PENDING;
return FALSE;
}
-
- /* Configure card */
- link->state |= DEV_CONFIG;
+
do
{
i = pcmcia_request_io(link, &link->io);
@@ -4071,7 +4068,6 @@ wv_pcmcia_config(struct pcmcia_device * link)
}
while(0); /* Humm... Disguised goto !!! */
- link->state &= ~DEV_CONFIG_PENDING;
/* If any step failed, release any partially configured state */
if(i != 0)
{
@@ -4651,7 +4647,6 @@ wavelan_probe(struct pcmcia_device *p_dev)
/* Other specific data */
dev->mtu = WAVELAN_MTU;
- p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
ret = wv_pcmcia_config(p_dev);
if (ret)
return ret;
@@ -4686,17 +4681,8 @@ wavelan_detach(struct pcmcia_device *link)
printk(KERN_DEBUG "-> wavelan_detach(0x%p)\n", link);
#endif
- /*
- * If the device is currently configured and active, we won't
- * actually delete it yet. Instead, it is marked so that when the
- * release() function is called, that will trigger a proper
- * detach().
- */
- if(link->state & DEV_CONFIG)
- {
- /* Some others haven't done their job : give them another chance */
- wv_pcmcia_release(link);
- }
+ /* Some others haven't done their job : give them another chance */
+ wv_pcmcia_release(link);
/* Free pieces */
if(link->priv)
@@ -4731,7 +4717,7 @@ static int wavelan_suspend(struct pcmcia_device *link)
/* Stop receiving new messages and wait end of transmission */
wv_ru_stop(dev);
- if ((link->state & DEV_CONFIG) && (link->open))
+ if (link->open)
netif_device_detach(dev);
/* Power down the module */
@@ -4744,7 +4730,7 @@ static int wavelan_resume(struct pcmcia_device *link)
{
struct net_device * dev = (struct net_device *) link->priv;
- if ((link->state & DEV_CONFIG) && (link->open)) {
+ if (link->open) {
wv_hw_reset(dev);
netif_device_attach(dev);
}
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index 6b3a605897b..b6578059de3 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -1485,13 +1485,11 @@ static void wl3501_detach(struct pcmcia_device *link)
* delete it yet. Instead, it is marked so that when the release()
* function is called, that will trigger a proper detach(). */
- if (link->state & DEV_CONFIG) {
- while (link->open > 0)
- wl3501_close(dev);
+ while (link->open > 0)
+ wl3501_close(dev);
- netif_device_detach(dev);
- wl3501_release(link);
- }
+ netif_device_detach(dev);
+ wl3501_release(link);
if (link->priv)
free_netdev(link->priv);
@@ -1959,7 +1957,6 @@ static int wl3501_probe(struct pcmcia_device *p_dev)
netif_stop_queue(dev);
p_dev->priv = p_dev->irq.Instance = dev;
- p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return wl3501_config(p_dev);
out_link:
return -ENOMEM;
@@ -1997,9 +1994,6 @@ static int wl3501_config(struct pcmcia_device *link)
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
- /* Configure card */
- link->state |= DEV_CONFIG;
-
/* Try allocating IO ports. This tries a few fixed addresses. If you
* want, you can also read the card's config table to pick addresses --
* see the serial driver for an example. */
@@ -2044,7 +2038,6 @@ static int wl3501_config(struct pcmcia_device *link)
* arranged in a linked list at link->dev_node.
*/
link->dev_node = &this->node;
- link->state &= ~DEV_CONFIG_PENDING;
this->base_addr = dev->base_addr;
@@ -2113,7 +2106,7 @@ static int wl3501_suspend(struct pcmcia_device *link)
struct net_device *dev = link->priv;
wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND);
- if ((link->state & DEV_CONFIG) && (link->open))
+ if (link->open)
netif_device_detach(dev);
return 0;
@@ -2124,7 +2117,7 @@ static int wl3501_resume(struct pcmcia_device *link)
struct net_device *dev = link->priv;
wl3501_pwr_mgmt(dev->priv, WL3501_RESUME);
- if ((link->state & DEV_CONFIG) && (link->open)) {
+ if (link->open) {
wl3501_reset(dev);
netif_device_attach(dev);
}