summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/hostap
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-02 02:09:29 +0300
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 19:26:33 +0400
commite2d4096365e06b9a3799afbadc28b4519c0b3526 (patch)
tree90ec691d71f9c0309048714e359b8ba351b533f7 /drivers/net/wireless/hostap
parentf6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b (diff)
downloadlinux-e2d4096365e06b9a3799afbadc28b4519c0b3526.tar.xz
[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/hostap')
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c56
1 files changed, 24 insertions, 32 deletions
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 88dc383a3da7..a2cb9b0fa3d6 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;