Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / drivers / net / wireless / orinoco / orinoco_pci.h
blobea7231af40a848be49f36f3e78a33b1a2c98ff14
1 /* orinoco_pci.h
3 * Common code for all Orinoco drivers for PCI devices, including
4 * both native PCI and PCMCIA-to-PCI bridges.
6 * Copyright (C) 2005, Pavel Roskin.
7 * See main.c for license.
8 */
10 #ifndef _ORINOCO_PCI_H
11 #define _ORINOCO_PCI_H
13 #include <linux/netdevice.h>
15 /* Driver specific data */
16 struct orinoco_pci_card {
17 void __iomem *bridge_io;
18 void __iomem *attr_io;
21 #ifdef CONFIG_PM
22 static int orinoco_pci_suspend(struct pci_dev *pdev, pm_message_t state)
24 struct orinoco_private *priv = pci_get_drvdata(pdev);
26 orinoco_down(priv);
27 free_irq(pdev->irq, priv);
28 pci_save_state(pdev);
29 pci_disable_device(pdev);
30 pci_set_power_state(pdev, PCI_D3hot);
32 return 0;
35 static int orinoco_pci_resume(struct pci_dev *pdev)
37 struct orinoco_private *priv = pci_get_drvdata(pdev);
38 struct net_device *dev = priv->ndev;
39 int err;
41 pci_set_power_state(pdev, 0);
42 err = pci_enable_device(pdev);
43 if (err) {
44 printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
45 dev->name);
46 return err;
48 pci_restore_state(pdev);
50 err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED,
51 dev->name, priv);
52 if (err) {
53 printk(KERN_ERR "%s: cannot re-allocate IRQ on resume\n",
54 dev->name);
55 pci_disable_device(pdev);
56 return -EBUSY;
59 err = orinoco_up(priv);
61 return err;
63 #else
64 #define orinoco_pci_suspend NULL
65 #define orinoco_pci_resume NULL
66 #endif
68 #endif /* _ORINOCO_PCI_H */