diff options
author | David Kilroy <kilroyd@googlemail.com> | 2009-06-18 23:21:30 +0100 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:01:46 -0400 |
commit | 6415f7df10573bf1ec42644f42bef565127114a1 (patch) | |
tree | 6aa981f181010faca22989ffd70ef89b0d32ff07 /drivers/net/wireless/orinoco/orinoco_pci.h | |
parent | ef96b5c9ed6ba4b45fd4cf45810c34978bb8d8bb (diff) | |
download | kernel_samsung_smdk4412-6415f7df10573bf1ec42644f42bef565127114a1.zip kernel_samsung_smdk4412-6415f7df10573bf1ec42644f42bef565127114a1.tar.gz kernel_samsung_smdk4412-6415f7df10573bf1ec42644f42bef565127114a1.tar.bz2 |
orinoco: Handle suspend/restore in core driver
Each device does almost exactly the same things on suspend and resume
when upping and downing the interface. So move this logic into a common
routine.
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco/orinoco_pci.h')
-rw-r--r-- | drivers/net/wireless/orinoco/orinoco_pci.h | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/drivers/net/wireless/orinoco/orinoco_pci.h b/drivers/net/wireless/orinoco/orinoco_pci.h index 22aa630..ea7231a 100644 --- a/drivers/net/wireless/orinoco/orinoco_pci.h +++ b/drivers/net/wireless/orinoco/orinoco_pci.h @@ -22,28 +22,8 @@ struct orinoco_pci_card { static int orinoco_pci_suspend(struct pci_dev *pdev, pm_message_t state) { struct orinoco_private *priv = pci_get_drvdata(pdev); - struct net_device *dev = priv->ndev; - unsigned long flags; - int err; - - err = orinoco_lock(priv, &flags); - if (err) { - printk(KERN_ERR "%s: cannot lock hardware for suspend\n", - dev->name); - return err; - } - - err = __orinoco_down(priv); - if (err) - printk(KERN_WARNING "%s: error %d bringing interface down " - "for suspend\n", dev->name, err); - - netif_device_detach(dev); - - priv->hw_unavailable++; - - orinoco_unlock(priv, &flags); + orinoco_down(priv); free_irq(pdev->irq, priv); pci_save_state(pdev); pci_disable_device(pdev); @@ -56,7 +36,6 @@ static int orinoco_pci_resume(struct pci_dev *pdev) { struct orinoco_private *priv = pci_get_drvdata(pdev); struct net_device *dev = priv->ndev; - unsigned long flags; int err; pci_set_power_state(pdev, 0); @@ -77,29 +56,9 @@ static int orinoco_pci_resume(struct pci_dev *pdev) return -EBUSY; } - err = orinoco_reinit_firmware(priv); - if (err) { - printk(KERN_ERR "%s: error %d re-initializing firmware " - "on resume\n", dev->name, err); - return err; - } - - spin_lock_irqsave(&priv->lock, flags); - - netif_device_attach(dev); + err = orinoco_up(priv); - priv->hw_unavailable--; - - if (priv->open && (!priv->hw_unavailable)) { - err = __orinoco_up(priv); - if (err) - printk(KERN_ERR "%s: Error %d restarting card on resume\n", - dev->name, err); - } - - spin_unlock_irqrestore(&priv->lock, flags); - - return 0; + return err; } #else #define orinoco_pci_suspend NULL |