diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-01 18:09:29 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:26:33 -0500 |
commit | e2d4096365e06b9a3799afbadc28b4519c0b3526 (patch) | |
tree | 90ec691d71f9c0309048714e359b8ba351b533f7 /drivers/net/wireless/wavelan_cs.c | |
parent | f6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b (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/wavelan_cs.c')
-rw-r--r-- | drivers/net/wireless/wavelan_cs.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 6b6769654777..f7724eb2fa7e 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) | |||
3983 | if(i != CS_SUCCESS) | 3983 | if(i != CS_SUCCESS) |
3984 | { | 3984 | { |
3985 | cs_error(link, ParseTuple, i); | 3985 | cs_error(link, ParseTuple, i); |
3986 | link->state &= ~DEV_CONFIG_PENDING; | ||
3987 | return FALSE; | 3986 | return FALSE; |
3988 | } | 3987 | } |
3989 | 3988 | ||
3990 | /* Configure card */ | ||
3991 | link->state |= DEV_CONFIG; | ||
3992 | do | 3989 | do |
3993 | { | 3990 | { |
3994 | i = pcmcia_request_io(link, &link->io); | 3991 | i = pcmcia_request_io(link, &link->io); |
@@ -4071,7 +4068,6 @@ wv_pcmcia_config(struct pcmcia_device * link) | |||
4071 | } | 4068 | } |
4072 | while(0); /* Humm... Disguised goto !!! */ | 4069 | while(0); /* Humm... Disguised goto !!! */ |
4073 | 4070 | ||
4074 | link->state &= ~DEV_CONFIG_PENDING; | ||
4075 | /* If any step failed, release any partially configured state */ | 4071 | /* If any step failed, release any partially configured state */ |
4076 | if(i != 0) | 4072 | if(i != 0) |
4077 | { | 4073 | { |
@@ -4651,7 +4647,6 @@ wavelan_probe(struct pcmcia_device *p_dev) | |||
4651 | /* Other specific data */ | 4647 | /* Other specific data */ |
4652 | dev->mtu = WAVELAN_MTU; | 4648 | dev->mtu = WAVELAN_MTU; |
4653 | 4649 | ||
4654 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
4655 | ret = wv_pcmcia_config(p_dev); | 4650 | ret = wv_pcmcia_config(p_dev); |
4656 | if (ret) | 4651 | if (ret) |
4657 | return ret; | 4652 | return ret; |
@@ -4686,17 +4681,8 @@ wavelan_detach(struct pcmcia_device *link) | |||
4686 | printk(KERN_DEBUG "-> wavelan_detach(0x%p)\n", link); | 4681 | printk(KERN_DEBUG "-> wavelan_detach(0x%p)\n", link); |
4687 | #endif | 4682 | #endif |
4688 | 4683 | ||
4689 | /* | 4684 | /* Some others haven't done their job : give them another chance */ |
4690 | * If the device is currently configured and active, we won't | 4685 | wv_pcmcia_release(link); |
4691 | * actually delete it yet. Instead, it is marked so that when the | ||
4692 | * release() function is called, that will trigger a proper | ||
4693 | * detach(). | ||
4694 | */ | ||
4695 | if(link->state & DEV_CONFIG) | ||
4696 | { | ||
4697 | /* Some others haven't done their job : give them another chance */ | ||
4698 | wv_pcmcia_release(link); | ||
4699 | } | ||
4700 | 4686 | ||
4701 | /* Free pieces */ | 4687 | /* Free pieces */ |
4702 | if(link->priv) | 4688 | if(link->priv) |
@@ -4731,7 +4717,7 @@ static int wavelan_suspend(struct pcmcia_device *link) | |||
4731 | /* Stop receiving new messages and wait end of transmission */ | 4717 | /* Stop receiving new messages and wait end of transmission */ |
4732 | wv_ru_stop(dev); | 4718 | wv_ru_stop(dev); |
4733 | 4719 | ||
4734 | if ((link->state & DEV_CONFIG) && (link->open)) | 4720 | if (link->open) |
4735 | netif_device_detach(dev); | 4721 | netif_device_detach(dev); |
4736 | 4722 | ||
4737 | /* Power down the module */ | 4723 | /* Power down the module */ |
@@ -4744,7 +4730,7 @@ static int wavelan_resume(struct pcmcia_device *link) | |||
4744 | { | 4730 | { |
4745 | struct net_device * dev = (struct net_device *) link->priv; | 4731 | struct net_device * dev = (struct net_device *) link->priv; |
4746 | 4732 | ||
4747 | if ((link->state & DEV_CONFIG) && (link->open)) { | 4733 | if (link->open) { |
4748 | wv_hw_reset(dev); | 4734 | wv_hw_reset(dev); |
4749 | netif_device_attach(dev); | 4735 | netif_device_attach(dev); |
4750 | } | 4736 | } |