Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
[deliverable/linux.git] / drivers / net / wireless / orinoco / orinoco_pci.h
CommitLineData
b884c872 1/* orinoco_pci.h
d14c7c1d 2 *
b884c872
PR
3 * Common code for all Orinoco drivers for PCI devices, including
4 * both native PCI and PCMCIA-to-PCI bridges.
5 *
6 * Copyright (C) 2005, Pavel Roskin.
47445cb9 7 * See main.c for license.
b884c872
PR
8 */
9
10#ifndef _ORINOCO_PCI_H
11#define _ORINOCO_PCI_H
12
13#include <linux/netdevice.h>
14
15/* Driver specific data */
16struct orinoco_pci_card {
17 void __iomem *bridge_io;
18 void __iomem *attr_io;
19};
20
95047dd6 21#ifdef CONFIG_PM
b884c872
PR
22static int orinoco_pci_suspend(struct pci_dev *pdev, pm_message_t state)
23{
a2608362 24 struct orinoco_private *priv = pci_get_drvdata(pdev);
b884c872 25
6415f7df 26 orinoco_down(priv);
a2608362 27 free_irq(pdev->irq, priv);
b884c872
PR
28 pci_save_state(pdev);
29 pci_disable_device(pdev);
30 pci_set_power_state(pdev, PCI_D3hot);
31
32 return 0;
33}
34
35static int orinoco_pci_resume(struct pci_dev *pdev)
36{
a2608362
DK
37 struct orinoco_private *priv = pci_get_drvdata(pdev);
38 struct net_device *dev = priv->ndev;
b884c872
PR
39 int err;
40
41 pci_set_power_state(pdev, 0);
02e0e5e9
JL
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;
47 }
b884c872
PR
48 pci_restore_state(pdev);
49
1fb9df5d 50 err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED,
a2608362 51 dev->name, priv);
b884c872
PR
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;
57 }
58
6415f7df 59 err = orinoco_up(priv);
b884c872 60
6415f7df 61 return err;
b884c872 62}
95047dd6
PR
63#else
64#define orinoco_pci_suspend NULL
65#define orinoco_pci_resume NULL
66#endif
b884c872
PR
67
68#endif /* _ORINOCO_PCI_H */
This page took 1.21632 seconds and 5 git commands to generate.