GNU Linux-libre 5.19-rc6-gnu
[releases.git] / drivers / net / wireless / intersil / orinoco / orinoco_pci.h
1 /* orinoco_pci.h
2  *
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.
7  * See main.c for license.
8  */
9
10 #ifndef _ORINOCO_PCI_H
11 #define _ORINOCO_PCI_H
12
13 #include <linux/netdevice.h>
14
15 /* Driver specific data */
16 struct orinoco_pci_card {
17         void __iomem *bridge_io;
18         void __iomem *attr_io;
19 };
20
21 static int __maybe_unused orinoco_pci_suspend(struct device *dev_d)
22 {
23         struct pci_dev *pdev = to_pci_dev(dev_d);
24         struct orinoco_private *priv = pci_get_drvdata(pdev);
25
26         orinoco_down(priv);
27         free_irq(pdev->irq, priv);
28
29         return 0;
30 }
31
32 static int __maybe_unused orinoco_pci_resume(struct device *dev_d)
33 {
34         struct pci_dev *pdev = to_pci_dev(dev_d);
35         struct orinoco_private *priv = pci_get_drvdata(pdev);
36         struct net_device *dev = priv->ndev;
37         int err;
38
39         err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED,
40                           dev->name, priv);
41         if (err) {
42                 printk(KERN_ERR "%s: cannot re-allocate IRQ on resume\n",
43                        dev->name);
44                 return -EBUSY;
45         }
46
47         return orinoco_up(priv);
48 }
49
50 static SIMPLE_DEV_PM_OPS(orinoco_pci_pm_ops,
51                          orinoco_pci_suspend,
52                          orinoco_pci_resume);
53
54 #endif /* _ORINOCO_PCI_H */