aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco_nortel.c
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2006-04-07 04:10:55 -0400
committerJohn W. Linville <linville@tuxdriver.com>2006-04-24 16:15:52 -0400
commitc6fb2e9abef894efc4870e4c1e3aa4365b830a11 (patch)
treeab262b6f480665fa6ea5b9bdc2a6d6383b0dc2f2 /drivers/net/wireless/orinoco_nortel.c
parent3d529962217c3fec36f53f270a37e132b9763c65 (diff)
[PATCH] orinoco: support PCI suspend/resume for Nortel, PLX and TMD adaptors
Copy PCI suspend/resume functions from orinoco_pci.c. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco_nortel.c')
-rw-r--r--drivers/net/wireless/orinoco_nortel.c87
1 files changed, 83 insertions, 4 deletions
diff --git a/drivers/net/wireless/orinoco_nortel.c b/drivers/net/wireless/orinoco_nortel.c
index d1a670b3533..3fff013f678 100644
--- a/drivers/net/wireless/orinoco_nortel.c
+++ b/drivers/net/wireless/orinoco_nortel.c
@@ -263,6 +263,83 @@ static void __devexit nortel_pci_remove_one(struct pci_dev *pdev)
263 pci_disable_device(pdev); 263 pci_disable_device(pdev);
264} 264}
265 265
266static int orinoco_nortel_suspend(struct pci_dev *pdev, pm_message_t state)
267{
268 struct net_device *dev = pci_get_drvdata(pdev);
269 struct orinoco_private *priv = netdev_priv(dev);
270 unsigned long flags;
271 int err;
272
273 err = orinoco_lock(priv, &flags);
274 if (err) {
275 printk(KERN_ERR "%s: cannot lock hardware for suspend\n",
276 dev->name);
277 return err;
278 }
279
280 err = __orinoco_down(dev);
281 if (err)
282 printk(KERN_WARNING "%s: error %d bringing interface down "
283 "for suspend\n", dev->name, err);
284
285 netif_device_detach(dev);
286
287 priv->hw_unavailable++;
288
289 orinoco_unlock(priv, &flags);
290
291 free_irq(pdev->irq, dev);
292 pci_save_state(pdev);
293 pci_disable_device(pdev);
294 pci_set_power_state(pdev, PCI_D3hot);
295
296 return 0;
297}
298
299static int orinoco_nortel_resume(struct pci_dev *pdev)
300{
301 struct net_device *dev = pci_get_drvdata(pdev);
302 struct orinoco_private *priv = netdev_priv(dev);
303 unsigned long flags;
304 int err;
305
306 pci_set_power_state(pdev, 0);
307 pci_enable_device(pdev);
308 pci_restore_state(pdev);
309
310 err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ,
311 dev->name, dev);
312 if (err) {
313 printk(KERN_ERR "%s: cannot re-allocate IRQ on resume\n",
314 dev->name);
315 pci_disable_device(pdev);
316 return -EBUSY;
317 }
318
319 err = orinoco_reinit_firmware(dev);
320 if (err) {
321 printk(KERN_ERR "%s: error %d re-initializing firmware "
322 "on resume\n", dev->name, err);
323 return err;
324 }
325
326 spin_lock_irqsave(&priv->lock, flags);
327
328 netif_device_attach(dev);
329
330 priv->hw_unavailable--;
331
332 if (priv->open && (! priv->hw_unavailable)) {
333 err = __orinoco_up(dev);
334 if (err)
335 printk(KERN_ERR "%s: Error %d restarting card on resume\n",
336 dev->name, err);
337 }
338
339 spin_unlock_irqrestore(&priv->lock, flags);
340
341 return 0;
342}
266 343
267static struct pci_device_id nortel_pci_id_table[] = { 344static struct pci_device_id nortel_pci_id_table[] = {
268 /* Nortel emobility PCI */ 345 /* Nortel emobility PCI */
@@ -275,10 +352,12 @@ static struct pci_device_id nortel_pci_id_table[] = {
275MODULE_DEVICE_TABLE(pci, nortel_pci_id_table); 352MODULE_DEVICE_TABLE(pci, nortel_pci_id_table);
276 353
277static struct pci_driver nortel_pci_driver = { 354static struct pci_driver nortel_pci_driver = {
278 .name = DRIVER_NAME, 355 .name = DRIVER_NAME,
279 .id_table = nortel_pci_id_table, 356 .id_table = nortel_pci_id_table,
280 .probe = nortel_pci_init_one, 357 .probe = nortel_pci_init_one,
281 .remove = __devexit_p(nortel_pci_remove_one), 358 .remove = __devexit_p(nortel_pci_remove_one),
359 .suspend = orinoco_nortel_suspend,
360 .resume = orinoco_nortel_resume,
282}; 361};
283 362
284static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION 363static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION