1 #ifndef LINUX_3_0_COMPAT_H
2 #define LINUX_3_0_COMPAT_H
4 #include <linux/version.h>
6 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0))
9 * since commit 1c5cae815d19ffe02bdfda1260949ef2b1806171
10 * "net: call dev_alloc_name from register_netdevice" dev_alloc_name is
11 * called automatically. This is not implemented in older kernel
12 * versions so it will result in device wrong names.
14 static inline int register_netdevice_name(struct net_device *dev)
18 if (strchr(dev->name, '%')) {
19 err = dev_alloc_name(dev, dev->name);
24 return register_netdevice(dev);
27 #define register_netdevice(dev) register_netdevice_name(dev)
29 /* BCMA core, see drivers/bcma/ */
31 /* Broadcom's specific AMBA core, see drivers/bcma/ */
32 struct bcma_device_id {
38 #define BCMA_CORE(_manuf, _id, _rev, _class) \
39 { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, }
40 #define BCMA_CORETABLE_END \
43 #define BCMA_ANY_MANUF 0xFFFF
44 #define BCMA_ANY_ID 0xFFFF
45 #define BCMA_ANY_REV 0xFF
46 #define BCMA_ANY_CLASS 0xFF
47 #endif /* BCMA_CORE */
49 int mac_pton(const char *s, u8 *mac);
51 int __must_check kstrtoull_from_user(const char __user *s, size_t count, unsigned int base, unsigned long long *res);
52 int __must_check kstrtoll_from_user(const char __user *s, size_t count, unsigned int base, long long *res);
53 int __must_check kstrtoul_from_user(const char __user *s, size_t count, unsigned int base, unsigned long *res);
54 int __must_check kstrtol_from_user(const char __user *s, size_t count, unsigned int base, long *res);
55 int __must_check kstrtouint_from_user(const char __user *s, size_t count, unsigned int base, unsigned int *res);
56 int __must_check kstrtoint_from_user(const char __user *s, size_t count, unsigned int base, int *res);
57 int __must_check kstrtou16_from_user(const char __user *s, size_t count, unsigned int base, u16 *res);
58 int __must_check kstrtos16_from_user(const char __user *s, size_t count, unsigned int base, s16 *res);
59 int __must_check kstrtou8_from_user(const char __user *s, size_t count, unsigned int base, u8 *res);
60 int __must_check kstrtos8_from_user(const char __user *s, size_t count, unsigned int base, s8 *res);
62 static inline int __must_check kstrtou64_from_user(const char __user *s, size_t count, unsigned int base, u64 *res)
64 return kstrtoull_from_user(s, count, base, res);
67 static inline int __must_check kstrtos64_from_user(const char __user *s, size_t count, unsigned int base, s64 *res)
69 return kstrtoll_from_user(s, count, base, res);
72 static inline int __must_check kstrtou32_from_user(const char __user *s, size_t count, unsigned int base, u32 *res)
74 return kstrtouint_from_user(s, count, base, res);
77 static inline int __must_check kstrtos32_from_user(const char __user *s, size_t count, unsigned int base, s32 *res)
79 return kstrtoint_from_user(s, count, base, res);
82 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) */
84 #endif /* LINUX_3_0_COMPAT_H */