Subject: [PATCH] Adding missing enums from linux/pci.h
[~tnikolova/compat/.git] / include / linux / compat-3.12.h
1 #ifndef LINUX_3_12_COMPAT_H
2 #define LINUX_3_12_COMPAT_H
3
4 #include <linux/version.h>
5
6 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0))
7
8 #ifndef PTR_ERR_OR_ZERO
9 #define PTR_ERR_OR_ZERO(p) PTR_RET(p)
10 #endif
11
12 #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)
13
14 #define file_inode LINUX_BACKPORT(file_inode)
15 static inline struct inode *file_inode(struct file *f)
16 {
17         return f->f_dentry->d_inode;
18 }
19
20 /* These values come from the PCI Express Spec */
21 enum pcie_link_width {
22         PCIE_LNK_WIDTH_RESRV    = 0x00,
23         PCIE_LNK_X1             = 0x01,
24         PCIE_LNK_X2             = 0x02,
25         PCIE_LNK_X4             = 0x04,
26         PCIE_LNK_X8             = 0x08,
27         PCIE_LNK_X12            = 0x0C,
28         PCIE_LNK_X16            = 0x10,
29         PCIE_LNK_X32            = 0x20,
30         PCIE_LNK_WIDTH_UNKNOWN  = 0xFF,
31 };
32
33 /* Based on the PCI Hotplug Spec, but some values are made up by us */
34 enum pci_bus_speed {
35         PCI_SPEED_33MHz                 = 0x00,
36         PCI_SPEED_66MHz                 = 0x01,
37         PCI_SPEED_66MHz_PCIX            = 0x02,
38         PCI_SPEED_100MHz_PCIX           = 0x03,
39         PCI_SPEED_133MHz_PCIX           = 0x04,
40         PCI_SPEED_66MHz_PCIX_ECC        = 0x05,
41         PCI_SPEED_100MHz_PCIX_ECC       = 0x06,
42         PCI_SPEED_133MHz_PCIX_ECC       = 0x07,
43         PCI_SPEED_66MHz_PCIX_266        = 0x09,
44         PCI_SPEED_100MHz_PCIX_266       = 0x0a,
45         PCI_SPEED_133MHz_PCIX_266       = 0x0b,
46         AGP_UNKNOWN                     = 0x0c,
47         AGP_1X                          = 0x0d,
48         AGP_2X                          = 0x0e,
49         AGP_4X                          = 0x0f,
50         AGP_8X                          = 0x10,
51         PCI_SPEED_66MHz_PCIX_533        = 0x11,
52         PCI_SPEED_100MHz_PCIX_533       = 0x12,
53         PCI_SPEED_133MHz_PCIX_533       = 0x13,
54         PCIE_SPEED_2_5GT                = 0x14,
55         PCIE_SPEED_5_0GT                = 0x15,
56         PCIE_SPEED_8_0GT                = 0x16,
57         PCI_SPEED_UNKNOWN               = 0xff,
58 };
59
60 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) */
61
62 #endif /* LINUX_3_12_COMPAT_H */