Commit 6cbaa330 authored by Pavel Roskin's avatar Pavel Roskin Committed by John W. Linville

[PATCH] orinoco: simplify locking, fix error handling in PCMCIA resume

Don't use flags in the spinlocks - the PCMCIA resume functions may not
be called under lock.  Don't ignore any errors.
Signed-off-by: default avatarPavel Roskin <proski@gnu.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 9a568da2
...@@ -415,7 +415,6 @@ static int orinoco_cs_resume(struct pcmcia_device *link) ...@@ -415,7 +415,6 @@ static int orinoco_cs_resume(struct pcmcia_device *link)
struct orinoco_private *priv = netdev_priv(dev); struct orinoco_private *priv = netdev_priv(dev);
struct orinoco_pccard *card = priv->card; struct orinoco_pccard *card = priv->card;
int err = 0; int err = 0;
unsigned long flags;
if (! test_bit(0, &card->hard_reset_in_progress)) { if (! test_bit(0, &card->hard_reset_in_progress)) {
err = orinoco_reinit_firmware(dev); err = orinoco_reinit_firmware(dev);
...@@ -425,7 +424,7 @@ static int orinoco_cs_resume(struct pcmcia_device *link) ...@@ -425,7 +424,7 @@ static int orinoco_cs_resume(struct pcmcia_device *link)
return -EIO; return -EIO;
} }
spin_lock_irqsave(&priv->lock, flags); spin_lock(&priv->lock);
netif_device_attach(dev); netif_device_attach(dev);
priv->hw_unavailable--; priv->hw_unavailable--;
...@@ -437,10 +436,10 @@ static int orinoco_cs_resume(struct pcmcia_device *link) ...@@ -437,10 +436,10 @@ static int orinoco_cs_resume(struct pcmcia_device *link)
dev->name, err); dev->name, err);
} }
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock(&priv->lock);
} }
return 0; return err;
} }
......
...@@ -866,11 +866,10 @@ spectrum_cs_suspend(struct pcmcia_device *link) ...@@ -866,11 +866,10 @@ spectrum_cs_suspend(struct pcmcia_device *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
struct orinoco_private *priv = netdev_priv(dev); struct orinoco_private *priv = netdev_priv(dev);
unsigned long flags;
int err = 0; int err = 0;
/* Mark the device as stopped, to block IO until later */ /* Mark the device as stopped, to block IO until later */
spin_lock_irqsave(&priv->lock, flags); spin_lock(&priv->lock);
err = __orinoco_down(dev); err = __orinoco_down(dev);
if (err) if (err)
...@@ -880,9 +879,9 @@ spectrum_cs_suspend(struct pcmcia_device *link) ...@@ -880,9 +879,9 @@ spectrum_cs_suspend(struct pcmcia_device *link)
netif_device_detach(dev); netif_device_detach(dev);
priv->hw_unavailable++; priv->hw_unavailable++;
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock(&priv->lock);
return 0; return err;
} }
static int static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment