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/xirc2ps_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/xirc2ps_cs.c')
-rw-r--r-- | drivers/net/pcmcia/xirc2ps_cs.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 77bf4e3a6139..0141c5037f41 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -591,7 +591,6 @@ xirc2ps_probe(struct pcmcia_device *link) | |||
591 | dev->watchdog_timeo = TX_TIMEOUT; | 591 | dev->watchdog_timeo = TX_TIMEOUT; |
592 | #endif | 592 | #endif |
593 | 593 | ||
594 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
595 | return xirc2ps_config(link); | 594 | return xirc2ps_config(link); |
596 | } /* xirc2ps_attach */ | 595 | } /* xirc2ps_attach */ |
597 | 596 | ||
@@ -612,8 +611,7 @@ xirc2ps_detach(struct pcmcia_device *link) | |||
612 | if (link->dev_node) | 611 | if (link->dev_node) |
613 | unregister_netdev(dev); | 612 | unregister_netdev(dev); |
614 | 613 | ||
615 | if (link->state & DEV_CONFIG) | 614 | xirc2ps_release(link); |
616 | xirc2ps_release(link); | ||
617 | 615 | ||
618 | free_netdev(dev); | 616 | free_netdev(dev); |
619 | } /* xirc2ps_detach */ | 617 | } /* xirc2ps_detach */ |
@@ -843,9 +841,6 @@ xirc2ps_config(struct pcmcia_device * link) | |||
843 | for (i=0; i < 6; i++) | 841 | for (i=0; i < 6; i++) |
844 | dev->dev_addr[i] = node_id->id[i]; | 842 | dev->dev_addr[i] = node_id->id[i]; |
845 | 843 | ||
846 | /* Configure card */ | ||
847 | link->state |= DEV_CONFIG; | ||
848 | |||
849 | link->io.IOAddrLines =10; | 844 | link->io.IOAddrLines =10; |
850 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 845 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
851 | link->irq.Attributes = IRQ_HANDLE_PRESENT; | 846 | link->irq.Attributes = IRQ_HANDLE_PRESENT; |
@@ -1041,7 +1036,6 @@ xirc2ps_config(struct pcmcia_device * link) | |||
1041 | do_reset(dev, 1); /* a kludge to make the cem56 work */ | 1036 | do_reset(dev, 1); /* a kludge to make the cem56 work */ |
1042 | 1037 | ||
1043 | link->dev_node = &local->node; | 1038 | link->dev_node = &local->node; |
1044 | link->state &= ~DEV_CONFIG_PENDING; | ||
1045 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 1039 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
1046 | 1040 | ||
1047 | if ((err=register_netdev(dev))) { | 1041 | if ((err=register_netdev(dev))) { |
@@ -1062,14 +1056,12 @@ xirc2ps_config(struct pcmcia_device * link) | |||
1062 | return 0; | 1056 | return 0; |
1063 | 1057 | ||
1064 | config_error: | 1058 | config_error: |
1065 | link->state &= ~DEV_CONFIG_PENDING; | ||
1066 | xirc2ps_release(link); | 1059 | xirc2ps_release(link); |
1067 | return -ENODEV; | 1060 | return -ENODEV; |
1068 | 1061 | ||
1069 | cis_error: | 1062 | cis_error: |
1070 | printk(KNOT_XIRC "unable to parse CIS\n"); | 1063 | printk(KNOT_XIRC "unable to parse CIS\n"); |
1071 | failure: | 1064 | failure: |
1072 | link->state &= ~DEV_CONFIG_PENDING; | ||
1073 | return -ENODEV; | 1065 | return -ENODEV; |
1074 | } /* xirc2ps_config */ | 1066 | } /* xirc2ps_config */ |
1075 | 1067 | ||
@@ -1099,9 +1091,9 @@ static int xirc2ps_suspend(struct pcmcia_device *link) | |||
1099 | { | 1091 | { |
1100 | struct net_device *dev = link->priv; | 1092 | struct net_device *dev = link->priv; |
1101 | 1093 | ||
1102 | if ((link->state & DEV_CONFIG) && (link->open)) { | 1094 | if (link->open) { |
1103 | netif_device_detach(dev); | 1095 | netif_device_detach(dev); |
1104 | do_powerdown(dev); | 1096 | do_powerdown(dev); |
1105 | } | 1097 | } |
1106 | 1098 | ||
1107 | return 0; | 1099 | return 0; |
@@ -1111,7 +1103,7 @@ static int xirc2ps_resume(struct pcmcia_device *link) | |||
1111 | { | 1103 | { |
1112 | struct net_device *dev = link->priv; | 1104 | struct net_device *dev = link->priv; |
1113 | 1105 | ||
1114 | if ((link->state & DEV_CONFIG) && (link->open)) { | 1106 | if (link->open) { |
1115 | do_reset(dev,1); | 1107 | do_reset(dev,1); |
1116 | netif_device_attach(dev); | 1108 | netif_device_attach(dev); |
1117 | } | 1109 | } |