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/nmclan_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/nmclan_cs.c')
-rw-r--r-- | drivers/net/pcmcia/nmclan_cs.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index ea8a62e629a4..fd191143cb2f 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -487,7 +487,6 @@ static int nmclan_probe(struct pcmcia_device *link) | |||
487 | dev->watchdog_timeo = TX_TIMEOUT; | 487 | dev->watchdog_timeo = TX_TIMEOUT; |
488 | #endif | 488 | #endif |
489 | 489 | ||
490 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
491 | return nmclan_config(link); | 490 | return nmclan_config(link); |
492 | } /* nmclan_attach */ | 491 | } /* nmclan_attach */ |
493 | 492 | ||
@@ -508,8 +507,7 @@ static void nmclan_detach(struct pcmcia_device *link) | |||
508 | if (link->dev_node) | 507 | if (link->dev_node) |
509 | unregister_netdev(dev); | 508 | unregister_netdev(dev); |
510 | 509 | ||
511 | if (link->state & DEV_CONFIG) | 510 | nmclan_release(link); |
512 | nmclan_release(link); | ||
513 | 511 | ||
514 | free_netdev(dev); | 512 | free_netdev(dev); |
515 | } /* nmclan_detach */ | 513 | } /* nmclan_detach */ |
@@ -675,9 +673,6 @@ static int nmclan_config(struct pcmcia_device *link) | |||
675 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 673 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
676 | link->conf.ConfigBase = parse.config.base; | 674 | link->conf.ConfigBase = parse.config.base; |
677 | 675 | ||
678 | /* Configure card */ | ||
679 | link->state |= DEV_CONFIG; | ||
680 | |||
681 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); | 676 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); |
682 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 677 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
683 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 678 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
@@ -707,7 +702,6 @@ static int nmclan_config(struct pcmcia_device *link) | |||
707 | } else { | 702 | } else { |
708 | printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should" | 703 | printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should" |
709 | " be 0x40 0x?9\n", sig[0], sig[1]); | 704 | " be 0x40 0x?9\n", sig[0], sig[1]); |
710 | link->state &= ~DEV_CONFIG_PENDING; | ||
711 | return -ENODEV; | 705 | return -ENODEV; |
712 | } | 706 | } |
713 | } | 707 | } |
@@ -722,7 +716,6 @@ static int nmclan_config(struct pcmcia_device *link) | |||
722 | printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n"); | 716 | printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n"); |
723 | 717 | ||
724 | link->dev_node = &lp->node; | 718 | link->dev_node = &lp->node; |
725 | link->state &= ~DEV_CONFIG_PENDING; | ||
726 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 719 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
727 | 720 | ||
728 | i = register_netdev(dev); | 721 | i = register_netdev(dev); |
@@ -763,7 +756,7 @@ static int nmclan_suspend(struct pcmcia_device *link) | |||
763 | { | 756 | { |
764 | struct net_device *dev = link->priv; | 757 | struct net_device *dev = link->priv; |
765 | 758 | ||
766 | if ((link->state & DEV_CONFIG) && (link->open)) | 759 | if (link->open) |
767 | netif_device_detach(dev); | 760 | netif_device_detach(dev); |
768 | 761 | ||
769 | return 0; | 762 | return 0; |
@@ -773,7 +766,7 @@ static int nmclan_resume(struct pcmcia_device *link) | |||
773 | { | 766 | { |
774 | struct net_device *dev = link->priv; | 767 | struct net_device *dev = link->priv; |
775 | 768 | ||
776 | if ((link->state & DEV_CONFIG) && (link->open)) { | 769 | if (link->open) { |
777 | nmclan_reset(dev); | 770 | nmclan_reset(dev); |
778 | netif_device_attach(dev); | 771 | netif_device_attach(dev); |
779 | } | 772 | } |