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/com20020_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/com20020_cs.c')
-rw-r--r-- | drivers/net/pcmcia/com20020_cs.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index a7d675bc6051..441de824ab6b 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c | |||
@@ -178,7 +178,6 @@ static int com20020_probe(struct pcmcia_device *p_dev) | |||
178 | p_dev->irq.Instance = info->dev = dev; | 178 | p_dev->irq.Instance = info->dev = dev; |
179 | p_dev->priv = info; | 179 | p_dev->priv = info; |
180 | 180 | ||
181 | p_dev->state |= DEV_PRESENT; | ||
182 | return com20020_config(p_dev); | 181 | return com20020_config(p_dev); |
183 | 182 | ||
184 | fail_alloc_dev: | 183 | fail_alloc_dev: |
@@ -218,8 +217,7 @@ static void com20020_detach(struct pcmcia_device *link) | |||
218 | free_irq(dev->irq, dev); | 217 | free_irq(dev->irq, dev); |
219 | } | 218 | } |
220 | 219 | ||
221 | if (link->state & DEV_CONFIG) | 220 | com20020_release(link); |
222 | com20020_release(link); | ||
223 | 221 | ||
224 | /* Unlink device structure, free bits */ | 222 | /* Unlink device structure, free bits */ |
225 | DEBUG(1,"unlinking...\n"); | 223 | DEBUG(1,"unlinking...\n"); |
@@ -276,9 +274,6 @@ static int com20020_config(struct pcmcia_device *link) | |||
276 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 274 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
277 | link->conf.ConfigBase = parse.config.base; | 275 | link->conf.ConfigBase = parse.config.base; |
278 | 276 | ||
279 | /* Configure card */ | ||
280 | link->state |= DEV_CONFIG; | ||
281 | |||
282 | DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); | 277 | DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); |
283 | i = !CS_SUCCESS; | 278 | i = !CS_SUCCESS; |
284 | if (!link->io.BasePort1) | 279 | if (!link->io.BasePort1) |
@@ -328,7 +323,6 @@ static int com20020_config(struct pcmcia_device *link) | |||
328 | lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ | 323 | lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ |
329 | 324 | ||
330 | link->dev_node = &info->node; | 325 | link->dev_node = &info->node; |
331 | link->state &= ~DEV_CONFIG_PENDING; | ||
332 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 326 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
333 | 327 | ||
334 | i = com20020_found(dev, 0); /* calls register_netdev */ | 328 | i = com20020_found(dev, 0); /* calls register_netdev */ |
@@ -372,7 +366,7 @@ static int com20020_suspend(struct pcmcia_device *link) | |||
372 | com20020_dev_t *info = link->priv; | 366 | com20020_dev_t *info = link->priv; |
373 | struct net_device *dev = info->dev; | 367 | struct net_device *dev = info->dev; |
374 | 368 | ||
375 | if ((link->state & DEV_CONFIG) && (link->open)) | 369 | if (link->open) |
376 | netif_device_detach(dev); | 370 | netif_device_detach(dev); |
377 | 371 | ||
378 | return 0; | 372 | return 0; |
@@ -383,7 +377,7 @@ static int com20020_resume(struct pcmcia_device *link) | |||
383 | com20020_dev_t *info = link->priv; | 377 | com20020_dev_t *info = link->priv; |
384 | struct net_device *dev = info->dev; | 378 | struct net_device *dev = info->dev; |
385 | 379 | ||
386 | if ((link->state & DEV_CONFIG) && (link->open)) { | 380 | if (link->open) { |
387 | int ioaddr = dev->base_addr; | 381 | int ioaddr = dev->base_addr; |
388 | struct arcnet_local *lp = dev->priv; | 382 | struct arcnet_local *lp = dev->priv; |
389 | ARCRESET; | 383 | ARCRESET; |