aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/3c574_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/pcmcia/3c574_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/pcmcia/3c574_cs.c')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 4611469fdff9..70e3cca09787 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -296,7 +296,6 @@ static int tc574_probe(struct pcmcia_device *link)
296 dev->watchdog_timeo = TX_TIMEOUT; 296 dev->watchdog_timeo = TX_TIMEOUT;
297#endif 297#endif
298 298
299 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
300 return tc574_config(link); 299 return tc574_config(link);
301} /* tc574_attach */ 300} /* tc574_attach */
302 301
@@ -318,8 +317,7 @@ static void tc574_detach(struct pcmcia_device *link)
318 if (link->dev_node) 317 if (link->dev_node)
319 unregister_netdev(dev); 318 unregister_netdev(dev);
320 319
321 if (link->state & DEV_CONFIG) 320 tc574_release(link);
322 tc574_release(link);
323 321
324 free_netdev(dev); 322 free_netdev(dev);
325} /* tc574_detach */ 323} /* tc574_detach */
@@ -363,9 +361,6 @@ static int tc574_config(struct pcmcia_device *link)
363 link->conf.ConfigBase = parse.config.base; 361 link->conf.ConfigBase = parse.config.base;
364 link->conf.Present = parse.config.rmask[0]; 362 link->conf.Present = parse.config.rmask[0];
365 363
366 /* Configure card */
367 link->state |= DEV_CONFIG;
368
369 link->io.IOAddrLines = 16; 364 link->io.IOAddrLines = 16;
370 for (i = j = 0; j < 0x400; j += 0x20) { 365 for (i = j = 0; j < 0x400; j += 0x20) {
371 link->io.BasePort1 = j ^ 0x300; 366 link->io.BasePort1 = j ^ 0x300;
@@ -464,7 +459,6 @@ static int tc574_config(struct pcmcia_device *link)
464 } 459 }
465 } 460 }
466 461
467 link->state &= ~DEV_CONFIG_PENDING;
468 link->dev_node = &lp->node; 462 link->dev_node = &lp->node;
469 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 463 SET_NETDEV_DEV(dev, &handle_to_dev(link));
470 464
@@ -509,7 +503,7 @@ static int tc574_suspend(struct pcmcia_device *link)
509{ 503{
510 struct net_device *dev = link->priv; 504 struct net_device *dev = link->priv;
511 505
512 if ((link->state & DEV_CONFIG) && (link->open)) 506 if (link->open)
513 netif_device_detach(dev); 507 netif_device_detach(dev);
514 508
515 return 0; 509 return 0;
@@ -519,7 +513,7 @@ static int tc574_resume(struct pcmcia_device *link)
519{ 513{
520 struct net_device *dev = link->priv; 514 struct net_device *dev = link->priv;
521 515
522 if ((link->state & DEV_CONFIG) && (link->open)) { 516 if (link->open) {
523 tc574_reset(dev); 517 tc574_reset(dev);
524 netif_device_attach(dev); 518 netif_device_attach(dev);
525 } 519 }