]> git.sur5r.net Git - groeck-it87/blob - compat.h
Add driver removal notice
[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 clamp_val
15 #define clamp_val SENSORS_LIMIT
16 #endif
17
18 #ifndef request_muxed_region
19 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 28)
20 #define request_muxed_region(start,n,name)      __request_region(&ioport_resource, (start), (n), (name))
21 #else
22 #define IORESOURCE_MUXED        0x00400000
23 #define request_muxed_region(start,n,name)      __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
24 #endif
25 #endif
26
27 /* Red Hat EL5 includes backports of these functions, so we can't redefine
28  * our own. */
29 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 24)
30 #if !(defined RHEL_MAJOR && RHEL_MAJOR == 5 && RHEL_MINOR >= 5)
31 static inline int strict_strtoul(const char *cp, unsigned int base,
32                                  unsigned long *res)
33 {
34         *res = simple_strtoul(cp, NULL, base);
35         return 0;
36 }
37
38 static inline int strict_strtol(const char *cp, unsigned int base, long *res)
39 {
40         *res = simple_strtol(cp, NULL, base);
41         return 0;
42 }
43 #endif
44 #endif
45
46 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
47 #define kstrtoul strict_strtoul 
48 #define kstrtol strict_strtol
49 #endif
50
51 /*
52  * Some kernel configurations may have CONFIG_HWMON_VID disabled.
53  * We still have the functios declared as external, so we can not use
54  * static inline.
55  */
56 #if !defined(CONFIG_HWMON_VID) && !defined(CONFIG_HWMON_VID_MODULE)
57 int vid_from_reg(int val, u8 vrm)
58 {
59         return 0;
60 }
61
62 u8 vid_which_vrm(void)
63 {
64         return 0;
65 }
66 #endif
67
68 #endif /* COMPAT_H */