From e2d4096365e06b9a3799afbadc28b4519c0b3526 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Thu, 2 Mar 2006 00:09:29 +0100 Subject: [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 --- drivers/net/wireless/wl3501_cs.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'drivers/net/wireless/wl3501_cs.c') diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 6b3a605897bd..b6578059de34 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); } -- cgit v1.2.3