1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28#ifndef __DGNC_KCOMPAT_H
29#define __DGNC_KCOMPAT_H
30
31#include <linux/version.h>
32
33# ifndef KERNEL_VERSION
34# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
35# endif
36
37
38#if !defined(TTY_FLIPBUF_SIZE)
39# define TTY_FLIPBUF_SIZE 512
40#endif
41
42
43
44# ifndef __user
45# define __user
46# define __kernel
47# define __safe
48# define __force
49# define __chk_user_ptr(x) (void)0
50# endif
51
52
53# define PARM_STR(VAR, INIT, PERM, DESC) \
54 static char *VAR = INIT; \
55 char *dgnc_##VAR; \
56 module_param(VAR, charp, PERM); \
57 MODULE_PARM_DESC(VAR, DESC);
58
59# define PARM_INT(VAR, INIT, PERM, DESC) \
60 static int VAR = INIT; \
61 int dgnc_##VAR; \
62 module_param(VAR, int, PERM); \
63 MODULE_PARM_DESC(VAR, DESC);
64
65# define PARM_ULONG(VAR, INIT, PERM, DESC) \
66 static ulong VAR = INIT; \
67 ulong dgnc_##VAR; \
68 module_param(VAR, long, PERM); \
69 MODULE_PARM_DESC(VAR, DESC);
70
71
72
73
74
75#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
76
77
78
79
80
81
82
83# else
84
85
86
87# error "this driver does not support anything below the 2.6.27 kernel series."
88
89
90
91# endif
92
93#endif
94