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/axnet_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/axnet_cs.c')
-rw-r--r-- | drivers/net/pcmcia/axnet_cs.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index f6ca85d77c7d..0f1219c11853 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -168,7 +168,6 @@ static int axnet_probe(struct pcmcia_device *link) | |||
168 | dev->do_ioctl = &axnet_ioctl; | 168 | dev->do_ioctl = &axnet_ioctl; |
169 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 169 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
170 | 170 | ||
171 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
172 | return axnet_config(link); | 171 | return axnet_config(link); |
173 | } /* axnet_attach */ | 172 | } /* axnet_attach */ |
174 | 173 | ||
@@ -190,8 +189,7 @@ static void axnet_detach(struct pcmcia_device *link) | |||
190 | if (link->dev_node) | 189 | if (link->dev_node) |
191 | unregister_netdev(dev); | 190 | unregister_netdev(dev); |
192 | 191 | ||
193 | if (link->state & DEV_CONFIG) | 192 | axnet_release(link); |
194 | axnet_release(link); | ||
195 | 193 | ||
196 | free_netdev(dev); | 194 | free_netdev(dev); |
197 | } /* axnet_detach */ | 195 | } /* axnet_detach */ |
@@ -309,9 +307,6 @@ static int axnet_config(struct pcmcia_device *link) | |||
309 | /* don't trust the CIS on this; Linksys got it wrong */ | 307 | /* don't trust the CIS on this; Linksys got it wrong */ |
310 | link->conf.Present = 0x63; | 308 | link->conf.Present = 0x63; |
311 | 309 | ||
312 | /* Configure card */ | ||
313 | link->state |= DEV_CONFIG; | ||
314 | |||
315 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 310 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
316 | tuple.Attributes = 0; | 311 | tuple.Attributes = 0; |
317 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 312 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
@@ -402,7 +397,6 @@ static int axnet_config(struct pcmcia_device *link) | |||
402 | 397 | ||
403 | info->phy_id = (i < 32) ? i : -1; | 398 | info->phy_id = (i < 32) ? i : -1; |
404 | link->dev_node = &info->node; | 399 | link->dev_node = &info->node; |
405 | link->state &= ~DEV_CONFIG_PENDING; | ||
406 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 400 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
407 | 401 | ||
408 | if (register_netdev(dev) != 0) { | 402 | if (register_netdev(dev) != 0) { |
@@ -429,7 +423,6 @@ cs_failed: | |||
429 | cs_error(link, last_fn, last_ret); | 423 | cs_error(link, last_fn, last_ret); |
430 | failed: | 424 | failed: |
431 | axnet_release(link); | 425 | axnet_release(link); |
432 | link->state &= ~DEV_CONFIG_PENDING; | ||
433 | return -ENODEV; | 426 | return -ENODEV; |
434 | } /* axnet_config */ | 427 | } /* axnet_config */ |
435 | 428 | ||
@@ -450,8 +443,8 @@ static int axnet_suspend(struct pcmcia_device *link) | |||
450 | { | 443 | { |
451 | struct net_device *dev = link->priv; | 444 | struct net_device *dev = link->priv; |
452 | 445 | ||
453 | if ((link->state & DEV_CONFIG) && (link->open)) | 446 | if (link->open) |
454 | netif_device_detach(dev); | 447 | netif_device_detach(dev); |
455 | 448 | ||
456 | return 0; | 449 | return 0; |
457 | } | 450 | } |
@@ -460,7 +453,7 @@ static int axnet_resume(struct pcmcia_device *link) | |||
460 | { | 453 | { |
461 | struct net_device *dev = link->priv; | 454 | struct net_device *dev = link->priv; |
462 | 455 | ||
463 | if ((link->state & DEV_CONFIG) && (link->open)) { | 456 | if (link->open) { |
464 | axnet_reset_8390(dev); | 457 | axnet_reset_8390(dev); |
465 | AX88190_init(dev, 1); | 458 | AX88190_init(dev, 1); |
466 | netif_device_attach(dev); | 459 | netif_device_attach(dev); |