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