19 #ifndef _COBALT_ASM_GENERIC_WRAPPERS_H
21 #include <linux/version.h>
23 #ifdef CONFIG_IPIPE_LEGACY
24 #error "CONFIG_IPIPE_LEGACY must be switched off"
27 #define COBALT_BACKPORT(__sym) __cobalt_backport_ ##__sym
41 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
42 #define user_msghdr msghdr
45 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
46 #include <linux/netdevice.h>
49 #define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
50 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1)
52 #include <linux/trace_seq.h>
54 static inline unsigned char *
55 trace_seq_buffer_ptr(
struct trace_seq *s)
57 return s->buffer + s->len;
62 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
63 #define smp_mb__before_atomic() smp_mb()
64 #define smp_mb__after_atomic() smp_mb()
67 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
68 #define raw_cpu_ptr(v) __this_cpu_ptr(v)
71 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
72 #include <linux/pci.h>
75 #define pci_enable_msix_range COBALT_BACKPORT(pci_enable_msix_range)
77 int pci_enable_msix_range(
struct pci_dev *dev,
78 struct msix_entry *entries,
79 int minvec,
int maxvec);
82 int pci_enable_msix_range(
struct pci_dev *dev,
83 struct msix_entry *entries,
84 int minvec,
int maxvec)
92 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
93 #include <linux/dma-mapping.h>
94 #include <linux/hwmon.h>
96 #define dma_set_mask_and_coherent COBALT_BACKPORT(dma_set_mask_and_coherent)
98 int dma_set_mask_and_coherent(
struct device *dev, u64 mask)
100 int rc = dma_set_mask(dev, mask);
102 dma_set_coherent_mask(dev, mask);
107 #define hwmon_device_register_with_groups \
108 COBALT_BACKPORT(hwmon_device_register_with_groups)
110 hwmon_device_register_with_groups(
struct device *dev,
const char *name,
112 const struct attribute_group **groups);
114 #define devm_hwmon_device_register_with_groups \
115 COBALT_BACKPORT(devm_hwmon_device_register_with_groups)
117 devm_hwmon_device_register_with_groups(
struct device *dev,
const char *name,
119 const struct attribute_group **groups);
122 #define reinit_completion(__x) INIT_COMPLETION(*(__x))
126 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
127 #define DEVICE_ATTR_RW(_name) __ATTR_RW(_name)
128 #define DEVICE_ATTR_RO(_name) __ATTR_RO(_name)
129 #define DEVICE_ATTR_WO(_name) __ATTR_WO(_name)
132 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
133 #error "Xenomai/cobalt requires Linux kernel 3.10 or above"