diff options
author | Pavel Roskin <proski@gnu.org> | 2006-04-07 04:10:55 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-04-24 16:15:52 -0400 |
commit | c6fb2e9abef894efc4870e4c1e3aa4365b830a11 (patch) | |
tree | ab262b6f480665fa6ea5b9bdc2a6d6383b0dc2f2 /drivers/net/wireless/orinoco_plx.c | |
parent | 3d529962217c3fec36f53f270a37e132b9763c65 (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_plx.c')
-rw-r--r-- | drivers/net/wireless/orinoco_plx.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/drivers/net/wireless/orinoco_plx.c b/drivers/net/wireless/orinoco_plx.c index 210e73776545..3fe7a2f37896 100644 --- a/drivers/net/wireless/orinoco_plx.c +++ b/drivers/net/wireless/orinoco_plx.c | |||
@@ -343,6 +343,83 @@ static void __devexit orinoco_plx_remove_one(struct pci_dev *pdev) | |||
343 | pci_disable_device(pdev); | 343 | pci_disable_device(pdev); |
344 | } | 344 | } |
345 | 345 | ||
346 | static int orinoco_plx_suspend(struct pci_dev *pdev, pm_message_t state) | ||
347 | { | ||
348 | struct net_device *dev = pci_get_drvdata(pdev); | ||
349 | struct orinoco_private *priv = netdev_priv(dev); | ||
350 | unsigned long flags; | ||
351 | int err; | ||
352 | |||
353 | err = orinoco_lock(priv, &flags); | ||
354 | if (err) { | ||
355 | printk(KERN_ERR "%s: cannot lock hardware for suspend\n", | ||
356 | dev->name); | ||
357 | return err; | ||
358 | } | ||
359 | |||
360 | err = __orinoco_down(dev); | ||
361 | if (err) | ||
362 | printk(KERN_WARNING "%s: error %d bringing interface down " | ||
363 | "for suspend\n", dev->name, err); | ||
364 | |||
365 | netif_device_detach(dev); | ||
366 | |||
367 | priv->hw_unavailable++; | ||
368 | |||
369 | orinoco_unlock(priv, &flags); | ||
370 | |||
371 | free_irq(pdev->irq, dev); | ||
372 | pci_save_state(pdev); | ||
373 | pci_disable_device(pdev); | ||
374 | pci_set_power_state(pdev, PCI_D3hot); | ||
375 | |||
376 | return 0; | ||
377 | } | ||
378 | |||
379 | static int orinoco_plx_resume(struct pci_dev *pdev) | ||
380 | { | ||
381 | struct net_device *dev = pci_get_drvdata(pdev); | ||
382 | struct orinoco_private *priv = netdev_priv(dev); | ||
383 | unsigned long flags; | ||
384 | int err; | ||
385 | |||
386 | pci_set_power_state(pdev, 0); | ||
387 | pci_enable_device(pdev); | ||
388 | pci_restore_state(pdev); | ||
389 | |||
390 | err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ, | ||
391 | dev->name, dev); | ||
392 | if (err) { | ||
393 | printk(KERN_ERR "%s: cannot re-allocate IRQ on resume\n", | ||
394 | dev->name); | ||
395 | pci_disable_device(pdev); | ||
396 | return -EBUSY; | ||
397 | } | ||
398 | |||
399 | err = orinoco_reinit_firmware(dev); | ||
400 | if (err) { | ||
401 | printk(KERN_ERR "%s: error %d re-initializing firmware " | ||
402 | "on resume\n", dev->name, err); | ||
403 | return err; | ||
404 | } | ||
405 | |||
406 | spin_lock_irqsave(&priv->lock, flags); | ||
407 | |||
408 | netif_device_attach(dev); | ||
409 | |||
410 | priv->hw_unavailable--; | ||
411 | |||
412 | if (priv->open && (! priv->hw_unavailable)) { | ||
413 | err = __orinoco_up(dev); | ||
414 | if (err) | ||
415 | printk(KERN_ERR "%s: Error %d restarting card on resume\n", | ||
416 | dev->name, err); | ||
417 | } | ||
418 | |||
419 | spin_unlock_irqrestore(&priv->lock, flags); | ||
420 | |||
421 | return 0; | ||
422 | } | ||
346 | 423 | ||
347 | static struct pci_device_id orinoco_plx_pci_id_table[] = { | 424 | static struct pci_device_id orinoco_plx_pci_id_table[] = { |
348 | {0x111a, 0x1023, PCI_ANY_ID, PCI_ANY_ID,}, /* Siemens SpeedStream SS1023 */ | 425 | {0x111a, 0x1023, PCI_ANY_ID, PCI_ANY_ID,}, /* Siemens SpeedStream SS1023 */ |
@@ -369,6 +446,8 @@ static struct pci_driver orinoco_plx_driver = { | |||
369 | .id_table = orinoco_plx_pci_id_table, | 446 | .id_table = orinoco_plx_pci_id_table, |
370 | .probe = orinoco_plx_init_one, | 447 | .probe = orinoco_plx_init_one, |
371 | .remove = __devexit_p(orinoco_plx_remove_one), | 448 | .remove = __devexit_p(orinoco_plx_remove_one), |
449 | .suspend = orinoco_plx_suspend, | ||
450 | .resume = orinoco_plx_resume, | ||
372 | }; | 451 | }; |
373 | 452 | ||
374 | static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION | 453 | static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION |