aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/fmvj18x_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/fmvj18x_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/fmvj18x_cs.c')
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index d9c83b290095..7cb20b6b9348 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -272,7 +272,6 @@ static int fmvj18x_probe(struct pcmcia_device *link)
272#endif 272#endif
273 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 273 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
274 274
275 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
276 return fmvj18x_config(link); 275 return fmvj18x_config(link);
277} /* fmvj18x_attach */ 276} /* fmvj18x_attach */
278 277
@@ -287,8 +286,7 @@ static void fmvj18x_detach(struct pcmcia_device *link)
287 if (link->dev_node) 286 if (link->dev_node)
288 unregister_netdev(dev); 287 unregister_netdev(dev);
289 288
290 if (link->state & DEV_CONFIG) 289 fmvj18x_release(link);
291 fmvj18x_release(link);
292 290
293 free_netdev(dev); 291 free_netdev(dev);
294} /* fmvj18x_detach */ 292} /* fmvj18x_detach */
@@ -363,9 +361,6 @@ static int fmvj18x_config(struct pcmcia_device *link)
363 tuple.TupleOffset = 0; 361 tuple.TupleOffset = 0;
364 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); 362 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
365 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); 363 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
366
367 /* Configure card */
368 link->state |= DEV_CONFIG;
369 364
370 link->conf.ConfigBase = parse.config.base; 365 link->conf.ConfigBase = parse.config.base;
371 link->conf.Present = parse.config.rmask[0]; 366 link->conf.Present = parse.config.rmask[0];
@@ -532,7 +527,6 @@ static int fmvj18x_config(struct pcmcia_device *link)
532 527
533 lp->cardtype = cardtype; 528 lp->cardtype = cardtype;
534 link->dev_node = &lp->node; 529 link->dev_node = &lp->node;
535 link->state &= ~DEV_CONFIG_PENDING;
536 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 530 SET_NETDEV_DEV(dev, &handle_to_dev(link));
537 531
538 if (register_netdev(dev) != 0) { 532 if (register_netdev(dev) != 0) {
@@ -557,7 +551,6 @@ cs_failed:
557 cs_error(link, last_fn, last_ret); 551 cs_error(link, last_fn, last_ret);
558failed: 552failed:
559 fmvj18x_release(link); 553 fmvj18x_release(link);
560 link->state &= ~DEV_CONFIG_PENDING;
561 return -ENODEV; 554 return -ENODEV;
562} /* fmvj18x_config */ 555} /* fmvj18x_config */
563/*====================================================================*/ 556/*====================================================================*/
@@ -668,7 +661,7 @@ static int fmvj18x_suspend(struct pcmcia_device *link)
668{ 661{
669 struct net_device *dev = link->priv; 662 struct net_device *dev = link->priv;
670 663
671 if ((link->state & DEV_CONFIG) && (link->open)) 664 if (link->open)
672 netif_device_detach(dev); 665 netif_device_detach(dev);
673 666
674 return 0; 667 return 0;
@@ -678,7 +671,7 @@ static int fmvj18x_resume(struct pcmcia_device *link)
678{ 671{
679 struct net_device *dev = link->priv; 672 struct net_device *dev = link->priv;
680 673
681 if ((link->state & DEV_CONFIG) && (link->open)) { 674 if (link->open) {
682 fjn_reset(dev); 675 fjn_reset(dev);
683 netif_device_attach(dev); 676 netif_device_attach(dev);
684 } 677 }