1 #ifndef LINUX_26_25_COMPAT_H
2 #define LINUX_26_25_COMPAT_H
4 #include <linux/autoconf.h>
5 #include <linux/version.h>
7 /* Compat work for 2.6.24 */
8 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25))
10 #include <linux/types.h>
12 #include <linux/hw_random.h>
13 #include <linux/leds.h>
14 #include <linux/kernel.h>
15 #include <linux/netdevice.h>
17 #include <asm-generic/bug.h>
20 * 2.6.25 adds PM_EVENT_HIBERNATE as well here but
21 * we don't have this on <= 2.6.23)
23 #define PM_EVENT_SLEEP (PM_EVENT_SUSPEND)
25 /* Although we don't care about wimax this is needed for rfkill input stuff */
28 /* Although pm_qos stuff is not implemented on <= 2.6.24 lets keep the define */
29 #define PM_QOS_DEFAULT_VALUE -1
31 #define __WARN(foo) dump_stack()
33 #define dev_emerg(dev, format, arg...) \
34 dev_printk(KERN_EMERG , dev , format , ## arg)
35 #define dev_alert(dev, format, arg...) \
36 dev_printk(KERN_ALERT , dev , format , ## arg)
37 #define dev_crit(dev, format, arg...) \
38 dev_printk(KERN_CRIT , dev , format , ## arg)
40 extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
41 extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
43 #define seq_file_net &init_net;
46 NF_INET_PRE_ROUTING = 0,
49 NF_INET_LOCAL_OUT = 3,
50 NF_INET_POST_ROUTING = 4,
55 * commit 8b5f6883683c91ad7e1af32b7ceeb604d68e2865
56 * Author: Marcin Slusarz <marcin.slusarz@gmail.com>
57 * Date: Fri Feb 8 04:20:12 2008 -0800
59 * byteorder: move le32_add_cpu & friends from OCFS2 to core
61 * moves le*_add_cpu and be*_add_cpu functions from OCFS2 to core
62 * header (1st) and converted some existing code to it. We port
63 * it here as later kernels will most likely use it.
65 static inline void le16_add_cpu(__le16 *var, u16 val)
67 *var = cpu_to_le16(le16_to_cpu(*var) + val);
70 static inline void le32_add_cpu(__le32 *var, u32 val)
72 *var = cpu_to_le32(le32_to_cpu(*var) + val);
75 static inline void le64_add_cpu(__le64 *var, u64 val)
77 *var = cpu_to_le64(le64_to_cpu(*var) + val);
80 static inline void be16_add_cpu(__be16 *var, u16 val)
82 u16 v = be16_to_cpu(*var);
83 *var = cpu_to_be16(v + val);
86 static inline void be32_add_cpu(__be32 *var, u32 val)
88 u32 v = be32_to_cpu(*var);
89 *var = cpu_to_be32(v + val);
92 static inline void be64_add_cpu(__be64 *var, u64 val)
94 u64 v = be64_to_cpu(*var);
95 *var = cpu_to_be64(v + val);
98 /* 2.6.25 changes hwrng_unregister()'s behaviour by supporting
99 * suspend of its parent device (the misc device, which is itself the
100 * hardware random number generator). It does this by passing a parameter to
101 * unregister_miscdev() which is not supported in older kernels. The suspend
102 * parameter allows us to enable access to the device's hardware
103 * number generator during suspend. As far as wireless is concerned this means
104 * if a driver goes to suspend it you won't have the HNR available in
106 static inline void __hwrng_unregister(struct hwrng *rng, bool suspended)
108 hwrng_unregister(rng);
111 static inline void led_classdev_unregister_suspended(struct led_classdev *lcd)
113 led_classdev_unregister(lcd);
117 * The following things are out of ./include/linux/kernel.h
118 * The new iwlwifi driver is using them.
120 extern int strict_strtoul(const char *, unsigned int, unsigned long *);
121 extern int strict_strtol(const char *, unsigned int, long *);
123 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) */
125 #endif /* LINUX_26_25_COMPAT_H */