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 orinoco.c for license.
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
;
22 static int orinoco_pci_suspend(struct pci_dev
*pdev
, pm_message_t state
)
24 struct net_device
*dev
= pci_get_drvdata(pdev
);
25 struct orinoco_private
*priv
= netdev_priv(dev
);
29 err
= orinoco_lock(priv
, &flags
);
31 printk(KERN_ERR
"%s: cannot lock hardware for suspend\n",
36 err
= __orinoco_down(dev
);
38 printk(KERN_WARNING
"%s: error %d bringing interface down "
39 "for suspend\n", dev
->name
, err
);
41 netif_device_detach(dev
);
43 priv
->hw_unavailable
++;
45 orinoco_unlock(priv
, &flags
);
47 free_irq(pdev
->irq
, dev
);
49 pci_disable_device(pdev
);
50 pci_set_power_state(pdev
, PCI_D3hot
);
55 static int orinoco_pci_resume(struct pci_dev
*pdev
)
57 struct net_device
*dev
= pci_get_drvdata(pdev
);
58 struct orinoco_private
*priv
= netdev_priv(dev
);
62 pci_set_power_state(pdev
, 0);
63 err
= pci_enable_device(pdev
);
65 printk(KERN_ERR
"%s: pci_enable_device failed on resume\n",
69 pci_restore_state(pdev
);
71 err
= request_irq(pdev
->irq
, orinoco_interrupt
, IRQF_SHARED
,
74 printk(KERN_ERR
"%s: cannot re-allocate IRQ on resume\n",
76 pci_disable_device(pdev
);
80 err
= orinoco_reinit_firmware(dev
);
82 printk(KERN_ERR
"%s: error %d re-initializing firmware "
83 "on resume\n", dev
->name
, err
);
87 spin_lock_irqsave(&priv
->lock
, flags
);
89 netif_device_attach(dev
);
91 priv
->hw_unavailable
--;
93 if (priv
->open
&& (! priv
->hw_unavailable
)) {
94 err
= __orinoco_up(dev
);
96 printk(KERN_ERR
"%s: Error %d restarting card on resume\n",
100 spin_unlock_irqrestore(&priv
->lock
, flags
);
105 #define orinoco_pci_suspend NULL
106 #define orinoco_pci_resume NULL
109 #endif /* _ORINOCO_PCI_H */
This page took 0.032913 seconds and 5 git commands to generate.