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/pcmcia/pcnet_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/pcmcia/pcnet_cs.c')
-rw-r--r-- | drivers/net/pcmcia/pcnet_cs.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index d840c0f03ea9..d9661410f2ff 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -264,7 +264,6 @@ static int pcnet_probe(struct pcmcia_device *link) | |||
264 | dev->stop = &pcnet_close; | 264 | dev->stop = &pcnet_close; |
265 | dev->set_config = &set_config; | 265 | dev->set_config = &set_config; |
266 | 266 | ||
267 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
268 | return pcnet_config(link); | 267 | return pcnet_config(link); |
269 | } /* pcnet_attach */ | 268 | } /* pcnet_attach */ |
270 | 269 | ||
@@ -286,8 +285,7 @@ static void pcnet_detach(struct pcmcia_device *link) | |||
286 | if (link->dev_node) | 285 | if (link->dev_node) |
287 | unregister_netdev(dev); | 286 | unregister_netdev(dev); |
288 | 287 | ||
289 | if (link->state & DEV_CONFIG) | 288 | pcnet_release(link); |
290 | pcnet_release(link); | ||
291 | 289 | ||
292 | free_netdev(dev); | 290 | free_netdev(dev); |
293 | } /* pcnet_detach */ | 291 | } /* pcnet_detach */ |
@@ -538,9 +536,6 @@ static int pcnet_config(struct pcmcia_device *link) | |||
538 | link->conf.ConfigBase = parse.config.base; | 536 | link->conf.ConfigBase = parse.config.base; |
539 | link->conf.Present = parse.config.rmask[0]; | 537 | link->conf.Present = parse.config.rmask[0]; |
540 | 538 | ||
541 | /* Configure card */ | ||
542 | link->state |= DEV_CONFIG; | ||
543 | |||
544 | tuple.DesiredTuple = CISTPL_MANFID; | 539 | tuple.DesiredTuple = CISTPL_MANFID; |
545 | tuple.Attributes = TUPLE_RETURN_COMMON; | 540 | tuple.Attributes = TUPLE_RETURN_COMMON; |
546 | if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && | 541 | if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && |
@@ -667,7 +662,6 @@ static int pcnet_config(struct pcmcia_device *link) | |||
667 | } | 662 | } |
668 | 663 | ||
669 | link->dev_node = &info->node; | 664 | link->dev_node = &info->node; |
670 | link->state &= ~DEV_CONFIG_PENDING; | ||
671 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 665 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
672 | 666 | ||
673 | #ifdef CONFIG_NET_POLL_CONTROLLER | 667 | #ifdef CONFIG_NET_POLL_CONTROLLER |
@@ -705,7 +699,6 @@ cs_failed: | |||
705 | cs_error(link, last_fn, last_ret); | 699 | cs_error(link, last_fn, last_ret); |
706 | failed: | 700 | failed: |
707 | pcnet_release(link); | 701 | pcnet_release(link); |
708 | link->state &= ~DEV_CONFIG_PENDING; | ||
709 | return -ENODEV; | 702 | return -ENODEV; |
710 | } /* pcnet_config */ | 703 | } /* pcnet_config */ |
711 | 704 | ||
@@ -742,7 +735,7 @@ static int pcnet_suspend(struct pcmcia_device *link) | |||
742 | { | 735 | { |
743 | struct net_device *dev = link->priv; | 736 | struct net_device *dev = link->priv; |
744 | 737 | ||
745 | if ((link->state & DEV_CONFIG) && (link->open)) | 738 | if (link->open) |
746 | netif_device_detach(dev); | 739 | netif_device_detach(dev); |
747 | 740 | ||
748 | return 0; | 741 | return 0; |
@@ -752,7 +745,7 @@ static int pcnet_resume(struct pcmcia_device *link) | |||
752 | { | 745 | { |
753 | struct net_device *dev = link->priv; | 746 | struct net_device *dev = link->priv; |
754 | 747 | ||
755 | if ((link->state & DEV_CONFIG) && (link->open)) { | 748 | if (link->open) { |
756 | pcnet_reset_8390(dev); | 749 | pcnet_reset_8390(dev); |
757 | NS8390_init(dev, 1); | 750 | NS8390_init(dev, 1); |
758 | netif_device_attach(dev); | 751 | netif_device_attach(dev); |