aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl3501_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-01 18:09:29 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:26:33 -0500
commite2d4096365e06b9a3799afbadc28b4519c0b3526 (patch)
tree90ec691d71f9c0309048714e359b8ba351b533f7 /drivers/net/wireless/wl3501_cs.c
parentf6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b (diff)
[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/wl3501_cs.c')
-rw-r--r--drivers/net/wireless/wl3501_cs.c19
1 files changed, 6 insertions, 13 deletions
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)
1485 * delete it yet. Instead, it is marked so that when the release() 1485 * delete it yet. Instead, it is marked so that when the release()
1486 * function is called, that will trigger a proper detach(). */ 1486 * function is called, that will trigger a proper detach(). */
1487 1487
1488 if (link->state & DEV_CONFIG) { 1488 while (link->open > 0)
1489 while (link->open > 0) 1489 wl3501_close(dev);
1490 wl3501_close(dev);
1491 1490
1492 netif_device_detach(dev); 1491 netif_device_detach(dev);
1493 wl3501_release(link); 1492 wl3501_release(link);
1494 }
1495 1493
1496 if (link->priv) 1494 if (link->priv)
1497 free_netdev(link->priv); 1495 free_netdev(link->priv);
@@ -1959,7 +1957,6 @@ static int wl3501_probe(struct pcmcia_device *p_dev)
1959 netif_stop_queue(dev); 1957 netif_stop_queue(dev);
1960 p_dev->priv = p_dev->irq.Instance = dev; 1958 p_dev->priv = p_dev->irq.Instance = dev;
1961 1959
1962 p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1963 return wl3501_config(p_dev); 1960 return wl3501_config(p_dev);
1964out_link: 1961out_link:
1965 return -ENOMEM; 1962 return -ENOMEM;
@@ -1997,9 +1994,6 @@ static int wl3501_config(struct pcmcia_device *link)
1997 link->conf.ConfigBase = parse.config.base; 1994 link->conf.ConfigBase = parse.config.base;
1998 link->conf.Present = parse.config.rmask[0]; 1995 link->conf.Present = parse.config.rmask[0];
1999 1996
2000 /* Configure card */
2001 link->state |= DEV_CONFIG;
2002
2003 /* Try allocating IO ports. This tries a few fixed addresses. If you 1997 /* Try allocating IO ports. This tries a few fixed addresses. If you
2004 * want, you can also read the card's config table to pick addresses -- 1998 * want, you can also read the card's config table to pick addresses --
2005 * see the serial driver for an example. */ 1999 * see the serial driver for an example. */
@@ -2044,7 +2038,6 @@ static int wl3501_config(struct pcmcia_device *link)
2044 * arranged in a linked list at link->dev_node. 2038 * arranged in a linked list at link->dev_node.
2045 */ 2039 */
2046 link->dev_node = &this->node; 2040 link->dev_node = &this->node;
2047 link->state &= ~DEV_CONFIG_PENDING;
2048 2041
2049 this->base_addr = dev->base_addr; 2042 this->base_addr = dev->base_addr;
2050 2043
@@ -2113,7 +2106,7 @@ static int wl3501_suspend(struct pcmcia_device *link)
2113 struct net_device *dev = link->priv; 2106 struct net_device *dev = link->priv;
2114 2107
2115 wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND); 2108 wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND);
2116 if ((link->state & DEV_CONFIG) && (link->open)) 2109 if (link->open)
2117 netif_device_detach(dev); 2110 netif_device_detach(dev);
2118 2111
2119 return 0; 2112 return 0;
@@ -2124,7 +2117,7 @@ static int wl3501_resume(struct pcmcia_device *link)
2124 struct net_device *dev = link->priv; 2117 struct net_device *dev = link->priv;
2125 2118
2126 wl3501_pwr_mgmt(dev->priv, WL3501_RESUME); 2119 wl3501_pwr_mgmt(dev->priv, WL3501_RESUME);
2127 if ((link->state & DEV_CONFIG) && (link->open)) { 2120 if (link->open) {
2128 wl3501_reset(dev); 2121 wl3501_reset(dev);
2129 netif_device_attach(dev); 2122 netif_device_attach(dev);
2130 } 2123 }