diff options
Diffstat (limited to 'drivers/net/wireless/orinoco_cs.c')
-rw-r--r-- | drivers/net/wireless/orinoco_cs.c | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index 0e92bee16c9b..434f7d7ad841 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -134,7 +134,6 @@ orinoco_cs_probe(struct pcmcia_device *link) | |||
134 | link->conf.Attributes = 0; | 134 | link->conf.Attributes = 0; |
135 | link->conf.IntType = INT_MEMORY_AND_IO; | 135 | link->conf.IntType = INT_MEMORY_AND_IO; |
136 | 136 | ||
137 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
138 | return orinoco_cs_config(link); | 137 | return orinoco_cs_config(link); |
139 | } /* orinoco_cs_attach */ | 138 | } /* orinoco_cs_attach */ |
140 | 139 | ||
@@ -148,8 +147,7 @@ static void orinoco_cs_detach(struct pcmcia_device *link) | |||
148 | { | 147 | { |
149 | struct net_device *dev = link->priv; | 148 | struct net_device *dev = link->priv; |
150 | 149 | ||
151 | if (link->state & DEV_CONFIG) | 150 | orinoco_cs_release(link); |
152 | orinoco_cs_release(link); | ||
153 | 151 | ||
154 | DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node); | 152 | DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node); |
155 | if (link->dev_node) { | 153 | if (link->dev_node) { |
@@ -202,9 +200,6 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
202 | link->conf.ConfigBase = parse.config.base; | 200 | link->conf.ConfigBase = parse.config.base; |
203 | link->conf.Present = parse.config.rmask[0]; | 201 | link->conf.Present = parse.config.rmask[0]; |
204 | 202 | ||
205 | /* Configure card */ | ||
206 | link->state |= DEV_CONFIG; | ||
207 | |||
208 | /* Look up the current Vcc */ | 203 | /* Look up the current Vcc */ |
209 | CS_CHECK(GetConfigurationInfo, | 204 | CS_CHECK(GetConfigurationInfo, |
210 | pcmcia_get_configuration_info(link, &conf)); | 205 | pcmcia_get_configuration_info(link, &conf)); |
@@ -358,7 +353,6 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
358 | link->dev_node = &card->node; /* link->dev_node being non-NULL is also | 353 | link->dev_node = &card->node; /* link->dev_node being non-NULL is also |
359 | used to indicate that the | 354 | used to indicate that the |
360 | net_device has been registered */ | 355 | net_device has been registered */ |
361 | link->state &= ~DEV_CONFIG_PENDING; | ||
362 | 356 | ||
363 | /* Finally, report what we've done */ | 357 | /* Finally, report what we've done */ |
364 | printk(KERN_DEBUG "%s: index 0x%02x: ", | 358 | printk(KERN_DEBUG "%s: index 0x%02x: ", |
@@ -416,23 +410,21 @@ static int orinoco_cs_suspend(struct pcmcia_device *link) | |||
416 | int err = 0; | 410 | int err = 0; |
417 | unsigned long flags; | 411 | unsigned long flags; |
418 | 412 | ||
419 | if (link->state & DEV_CONFIG) { | 413 | /* This is probably racy, but I can't think of |
420 | /* This is probably racy, but I can't think of | 414 | a better way, short of rewriting the PCMCIA |
421 | a better way, short of rewriting the PCMCIA | 415 | layer to not suck :-( */ |
422 | layer to not suck :-( */ | 416 | if (! test_bit(0, &card->hard_reset_in_progress)) { |
423 | if (! test_bit(0, &card->hard_reset_in_progress)) { | 417 | spin_lock_irqsave(&priv->lock, flags); |
424 | spin_lock_irqsave(&priv->lock, flags); | ||
425 | 418 | ||
426 | err = __orinoco_down(dev); | 419 | err = __orinoco_down(dev); |
427 | if (err) | 420 | if (err) |
428 | printk(KERN_WARNING "%s: Error %d downing interface\n", | 421 | printk(KERN_WARNING "%s: Error %d downing interface\n", |
429 | dev->name, err); | 422 | dev->name, err); |
430 | 423 | ||
431 | netif_device_detach(dev); | 424 | netif_device_detach(dev); |
432 | priv->hw_unavailable++; | 425 | priv->hw_unavailable++; |
433 | 426 | ||
434 | spin_unlock_irqrestore(&priv->lock, flags); | 427 | spin_unlock_irqrestore(&priv->lock, flags); |
435 | } | ||
436 | } | 428 | } |
437 | 429 | ||
438 | return 0; | 430 | return 0; |
@@ -446,29 +438,27 @@ static int orinoco_cs_resume(struct pcmcia_device *link) | |||
446 | int err = 0; | 438 | int err = 0; |
447 | unsigned long flags; | 439 | unsigned long flags; |
448 | 440 | ||
449 | if (link->state & DEV_CONFIG) { | 441 | if (! test_bit(0, &card->hard_reset_in_progress)) { |
450 | if (! test_bit(0, &card->hard_reset_in_progress)) { | 442 | err = orinoco_reinit_firmware(dev); |
451 | err = orinoco_reinit_firmware(dev); | 443 | if (err) { |
452 | if (err) { | 444 | printk(KERN_ERR "%s: Error %d re-initializing firmware\n", |
453 | printk(KERN_ERR "%s: Error %d re-initializing firmware\n", | 445 | dev->name, err); |
454 | dev->name, err); | 446 | return -EIO; |
455 | return -EIO; | 447 | } |
456 | } | ||
457 | |||
458 | spin_lock_irqsave(&priv->lock, flags); | ||
459 | 448 | ||
460 | netif_device_attach(dev); | 449 | spin_lock_irqsave(&priv->lock, flags); |
461 | priv->hw_unavailable--; | ||
462 | 450 | ||
463 | if (priv->open && ! priv->hw_unavailable) { | 451 | netif_device_attach(dev); |
464 | err = __orinoco_up(dev); | 452 | priv->hw_unavailable--; |
465 | if (err) | ||
466 | printk(KERN_ERR "%s: Error %d restarting card\n", | ||
467 | dev->name, err); | ||
468 | } | ||
469 | 453 | ||
470 | spin_unlock_irqrestore(&priv->lock, flags); | 454 | if (priv->open && ! priv->hw_unavailable) { |
455 | err = __orinoco_up(dev); | ||
456 | if (err) | ||
457 | printk(KERN_ERR "%s: Error %d restarting card\n", | ||
458 | dev->name, err); | ||
471 | } | 459 | } |
460 | |||
461 | spin_unlock_irqrestore(&priv->lock, flags); | ||
472 | } | 462 | } |
473 | 463 | ||
474 | return 0; | 464 | return 0; |