/[linux-patches]/genpatches-2.6/trunk/2.6.16/2600_input-mod-devicetable.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.16/2600_input-mod-devicetable.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 374 - (show annotations) (download) (as text)
Wed Apr 12 02:47:50 2006 UTC (14 years, 6 months ago) by dsd
File MIME type: text/x-diff
File size: 10194 byte(s)
New input.h userspace compile fix
1 Input: move input_device_id to mod_devicetable.h
2
3 Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
4 ---
5 drivers/input/input.c | 8 +--
6 include/linux/input.h | 104 ++++++++++++++++++++--------------------
7 include/linux/mod_devicetable.h | 48 ++++++++++++++++++
8 scripts/mod/file2alias.c | 36 ++++++-------
9 4 files changed, 122 insertions(+), 74 deletions(-)
10
11 Index: linux/include/linux/input.h
12 ===================================================================
13 --- linux.orig/include/linux/input.h
14 +++ linux/include/linux/input.h
15 @@ -12,8 +12,6 @@
16 #ifdef __KERNEL__
17 #include <linux/time.h>
18 #include <linux/list.h>
19 -#include <linux/device.h>
20 -#include <linux/mod_devicetable.h>
21 #else
22 #include <sys/time.h>
23 #include <sys/ioctl.h>
24 @@ -577,15 +575,15 @@ struct input_absinfo {
25 * Switch events
26 */
27
28 -#define SW_0 0x00
29 -#define SW_1 0x01
30 -#define SW_2 0x02
31 -#define SW_3 0x03
32 -#define SW_4 0x04
33 -#define SW_5 0x05
34 -#define SW_6 0x06
35 -#define SW_7 0x07
36 -#define SW_MAX 0x0f
37 +#define SW_0 0x00
38 +#define SW_1 0x01
39 +#define SW_2 0x02
40 +#define SW_3 0x03
41 +#define SW_4 0x04
42 +#define SW_5 0x05
43 +#define SW_6 0x06
44 +#define SW_7 0x07
45 +#define SW_MAX 0x0f
46
47 /*
48 * Misc events
49 @@ -805,52 +803,16 @@ struct ff_effect {
50
51 #define FF_MAX 0x7f
52
53 -struct input_device_id {
54 -
55 - kernel_ulong_t flags;
56 -
57 - struct input_id id;
58 -
59 - kernel_ulong_t evbit[EV_MAX/BITS_PER_LONG+1];
60 - kernel_ulong_t keybit[KEY_MAX/BITS_PER_LONG+1];
61 - kernel_ulong_t relbit[REL_MAX/BITS_PER_LONG+1];
62 - kernel_ulong_t absbit[ABS_MAX/BITS_PER_LONG+1];
63 - kernel_ulong_t mscbit[MSC_MAX/BITS_PER_LONG+1];
64 - kernel_ulong_t ledbit[LED_MAX/BITS_PER_LONG+1];
65 - kernel_ulong_t sndbit[SND_MAX/BITS_PER_LONG+1];
66 - kernel_ulong_t ffbit[FF_MAX/BITS_PER_LONG+1];
67 - kernel_ulong_t swbit[SW_MAX/BITS_PER_LONG+1];
68 -
69 - kernel_ulong_t driver_info;
70 -};
71 -
72 -/*
73 - * Structure for hotplug & device<->driver matching.
74 - */
75 -
76 -#define INPUT_DEVICE_ID_MATCH_BUS 1
77 -#define INPUT_DEVICE_ID_MATCH_VENDOR 2
78 -#define INPUT_DEVICE_ID_MATCH_PRODUCT 4
79 -#define INPUT_DEVICE_ID_MATCH_VERSION 8
80 -
81 -#define INPUT_DEVICE_ID_MATCH_EVBIT 0x010
82 -#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020
83 -#define INPUT_DEVICE_ID_MATCH_RELBIT 0x040
84 -#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080
85 -#define INPUT_DEVICE_ID_MATCH_MSCIT 0x100
86 -#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200
87 -#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400
88 -#define INPUT_DEVICE_ID_MATCH_FFBIT 0x800
89 -#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
90 -
91 #ifdef __KERNEL__
92
93 /*
94 * In-kernel definitions.
95 */
96
97 +#include <linux/device.h>
98 #include <linux/fs.h>
99 #include <linux/timer.h>
100 +#include <linux/mod_devicetable.h>
101
102 #define NBITS(x) (((x)/BITS_PER_LONG)+1)
103 #define BIT(x) (1UL<<((x)%BITS_PER_LONG))
104 @@ -951,9 +913,49 @@ struct input_dev {
105 };
106 #define to_input_dev(d) container_of(d, struct input_dev, cdev)
107
108 -#define INPUT_DEVICE_ID_MATCH_DEVICE\
109 +/*
110 + * Verify that we are in sync with input_device_id mod_devicetable.h #defines
111 + */
112 +
113 +#if EV_MAX != INPUT_DEVICE_ID_EV_MAX
114 +#error "EV_MAX and INPUT_DEVICE_ID_EV_MAX do not match"
115 +#endif
116 +
117 +#if KEY_MAX != INPUT_DEVICE_ID_KEY_MAX
118 +#error "KEY_MAX and INPUT_DEVICE_ID_KEY_MAX do not match"
119 +#endif
120 +
121 +#if REL_MAX != INPUT_DEVICE_ID_REL_MAX
122 +#error "REL_MAX and INPUT_DEVICE_ID_REL_MAX do not match"
123 +#endif
124 +
125 +#if ABS_MAX != INPUT_DEVICE_ID_ABS_MAX
126 +#error "ABS_MAX and INPUT_DEVICE_ID_ABS_MAX do not match"
127 +#endif
128 +
129 +#if MSC_MAX != INPUT_DEVICE_ID_MSC_MAX
130 +#error "MSC_MAX and INPUT_DEVICE_ID_MSC_MAX do not match"
131 +#endif
132 +
133 +#if LED_MAX != INPUT_DEVICE_ID_LED_MAX
134 +#error "LED_MAX and INPUT_DEVICE_ID_LED_MAX do not match"
135 +#endif
136 +
137 +#if SND_MAX != INPUT_DEVICE_ID_SND_MAX
138 +#error "SND_MAX and INPUT_DEVICE_ID_SND_MAX do not match"
139 +#endif
140 +
141 +#if FF_MAX != INPUT_DEVICE_ID_FF_MAX
142 +#error "FF_MAX and INPUT_DEVICE_ID_FF_MAX do not match"
143 +#endif
144 +
145 +#if SW_MAX != INPUT_DEVICE_ID_SW_MAX
146 +#error "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match"
147 +#endif
148 +
149 +#define INPUT_DEVICE_ID_MATCH_DEVICE \
150 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
151 -#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\
152 +#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION \
153 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)
154
155 struct input_handle;
156 Index: linux/include/linux/mod_devicetable.h
157 ===================================================================
158 --- linux.orig/include/linux/mod_devicetable.h
159 +++ linux/include/linux/mod_devicetable.h
160 @@ -249,4 +249,52 @@ struct i2c_device_id {
161 __u16 id;
162 };
163
164 +/* Input */
165 +#define INPUT_DEVICE_ID_EV_MAX 0x1f
166 +#define INPUT_DEVICE_ID_KEY_MAX 0x1ff
167 +#define INPUT_DEVICE_ID_REL_MAX 0x0f
168 +#define INPUT_DEVICE_ID_ABS_MAX 0x3f
169 +#define INPUT_DEVICE_ID_MSC_MAX 0x07
170 +#define INPUT_DEVICE_ID_LED_MAX 0x0f
171 +#define INPUT_DEVICE_ID_SND_MAX 0x07
172 +#define INPUT_DEVICE_ID_FF_MAX 0x7f
173 +#define INPUT_DEVICE_ID_SW_MAX 0x0f
174 +
175 +#define INPUT_DEVICE_ID_MATCH_BUS 1
176 +#define INPUT_DEVICE_ID_MATCH_VENDOR 2
177 +#define INPUT_DEVICE_ID_MATCH_PRODUCT 4
178 +#define INPUT_DEVICE_ID_MATCH_VERSION 8
179 +
180 +#define INPUT_DEVICE_ID_MATCH_EVBIT 0x0010
181 +#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x0020
182 +#define INPUT_DEVICE_ID_MATCH_RELBIT 0x0040
183 +#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x0080
184 +#define INPUT_DEVICE_ID_MATCH_MSCIT 0x0100
185 +#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x0200
186 +#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x0400
187 +#define INPUT_DEVICE_ID_MATCH_FFBIT 0x0800
188 +#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
189 +
190 +struct input_device_id {
191 +
192 + kernel_ulong_t flags;
193 +
194 + __u16 bustype;
195 + __u16 vendor;
196 + __u16 product;
197 + __u16 version;
198 +
199 + kernel_ulong_t evbit[INPUT_DEVICE_ID_EV_MAX / BITS_PER_LONG + 1];
200 + kernel_ulong_t keybit[INPUT_DEVICE_ID_KEY_MAX / BITS_PER_LONG + 1];
201 + kernel_ulong_t relbit[INPUT_DEVICE_ID_REL_MAX / BITS_PER_LONG + 1];
202 + kernel_ulong_t absbit[INPUT_DEVICE_ID_ABS_MAX / BITS_PER_LONG + 1];
203 + kernel_ulong_t mscbit[INPUT_DEVICE_ID_MSC_MAX / BITS_PER_LONG + 1];
204 + kernel_ulong_t ledbit[INPUT_DEVICE_ID_LED_MAX / BITS_PER_LONG + 1];
205 + kernel_ulong_t sndbit[INPUT_DEVICE_ID_SND_MAX / BITS_PER_LONG + 1];
206 + kernel_ulong_t ffbit[INPUT_DEVICE_ID_FF_MAX / BITS_PER_LONG + 1];
207 + kernel_ulong_t swbit[INPUT_DEVICE_ID_SW_MAX / BITS_PER_LONG + 1];
208 +
209 + kernel_ulong_t driver_info;
210 +};
211 +
212 #endif /* LINUX_MOD_DEVICETABLE_H */
213 Index: linux/scripts/mod/file2alias.c
214 ===================================================================
215 --- linux.orig/scripts/mod/file2alias.c
216 +++ linux/scripts/mod/file2alias.c
217 @@ -371,10 +371,10 @@ static void do_input(char *alias,
218 kernel_ulong_t *arr, unsigned int min, unsigned int max)
219 {
220 unsigned int i;
221 - for (i = min; i < max; i++) {
222 - if (arr[i/BITS_PER_LONG] & (1 << (i%BITS_PER_LONG)))
223 - sprintf(alias+strlen(alias), "%X,*", i);
224 - }
225 +
226 + for (i = min; i < max; i++)
227 + if (arr[i / BITS_PER_LONG] & (1 << (i%BITS_PER_LONG)))
228 + sprintf(alias + strlen(alias), "%X,*", i);
229 }
230
231 /* input:b0v0p0e0-eXkXrXaXmXlXsXfXwX where X is comma-separated %02X. */
232 @@ -383,39 +383,37 @@ static int do_input_entry(const char *fi
233 {
234 sprintf(alias, "input:");
235
236 - ADD(alias, "b", id->flags&INPUT_DEVICE_ID_MATCH_BUS, id->id.bustype);
237 - ADD(alias, "v", id->flags&INPUT_DEVICE_ID_MATCH_VENDOR, id->id.vendor);
238 - ADD(alias, "p", id->flags&INPUT_DEVICE_ID_MATCH_PRODUCT,
239 - id->id.product);
240 - ADD(alias, "e", id->flags&INPUT_DEVICE_ID_MATCH_VERSION,
241 - id->id.version);
242 + ADD(alias, "b", id->flags & INPUT_DEVICE_ID_MATCH_BUS, id->bustype);
243 + ADD(alias, "v", id->flags & INPUT_DEVICE_ID_MATCH_VENDOR, id->vendor);
244 + ADD(alias, "p", id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT, id->product);
245 + ADD(alias, "e", id->flags & INPUT_DEVICE_ID_MATCH_VERSION, id->version);
246
247 sprintf(alias + strlen(alias), "-e*");
248 - if (id->flags&INPUT_DEVICE_ID_MATCH_EVBIT)
249 + if (id->flags & INPUT_DEVICE_ID_MATCH_EVBIT)
250 do_input(alias, id->evbit, 0, EV_MAX);
251 sprintf(alias + strlen(alias), "k*");
252 - if (id->flags&INPUT_DEVICE_ID_MATCH_KEYBIT)
253 + if (id->flags & INPUT_DEVICE_ID_MATCH_KEYBIT)
254 do_input(alias, id->keybit, KEY_MIN_INTERESTING, KEY_MAX);
255 sprintf(alias + strlen(alias), "r*");
256 - if (id->flags&INPUT_DEVICE_ID_MATCH_RELBIT)
257 + if (id->flags & INPUT_DEVICE_ID_MATCH_RELBIT)
258 do_input(alias, id->relbit, 0, REL_MAX);
259 sprintf(alias + strlen(alias), "a*");
260 - if (id->flags&INPUT_DEVICE_ID_MATCH_ABSBIT)
261 + if (id->flags & INPUT_DEVICE_ID_MATCH_ABSBIT)
262 do_input(alias, id->absbit, 0, ABS_MAX);
263 sprintf(alias + strlen(alias), "m*");
264 - if (id->flags&INPUT_DEVICE_ID_MATCH_MSCIT)
265 + if (id->flags & INPUT_DEVICE_ID_MATCH_MSCIT)
266 do_input(alias, id->mscbit, 0, MSC_MAX);
267 sprintf(alias + strlen(alias), "l*");
268 - if (id->flags&INPUT_DEVICE_ID_MATCH_LEDBIT)
269 + if (id->flags & INPUT_DEVICE_ID_MATCH_LEDBIT)
270 do_input(alias, id->ledbit, 0, LED_MAX);
271 sprintf(alias + strlen(alias), "s*");
272 - if (id->flags&INPUT_DEVICE_ID_MATCH_SNDBIT)
273 + if (id->flags & INPUT_DEVICE_ID_MATCH_SNDBIT)
274 do_input(alias, id->sndbit, 0, SND_MAX);
275 sprintf(alias + strlen(alias), "f*");
276 - if (id->flags&INPUT_DEVICE_ID_MATCH_FFBIT)
277 + if (id->flags & INPUT_DEVICE_ID_MATCH_FFBIT)
278 do_input(alias, id->ffbit, 0, FF_MAX);
279 sprintf(alias + strlen(alias), "w*");
280 - if (id->flags&INPUT_DEVICE_ID_MATCH_SWBIT)
281 + if (id->flags & INPUT_DEVICE_ID_MATCH_SWBIT)
282 do_input(alias, id->swbit, 0, SW_MAX);
283 return 1;
284 }
285 Index: linux/drivers/input/input.c
286 ===================================================================
287 --- linux.orig/drivers/input/input.c
288 +++ linux/drivers/input/input.c
289 @@ -286,19 +286,19 @@ static struct input_device_id *input_mat
290 for (; id->flags || id->driver_info; id++) {
291
292 if (id->flags & INPUT_DEVICE_ID_MATCH_BUS)
293 - if (id->id.bustype != dev->id.bustype)
294 + if (id->bustype != dev->id.bustype)
295 continue;
296
297 if (id->flags & INPUT_DEVICE_ID_MATCH_VENDOR)
298 - if (id->id.vendor != dev->id.vendor)
299 + if (id->vendor != dev->id.vendor)
300 continue;
301
302 if (id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT)
303 - if (id->id.product != dev->id.product)
304 + if (id->product != dev->id.product)
305 continue;
306
307 if (id->flags & INPUT_DEVICE_ID_MATCH_VERSION)
308 - if (id->id.version != dev->id.version)
309 + if (id->version != dev->id.version)
310 continue;
311
312 MATCH_BIT(evbit, EV_MAX);
313

  ViewVC Help
Powered by ViewVC 1.1.20