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/3c589_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/3c589_cs.c')
-rw-r--r-- | drivers/net/pcmcia/3c589_cs.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 160d48a8ed88..3d05f66e9c70 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -211,7 +211,6 @@ static int tc589_probe(struct pcmcia_device *link) | |||
211 | #endif | 211 | #endif |
212 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 212 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
213 | 213 | ||
214 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
215 | return tc589_config(link); | 214 | return tc589_config(link); |
216 | } /* tc589_attach */ | 215 | } /* tc589_attach */ |
217 | 216 | ||
@@ -233,8 +232,7 @@ static void tc589_detach(struct pcmcia_device *link) | |||
233 | if (link->dev_node) | 232 | if (link->dev_node) |
234 | unregister_netdev(dev); | 233 | unregister_netdev(dev); |
235 | 234 | ||
236 | if (link->state & DEV_CONFIG) | 235 | tc589_release(link); |
237 | tc589_release(link); | ||
238 | 236 | ||
239 | free_netdev(dev); | 237 | free_netdev(dev); |
240 | } /* tc589_detach */ | 238 | } /* tc589_detach */ |
@@ -285,9 +283,6 @@ static int tc589_config(struct pcmcia_device *link) | |||
285 | "3Com card??\n"); | 283 | "3Com card??\n"); |
286 | multi = (le16_to_cpu(buf[1]) == PRODID_3COM_3C562); | 284 | multi = (le16_to_cpu(buf[1]) == PRODID_3COM_3C562); |
287 | } | 285 | } |
288 | |||
289 | /* Configure card */ | ||
290 | link->state |= DEV_CONFIG; | ||
291 | 286 | ||
292 | /* For the 3c562, the base address must be xx00-xx7f */ | 287 | /* For the 3c562, the base address must be xx00-xx7f */ |
293 | link->io.IOAddrLines = 16; | 288 | link->io.IOAddrLines = 16; |
@@ -338,7 +333,6 @@ static int tc589_config(struct pcmcia_device *link) | |||
338 | printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); | 333 | printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); |
339 | 334 | ||
340 | link->dev_node = &lp->node; | 335 | link->dev_node = &lp->node; |
341 | link->state &= ~DEV_CONFIG_PENDING; | ||
342 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 336 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
343 | 337 | ||
344 | if (register_netdev(dev) != 0) { | 338 | if (register_netdev(dev) != 0) { |
@@ -383,7 +377,7 @@ static int tc589_suspend(struct pcmcia_device *link) | |||
383 | { | 377 | { |
384 | struct net_device *dev = link->priv; | 378 | struct net_device *dev = link->priv; |
385 | 379 | ||
386 | if ((link->state & DEV_CONFIG) && (link->open)) | 380 | if (link->open) |
387 | netif_device_detach(dev); | 381 | netif_device_detach(dev); |
388 | 382 | ||
389 | return 0; | 383 | return 0; |
@@ -393,7 +387,7 @@ static int tc589_resume(struct pcmcia_device *link) | |||
393 | { | 387 | { |
394 | struct net_device *dev = link->priv; | 388 | struct net_device *dev = link->priv; |
395 | 389 | ||
396 | if ((link->state & DEV_CONFIG) && (link->open)) { | 390 | if (link->open) { |
397 | tc589_reset(dev); | 391 | tc589_reset(dev); |
398 | netif_device_attach(dev); | 392 | netif_device_attach(dev); |
399 | } | 393 | } |