]> git.sur5r.net Git - groeck-it87/blob - compat.h
sync w/ upstream, plus preliminary PECI support
[groeck-it87] / compat.h
1 /*---------------------------------------------------------------------------
2  * 
3  * compat.h 
4  *     Copyright (c) 2012 Guenter Roeck <linux@roeck-us.net>
5  *
6  *---------------------------------------------------------------------------
7  */
8
9 #ifndef COMPAT_H
10 #define COMPAT_H
11
12 #include <linux/version.h>
13
14 #ifndef request_muxed_region
15 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 28)
16 #define request_muxed_region(start,n,name)      __request_region(&ioport_resource, (start), (n), (name))
17 #else
18 #define IORESOURCE_MUXED        0x00400000
19 #define request_muxed_region(start,n,name)      __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
20 #endif
21 #endif
22
23 /* Red Hat EL5 includes backports of these functions, so we can't redefine
24  * our own. */
25 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 24)
26 #if !(defined RHEL_MAJOR && RHEL_MAJOR == 5 && RHEL_MINOR >= 5)
27 static inline int strict_strtoul(const char *cp, unsigned int base,
28                                  unsigned long *res)
29 {
30         *res = simple_strtoul(cp, NULL, base);
31         return 0;
32 }
33
34 static inline int strict_strtol(const char *cp, unsigned int base, long *res)
35 {
36         *res = simple_strtol(cp, NULL, base);
37         return 0;
38 }
39 #endif
40 #endif
41
42 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
43 #define kstrtoul strict_strtoul
44 #define kstrtol strict_strtol
45 #endif
46
47 #endif /* COMPAT_H */