1 #ifndef LINUX_3_12_COMPAT_H
2 #define LINUX_3_12_COMPAT_H
4 #include <linux/version.h>
6 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0))
8 #include <linux/pci_hotplug.h>
10 #ifndef PTR_ERR_OR_ZERO
11 #define PTR_ERR_OR_ZERO(p) PTR_RET(p)
14 #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)
16 #define file_inode LINUX_BACKPORT(file_inode)
17 static inline struct inode *file_inode(struct file *f)
19 return f->f_dentry->d_inode;
22 #ifndef HAVE_PCIE_LINK_WIDTH
23 /* These values come from the PCI Express Spec */
24 enum pcie_link_width {
25 PCIE_LNK_WIDTH_RESRV = 0x00,
33 PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
37 extern const unsigned char pcie_link_speed[];
39 #define pcie_get_minimum_link LINUX_BACKPORT(pcie_get_minimum_link)
40 int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed,
41 enum pcie_link_width *width);
42 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) */
43 #endif /* LINUX_3_12_COMPAT_H */