aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/spectrum_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/spectrum_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/spectrum_cs.c')
-rw-r--r--drivers/net/wireless/spectrum_cs.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c
index 118b2c6e5a29..f7b77ce54d7b 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)
245 u_int save_cor; 245 u_int save_cor;
246 246
247 /* Doing it if hardware is gone is guaranteed crash */ 247 /* Doing it if hardware is gone is guaranteed crash */
248 if (!(link->state & DEV_CONFIG)) 248 if (pcmcia_dev_present(link))
249 return -ENODEV; 249 return -ENODEV;
250 250
251 /* Save original COR value */ 251 /* Save original COR value */
@@ -613,7 +613,6 @@ spectrum_cs_probe(struct pcmcia_device *link)
613 link->conf.Attributes = 0; 613 link->conf.Attributes = 0;
614 link->conf.IntType = INT_MEMORY_AND_IO; 614 link->conf.IntType = INT_MEMORY_AND_IO;
615 615
616 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
617 return spectrum_cs_config(link); 616 return spectrum_cs_config(link);
618} /* spectrum_cs_attach */ 617} /* spectrum_cs_attach */
619 618
@@ -627,8 +626,7 @@ static void spectrum_cs_detach(struct pcmcia_device *link)
627{ 626{
628 struct net_device *dev = link->priv; 627 struct net_device *dev = link->priv;
629 628
630 if (link->state & DEV_CONFIG) 629 spectrum_cs_release(link);
631 spectrum_cs_release(link);
632 630
633 DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node); 631 DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node);
634 if (link->dev_node) { 632 if (link->dev_node) {
@@ -677,9 +675,6 @@ spectrum_cs_config(struct pcmcia_device *link)
677 link->conf.ConfigBase = parse.config.base; 675 link->conf.ConfigBase = parse.config.base;
678 link->conf.Present = parse.config.rmask[0]; 676 link->conf.Present = parse.config.rmask[0];
679 677
680 /* Configure card */
681 link->state |= DEV_CONFIG;
682
683 /* Look up the current Vcc */ 678 /* Look up the current Vcc */
684 CS_CHECK(GetConfigurationInfo, 679 CS_CHECK(GetConfigurationInfo,
685 pcmcia_get_configuration_info(link, &conf)); 680 pcmcia_get_configuration_info(link, &conf));
@@ -838,7 +833,6 @@ spectrum_cs_config(struct pcmcia_device *link)
838 link->dev_node = &card->node; /* link->dev_node being non-NULL is also 833 link->dev_node = &card->node; /* link->dev_node being non-NULL is also
839 used to indicate that the 834 used to indicate that the
840 net_device has been registered */ 835 net_device has been registered */
841 link->state &= ~DEV_CONFIG_PENDING;
842 836
843 /* Finally, report what we've done */ 837 /* Finally, report what we've done */
844 printk(KERN_DEBUG "%s: index 0x%02x: ", 838 printk(KERN_DEBUG "%s: index 0x%02x: ",
@@ -898,19 +892,17 @@ spectrum_cs_suspend(struct pcmcia_device *link)
898 int err = 0; 892 int err = 0;
899 893
900 /* Mark the device as stopped, to block IO until later */ 894 /* Mark the device as stopped, to block IO until later */
901 if (link->state & DEV_CONFIG) { 895 spin_lock_irqsave(&priv->lock, flags);
902 spin_lock_irqsave(&priv->lock, flags);
903 896
904 err = __orinoco_down(dev); 897 err = __orinoco_down(dev);
905 if (err) 898 if (err)
906 printk(KERN_WARNING "%s: Error %d downing interface\n", 899 printk(KERN_WARNING "%s: Error %d downing interface\n",
907 dev->name, err); 900 dev->name, err);
908 901
909 netif_device_detach(dev); 902 netif_device_detach(dev);
910 priv->hw_unavailable++; 903 priv->hw_unavailable++;
911 904
912 spin_unlock_irqrestore(&priv->lock, flags); 905 spin_unlock_irqrestore(&priv->lock, flags);
913 }
914 906
915 return 0; 907 return 0;
916} 908}
@@ -921,11 +913,10 @@ spectrum_cs_resume(struct pcmcia_device *link)
921 struct net_device *dev = link->priv; 913 struct net_device *dev = link->priv;
922 struct orinoco_private *priv = netdev_priv(dev); 914 struct orinoco_private *priv = netdev_priv(dev);
923 915
924 if (link->state & DEV_CONFIG) { 916 netif_device_attach(dev);
925 netif_device_attach(dev); 917 priv->hw_unavailable--;
926 priv->hw_unavailable--; 918 schedule_work(&priv->reset_work);
927 schedule_work(&priv->reset_work); 919
928 }
929 return 0; 920 return 0;
930} 921}
931 922