aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/input
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/input')
-rw-r--r--drivers/usb/input/Kconfig14
-rw-r--r--drivers/usb/input/Makefile1
-rw-r--r--drivers/usb/input/acecad.c1
-rw-r--r--drivers/usb/input/aiptek.c9
-rw-r--r--drivers/usb/input/appletouch.c1
-rw-r--r--drivers/usb/input/ati_remote.c22
-rw-r--r--drivers/usb/input/ati_remote2.c477
-rw-r--r--drivers/usb/input/fixp-arith.h2
-rw-r--r--drivers/usb/input/hid-core.c3
-rw-r--r--drivers/usb/input/hid-input.c4
-rw-r--r--drivers/usb/input/hiddev.c1
-rw-r--r--drivers/usb/input/itmtouch.c1
-rw-r--r--drivers/usb/input/kbtab.c3
-rw-r--r--drivers/usb/input/keyspan_remote.c3
-rw-r--r--drivers/usb/input/mtouchusb.c1
-rw-r--r--drivers/usb/input/powermate.c1
-rw-r--r--drivers/usb/input/touchkitusb.c149
-rw-r--r--drivers/usb/input/usbkbd.c1
-rw-r--r--drivers/usb/input/usbmouse.c1
-rw-r--r--drivers/usb/input/wacom.c3
-rw-r--r--drivers/usb/input/xpad.c7
-rw-r--r--drivers/usb/input/yealink.c1
22 files changed, 643 insertions, 63 deletions
diff --git a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig
index 1e53934907c0..509dd0a04c54 100644
--- a/drivers/usb/input/Kconfig
+++ b/drivers/usb/input/Kconfig
@@ -273,6 +273,20 @@ config USB_ATI_REMOTE
273 To compile this driver as a module, choose M here: the module will be 273 To compile this driver as a module, choose M here: the module will be
274 called ati_remote. 274 called ati_remote.
275 275
276config USB_ATI_REMOTE2
277 tristate "ATI / Philips USB RF remote control"
278 depends on USB && INPUT
279 ---help---
280 Say Y here if you want to use an ATI or Philips USB RF remote control.
281 These are RF remotes with USB receivers.
282 ATI Remote Wonder II comes with some ATI's All-In-Wonder video cards
283 and is also available as a separate product.
284 This driver provides mouse pointer, left and right mouse buttons,
285 and maps all the other remote buttons to keypress events.
286
287 To compile this driver as a module, choose M here: the module will be
288 called ati_remote2.
289
276config USB_KEYSPAN_REMOTE 290config USB_KEYSPAN_REMOTE
277 tristate "Keyspan DMR USB remote control (EXPERIMENTAL)" 291 tristate "Keyspan DMR USB remote control (EXPERIMENTAL)"
278 depends on USB && INPUT && EXPERIMENTAL 292 depends on USB && INPUT && EXPERIMENTAL
diff --git a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile
index 07cb17db42fc..d512d9f488fe 100644
--- a/drivers/usb/input/Makefile
+++ b/drivers/usb/input/Makefile
@@ -28,6 +28,7 @@ endif
28 28
29obj-$(CONFIG_USB_AIPTEK) += aiptek.o 29obj-$(CONFIG_USB_AIPTEK) += aiptek.o
30obj-$(CONFIG_USB_ATI_REMOTE) += ati_remote.o 30obj-$(CONFIG_USB_ATI_REMOTE) += ati_remote.o
31obj-$(CONFIG_USB_ATI_REMOTE2) += ati_remote2.o
31obj-$(CONFIG_USB_HID) += usbhid.o 32obj-$(CONFIG_USB_HID) += usbhid.o
32obj-$(CONFIG_USB_KBD) += usbkbd.o 33obj-$(CONFIG_USB_KBD) += usbkbd.o
33obj-$(CONFIG_USB_KBTAB) += kbtab.o 34obj-$(CONFIG_USB_KBTAB) += kbtab.o
diff --git a/drivers/usb/input/acecad.c b/drivers/usb/input/acecad.c
index a32558b4048e..df29b8078b54 100644
--- a/drivers/usb/input/acecad.c
+++ b/drivers/usb/input/acecad.c
@@ -261,7 +261,6 @@ static struct usb_device_id usb_acecad_id_table [] = {
261MODULE_DEVICE_TABLE(usb, usb_acecad_id_table); 261MODULE_DEVICE_TABLE(usb, usb_acecad_id_table);
262 262
263static struct usb_driver usb_acecad_driver = { 263static struct usb_driver usb_acecad_driver = {
264 .owner = THIS_MODULE,
265 .name = "usb_acecad", 264 .name = "usb_acecad",
266 .probe = usb_acecad_probe, 265 .probe = usb_acecad_probe,
267 .disconnect = usb_acecad_disconnect, 266 .disconnect = usb_acecad_disconnect,
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
index 1c3b472a3bca..a6693b0d1c4c 100644
--- a/drivers/usb/input/aiptek.c
+++ b/drivers/usb/input/aiptek.c
@@ -338,7 +338,7 @@ struct aiptek {
338 * the bitmap which comes from the tablet. This hides the 338 * the bitmap which comes from the tablet. This hides the
339 * issue that the F_keys are not sequentially numbered. 339 * issue that the F_keys are not sequentially numbered.
340 */ 340 */
341static int macroKeyEvents[] = { 341static const int macroKeyEvents[] = {
342 KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, 342 KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5,
343 KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, 343 KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11,
344 KEY_F12, KEY_F13, KEY_F14, KEY_F15, KEY_F16, KEY_F17, 344 KEY_F12, KEY_F13, KEY_F14, KEY_F15, KEY_F16, KEY_F17,
@@ -2093,7 +2093,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
2093 /* Programming the tablet macro keys needs to be done with a for loop 2093 /* Programming the tablet macro keys needs to be done with a for loop
2094 * as the keycodes are discontiguous. 2094 * as the keycodes are discontiguous.
2095 */ 2095 */
2096 for (i = 0; i < sizeof(macroKeyEvents) / sizeof(macroKeyEvents[0]); ++i) 2096 for (i = 0; i < ARRAY_SIZE(macroKeyEvents); ++i)
2097 set_bit(macroKeyEvents[i], inputdev->keybit); 2097 set_bit(macroKeyEvents[i], inputdev->keybit);
2098 2098
2099 /* 2099 /*
@@ -2103,7 +2103,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
2103 * values. 2103 * values.
2104 */ 2104 */
2105 input_set_abs_params(inputdev, ABS_X, 0, 2999, 0, 0); 2105 input_set_abs_params(inputdev, ABS_X, 0, 2999, 0, 0);
2106 input_set_abs_params(inputdev, ABS_X, 0, 2249, 0, 0); 2106 input_set_abs_params(inputdev, ABS_Y, 0, 2249, 0, 0);
2107 input_set_abs_params(inputdev, ABS_PRESSURE, 0, 511, 0, 0); 2107 input_set_abs_params(inputdev, ABS_PRESSURE, 0, 511, 0, 0);
2108 input_set_abs_params(inputdev, ABS_TILT_X, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0); 2108 input_set_abs_params(inputdev, ABS_TILT_X, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0);
2109 input_set_abs_params(inputdev, ABS_TILT_Y, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0); 2109 input_set_abs_params(inputdev, ABS_TILT_Y, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0);
@@ -2135,7 +2135,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
2135 * not an error :-) 2135 * not an error :-)
2136 */ 2136 */
2137 2137
2138 for (i = 0; i < sizeof(speeds) / sizeof(speeds[0]); ++i) { 2138 for (i = 0; i < ARRAY_SIZE(speeds); ++i) {
2139 aiptek->curSetting.programmableDelay = speeds[i]; 2139 aiptek->curSetting.programmableDelay = speeds[i];
2140 (void)aiptek_program_tablet(aiptek); 2140 (void)aiptek_program_tablet(aiptek);
2141 if (aiptek->inputdev->absmax[ABS_X] > 0) { 2141 if (aiptek->inputdev->absmax[ABS_X] > 0) {
@@ -2190,7 +2190,6 @@ fail1: input_free_device(inputdev);
2190static void aiptek_disconnect(struct usb_interface *intf); 2190static void aiptek_disconnect(struct usb_interface *intf);
2191 2191
2192static struct usb_driver aiptek_driver = { 2192static struct usb_driver aiptek_driver = {
2193 .owner = THIS_MODULE,
2194 .name = "aiptek", 2193 .name = "aiptek",
2195 .probe = aiptek_probe, 2194 .probe = aiptek_probe,
2196 .disconnect = aiptek_disconnect, 2195 .disconnect = aiptek_disconnect,
diff --git a/drivers/usb/input/appletouch.c b/drivers/usb/input/appletouch.c
index 6cce8527ba06..c222ed13deab 100644
--- a/drivers/usb/input/appletouch.c
+++ b/drivers/usb/input/appletouch.c
@@ -525,7 +525,6 @@ static int atp_resume(struct usb_interface *iface)
525} 525}
526 526
527static struct usb_driver atp_driver = { 527static struct usb_driver atp_driver = {
528 .owner = THIS_MODULE,
529 .name = "appletouch", 528 .name = "appletouch",
530 .probe = atp_probe, 529 .probe = atp_probe,
531 .disconnect = atp_disconnect, 530 .disconnect = atp_disconnect,
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
index 9a2a47db9494..f7bdc506e613 100644
--- a/drivers/usb/input/ati_remote.c
+++ b/drivers/usb/input/ati_remote.c
@@ -96,6 +96,7 @@
96#include <linux/usb.h> 96#include <linux/usb.h>
97#include <linux/usb_input.h> 97#include <linux/usb_input.h>
98#include <linux/wait.h> 98#include <linux/wait.h>
99#include <linux/jiffies.h>
99 100
100/* 101/*
101 * Module and Version Information, Module Parameters 102 * Module and Version Information, Module Parameters
@@ -146,7 +147,7 @@ static char init1[] = { 0x01, 0x00, 0x20, 0x14 };
146static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 }; 147static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 };
147 148
148/* Acceleration curve for directional control pad */ 149/* Acceleration curve for directional control pad */
149static char accel[] = { 1, 2, 4, 6, 9, 13, 20 }; 150static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 };
150 151
151/* Duplicate event filtering time. 152/* Duplicate event filtering time.
152 * Sequential, identical KIND_FILTERED inputs with less than 153 * Sequential, identical KIND_FILTERED inputs with less than
@@ -197,7 +198,7 @@ struct ati_remote {
197#define KIND_ACCEL 7 /* Directional keypad - left, right, up, down.*/ 198#define KIND_ACCEL 7 /* Directional keypad - left, right, up, down.*/
198 199
199/* Translation table from hardware messages to input events. */ 200/* Translation table from hardware messages to input events. */
200static struct { 201static const struct {
201 short kind; 202 short kind;
202 unsigned char data1, data2; 203 unsigned char data1, data2;
203 int type; 204 int type;
@@ -295,7 +296,6 @@ static void ati_remote_disconnect (struct usb_interface *interface);
295 296
296/* usb specific object to register with the usb subsystem */ 297/* usb specific object to register with the usb subsystem */
297static struct usb_driver ati_remote_driver = { 298static struct usb_driver ati_remote_driver = {
298 .owner = THIS_MODULE,
299 .name = "ati_remote", 299 .name = "ati_remote",
300 .probe = ati_remote_probe, 300 .probe = ati_remote_probe,
301 .disconnect = ati_remote_disconnect, 301 .disconnect = ati_remote_disconnect,
@@ -472,7 +472,7 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
472 /* Filter duplicate events which happen "too close" together. */ 472 /* Filter duplicate events which happen "too close" together. */
473 if ((ati_remote->old_data[0] == data[1]) && 473 if ((ati_remote->old_data[0] == data[1]) &&
474 (ati_remote->old_data[1] == data[2]) && 474 (ati_remote->old_data[1] == data[2]) &&
475 ((ati_remote->old_jiffies + FILTER_TIME) > jiffies)) { 475 time_before(jiffies, ati_remote->old_jiffies + FILTER_TIME)) {
476 ati_remote->repeat_count++; 476 ati_remote->repeat_count++;
477 } else { 477 } else {
478 ati_remote->repeat_count = 0; 478 ati_remote->repeat_count = 0;
@@ -507,16 +507,16 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
507 * pad down, so we increase acceleration, ramping up over two seconds to 507 * pad down, so we increase acceleration, ramping up over two seconds to
508 * a maximum speed. The acceleration curve is #defined above. 508 * a maximum speed. The acceleration curve is #defined above.
509 */ 509 */
510 if ((jiffies - ati_remote->old_jiffies) > (HZ >> 2)) { 510 if (time_after(jiffies, ati_remote->old_jiffies + (HZ >> 2))) {
511 acc = 1; 511 acc = 1;
512 ati_remote->acc_jiffies = jiffies; 512 ati_remote->acc_jiffies = jiffies;
513 } 513 }
514 else if ((jiffies - ati_remote->acc_jiffies) < (HZ >> 3)) acc = accel[0]; 514 else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 3))) acc = accel[0];
515 else if ((jiffies - ati_remote->acc_jiffies) < (HZ >> 2)) acc = accel[1]; 515 else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 2))) acc = accel[1];
516 else if ((jiffies - ati_remote->acc_jiffies) < (HZ >> 1)) acc = accel[2]; 516 else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 1))) acc = accel[2];
517 else if ((jiffies - ati_remote->acc_jiffies) < HZ ) acc = accel[3]; 517 else if (time_before(jiffies, ati_remote->acc_jiffies + HZ)) acc = accel[3];
518 else if ((jiffies - ati_remote->acc_jiffies) < HZ+(HZ>>1)) acc = accel[4]; 518 else if (time_before(jiffies, ati_remote->acc_jiffies + HZ+(HZ>>1))) acc = accel[4];
519 else if ((jiffies - ati_remote->acc_jiffies) < (HZ << 1)) acc = accel[5]; 519 else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ << 1))) acc = accel[5];
520 else acc = accel[6]; 520 else acc = accel[6];
521 521
522 input_regs(dev, regs); 522 input_regs(dev, regs);
diff --git a/drivers/usb/input/ati_remote2.c b/drivers/usb/input/ati_remote2.c
new file mode 100644
index 000000000000..ab1a1ae24be9
--- /dev/null
+++ b/drivers/usb/input/ati_remote2.c
@@ -0,0 +1,477 @@
1/*
2 * ati_remote2 - ATI/Philips USB RF remote driver
3 *
4 * Copyright (C) 2005 Ville Syrjala <syrjala@sci.fi>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 */
10
11#include <linux/usb_input.h>
12
13#define DRIVER_DESC "ATI/Philips USB RF remote driver"
14#define DRIVER_VERSION "0.1"
15
16MODULE_DESCRIPTION(DRIVER_DESC);
17MODULE_VERSION(DRIVER_VERSION);
18MODULE_AUTHOR("Ville Syrjala <syrjala@sci.fi>");
19MODULE_LICENSE("GPL");
20
21static unsigned int mode_mask = 0x1F;
22module_param(mode_mask, uint, 0644);
23MODULE_PARM_DESC(mode_mask, "Bitmask of modes to accept <4:PC><3:AUX4><2:AUX3><1:AUX2><0:AUX1>");
24
25static struct usb_device_id ati_remote2_id_table[] = {
26 { USB_DEVICE(0x0471, 0x0602) }, /* ATI Remote Wonder II */
27 { }
28};
29MODULE_DEVICE_TABLE(usb, ati_remote2_id_table);
30
31static struct {
32 int hw_code;
33 int key_code;
34} ati_remote2_key_table[] = {
35 { 0x00, KEY_0 },
36 { 0x01, KEY_1 },
37 { 0x02, KEY_2 },
38 { 0x03, KEY_3 },
39 { 0x04, KEY_4 },
40 { 0x05, KEY_5 },
41 { 0x06, KEY_6 },
42 { 0x07, KEY_7 },
43 { 0x08, KEY_8 },
44 { 0x09, KEY_9 },
45 { 0x0c, KEY_POWER },
46 { 0x0d, KEY_MUTE },
47 { 0x10, KEY_VOLUMEUP },
48 { 0x11, KEY_VOLUMEDOWN },
49 { 0x20, KEY_CHANNELUP },
50 { 0x21, KEY_CHANNELDOWN },
51 { 0x28, KEY_FORWARD },
52 { 0x29, KEY_REWIND },
53 { 0x2c, KEY_PLAY },
54 { 0x30, KEY_PAUSE },
55 { 0x31, KEY_STOP },
56 { 0x37, KEY_RECORD },
57 { 0x38, KEY_DVD },
58 { 0x39, KEY_TV },
59 { 0x54, KEY_MENU },
60 { 0x58, KEY_UP },
61 { 0x59, KEY_DOWN },
62 { 0x5a, KEY_LEFT },
63 { 0x5b, KEY_RIGHT },
64 { 0x5c, KEY_OK },
65 { 0x78, KEY_A },
66 { 0x79, KEY_B },
67 { 0x7a, KEY_C },
68 { 0x7b, KEY_D },
69 { 0x7c, KEY_E },
70 { 0x7d, KEY_F },
71 { 0x82, KEY_ENTER },
72 { 0x8e, KEY_VENDOR },
73 { 0x96, KEY_COFFEE },
74 { 0xa9, BTN_LEFT },
75 { 0xaa, BTN_RIGHT },
76 { 0xbe, KEY_QUESTION },
77 { 0xd5, KEY_FRONT },
78 { 0xd0, KEY_EDIT },
79 { 0xf9, KEY_INFO },
80 { (0x00 << 8) | 0x3f, KEY_PROG1 },
81 { (0x01 << 8) | 0x3f, KEY_PROG2 },
82 { (0x02 << 8) | 0x3f, KEY_PROG3 },
83 { (0x03 << 8) | 0x3f, KEY_PROG4 },
84 { (0x04 << 8) | 0x3f, KEY_PC },
85 { 0, KEY_RESERVED }
86};
87
88struct ati_remote2 {
89 struct input_dev *idev;
90 struct usb_device *udev;
91
92 struct usb_interface *intf[2];
93 struct usb_endpoint_descriptor *ep[2];
94 struct urb *urb[2];
95 void *buf[2];
96 dma_addr_t buf_dma[2];
97
98 unsigned long jiffies;
99 int mode;
100
101 char name[64];
102 char phys[64];
103};
104
105static int ati_remote2_probe(struct usb_interface *interface, const struct usb_device_id *id);
106static void ati_remote2_disconnect(struct usb_interface *interface);
107
108static struct usb_driver ati_remote2_driver = {
109 .name = "ati_remote2",
110 .probe = ati_remote2_probe,
111 .disconnect = ati_remote2_disconnect,
112 .id_table = ati_remote2_id_table,
113};
114
115static int ati_remote2_open(struct input_dev *idev)
116{
117 struct ati_remote2 *ar2 = idev->private;
118 int r;
119
120 r = usb_submit_urb(ar2->urb[0], GFP_KERNEL);
121 if (r) {
122 dev_err(&ar2->intf[0]->dev,
123 "%s: usb_submit_urb() = %d\n", __FUNCTION__, r);
124 return r;
125 }
126 r = usb_submit_urb(ar2->urb[1], GFP_KERNEL);
127 if (r) {
128 usb_kill_urb(ar2->urb[0]);
129 dev_err(&ar2->intf[1]->dev,
130 "%s: usb_submit_urb() = %d\n", __FUNCTION__, r);
131 return r;
132 }
133
134 return 0;
135}
136
137static void ati_remote2_close(struct input_dev *idev)
138{
139 struct ati_remote2 *ar2 = idev->private;
140
141 usb_kill_urb(ar2->urb[0]);
142 usb_kill_urb(ar2->urb[1]);
143}
144
145static void ati_remote2_input_mouse(struct ati_remote2 *ar2, struct pt_regs *regs)
146{
147 struct input_dev *idev = ar2->idev;
148 u8 *data = ar2->buf[0];
149
150 if (data[0] > 4) {
151 dev_err(&ar2->intf[0]->dev,
152 "Unknown mode byte (%02x %02x %02x %02x)\n",
153 data[3], data[2], data[1], data[0]);
154 return;
155 }
156
157 if (!((1 << data[0]) & mode_mask))
158 return;
159
160 input_regs(idev, regs);
161 input_event(idev, EV_REL, REL_X, (s8) data[1]);
162 input_event(idev, EV_REL, REL_Y, (s8) data[2]);
163 input_sync(idev);
164}
165
166static int ati_remote2_lookup(unsigned int hw_code)
167{
168 int i;
169
170 for (i = 0; ati_remote2_key_table[i].key_code != KEY_RESERVED; i++)
171 if (ati_remote2_key_table[i].hw_code == hw_code)
172 return i;
173
174 return -1;
175}
176
177static void ati_remote2_input_key(struct ati_remote2 *ar2, struct pt_regs *regs)
178{
179 struct input_dev *idev = ar2->idev;
180 u8 *data = ar2->buf[1];
181 int hw_code, index;
182
183 if (data[0] > 4) {
184 dev_err(&ar2->intf[1]->dev,
185 "Unknown mode byte (%02x %02x %02x %02x)\n",
186 data[3], data[2], data[1], data[0]);
187 return;
188 }
189
190 hw_code = data[2];
191 /*
192 * Mode keys (AUX1-AUX4, PC) all generate the same code byte.
193 * Use the mode byte to figure out which one was pressed.
194 */
195 if (hw_code == 0x3f) {
196 /*
197 * For some incomprehensible reason the mouse pad generates
198 * events which look identical to the events from the last
199 * pressed mode key. Naturally we don't want to generate key
200 * events for the mouse pad so we filter out any subsequent
201 * events from the same mode key.
202 */
203 if (ar2->mode == data[0])
204 return;
205
206 if (data[1] == 0)
207 ar2->mode = data[0];
208
209 hw_code |= data[0] << 8;
210 }
211
212 if (!((1 << data[0]) & mode_mask))
213 return;
214
215 index = ati_remote2_lookup(hw_code);
216 if (index < 0) {
217 dev_err(&ar2->intf[1]->dev,
218 "Unknown code byte (%02x %02x %02x %02x)\n",
219 data[3], data[2], data[1], data[0]);
220 return;
221 }
222
223 switch (data[1]) {
224 case 0: /* release */
225 break;
226 case 1: /* press */
227 ar2->jiffies = jiffies + msecs_to_jiffies(idev->rep[REP_DELAY]);
228 break;
229 case 2: /* repeat */
230
231 /* No repeat for mouse buttons. */
232 if (ati_remote2_key_table[index].key_code == BTN_LEFT ||
233 ati_remote2_key_table[index].key_code == BTN_RIGHT)
234 return;
235
236 if (!time_after_eq(jiffies, ar2->jiffies))
237 return;
238
239 ar2->jiffies = jiffies + msecs_to_jiffies(idev->rep[REP_PERIOD]);
240 break;
241 default:
242 dev_err(&ar2->intf[1]->dev,
243 "Unknown state byte (%02x %02x %02x %02x)\n",
244 data[3], data[2], data[1], data[0]);
245 return;
246 }
247
248 input_regs(idev, regs);
249 input_event(idev, EV_KEY, ati_remote2_key_table[index].key_code, data[1]);
250 input_sync(idev);
251}
252
253static void ati_remote2_complete_mouse(struct urb *urb, struct pt_regs *regs)
254{
255 struct ati_remote2 *ar2 = urb->context;
256 int r;
257
258 switch (urb->status) {
259 case 0:
260 ati_remote2_input_mouse(ar2, regs);
261 break;
262 case -ENOENT:
263 case -EILSEQ:
264 case -ECONNRESET:
265 case -ESHUTDOWN:
266 dev_dbg(&ar2->intf[0]->dev,
267 "%s(): urb status = %d\n", __FUNCTION__, urb->status);
268 return;
269 default:
270 dev_err(&ar2->intf[0]->dev,
271 "%s(): urb status = %d\n", __FUNCTION__, urb->status);
272 }
273
274 r = usb_submit_urb(urb, GFP_ATOMIC);
275 if (r)
276 dev_err(&ar2->intf[0]->dev,
277 "%s(): usb_submit_urb() = %d\n", __FUNCTION__, r);
278}
279
280static void ati_remote2_complete_key(struct urb *urb, struct pt_regs *regs)
281{
282 struct ati_remote2 *ar2 = urb->context;
283 int r;
284
285 switch (urb->status) {
286 case 0:
287 ati_remote2_input_key(ar2, regs);
288 break;
289 case -ENOENT:
290 case -EILSEQ:
291 case -ECONNRESET:
292 case -ESHUTDOWN:
293 dev_dbg(&ar2->intf[1]->dev,
294 "%s(): urb status = %d\n", __FUNCTION__, urb->status);
295 return;
296 default:
297 dev_err(&ar2->intf[1]->dev,
298 "%s(): urb status = %d\n", __FUNCTION__, urb->status);
299 }
300
301 r = usb_submit_urb(urb, GFP_ATOMIC);
302 if (r)
303 dev_err(&ar2->intf[1]->dev,
304 "%s(): usb_submit_urb() = %d\n", __FUNCTION__, r);
305}
306
307static int ati_remote2_input_init(struct ati_remote2 *ar2)
308{
309 struct input_dev *idev;
310 int i;
311
312 idev = input_allocate_device();
313 if (!idev)
314 return -ENOMEM;
315
316 ar2->idev = idev;
317 idev->private = ar2;
318
319 idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_REL);
320 idev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT);
321 idev->relbit[0] = BIT(REL_X) | BIT(REL_Y);
322 for (i = 0; ati_remote2_key_table[i].key_code != KEY_RESERVED; i++)
323 set_bit(ati_remote2_key_table[i].key_code, idev->keybit);
324
325 idev->rep[REP_DELAY] = 250;
326 idev->rep[REP_PERIOD] = 33;
327
328 idev->open = ati_remote2_open;
329 idev->close = ati_remote2_close;
330
331 idev->name = ar2->name;
332 idev->phys = ar2->phys;
333
334 usb_to_input_id(ar2->udev, &idev->id);
335 idev->cdev.dev = &ar2->udev->dev;
336
337 i = input_register_device(idev);
338 if (i)
339 input_free_device(idev);
340
341 return i;
342}
343
344static int ati_remote2_urb_init(struct ati_remote2 *ar2)
345{
346 struct usb_device *udev = ar2->udev;
347 int i, pipe, maxp;
348
349 for (i = 0; i < 2; i++) {
350 ar2->buf[i] = usb_buffer_alloc(udev, 4, GFP_KERNEL, &ar2->buf_dma[i]);
351 if (!ar2->buf[i])
352 return -ENOMEM;
353
354 ar2->urb[i] = usb_alloc_urb(0, GFP_KERNEL);
355 if (!ar2->urb[i])
356 return -ENOMEM;
357
358 pipe = usb_rcvintpipe(udev, ar2->ep[i]->bEndpointAddress);
359 maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
360 maxp = maxp > 4 ? 4 : maxp;
361
362 usb_fill_int_urb(ar2->urb[i], udev, pipe, ar2->buf[i], maxp,
363 i ? ati_remote2_complete_key : ati_remote2_complete_mouse,
364 ar2, ar2->ep[i]->bInterval);
365 ar2->urb[i]->transfer_dma = ar2->buf_dma[i];
366 ar2->urb[i]->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
367 }
368
369 return 0;
370}
371
372static void ati_remote2_urb_cleanup(struct ati_remote2 *ar2)
373{
374 int i;
375
376 for (i = 0; i < 2; i++) {
377 if (ar2->urb[i])
378 usb_free_urb(ar2->urb[i]);
379
380 if (ar2->buf[i])
381 usb_buffer_free(ar2->udev, 4, ar2->buf[i], ar2->buf_dma[i]);
382 }
383}
384
385static int ati_remote2_probe(struct usb_interface *interface, const struct usb_device_id *id)
386{
387 struct usb_device *udev = interface_to_usbdev(interface);
388 struct usb_host_interface *alt = interface->cur_altsetting;
389 struct ati_remote2 *ar2;
390 int r;
391
392 if (alt->desc.bInterfaceNumber)
393 return -ENODEV;
394
395 ar2 = kzalloc(sizeof (struct ati_remote2), GFP_KERNEL);
396 if (!ar2)
397 return -ENOMEM;
398
399 ar2->udev = udev;
400
401 ar2->intf[0] = interface;
402 ar2->ep[0] = &alt->endpoint[0].desc;
403
404 ar2->intf[1] = usb_ifnum_to_if(udev, 1);
405 r = usb_driver_claim_interface(&ati_remote2_driver, ar2->intf[1], ar2);
406 if (r)
407 goto fail1;
408 alt = ar2->intf[1]->cur_altsetting;
409 ar2->ep[1] = &alt->endpoint[0].desc;
410
411 r = ati_remote2_urb_init(ar2);
412 if (r)
413 goto fail2;
414
415 usb_make_path(udev, ar2->phys, sizeof(ar2->phys));
416 strlcat(ar2->phys, "/input0", sizeof(ar2->phys));
417
418 strlcat(ar2->name, "ATI Remote Wonder II", sizeof(ar2->name));
419
420 r = ati_remote2_input_init(ar2);
421 if (r)
422 goto fail2;
423
424 usb_set_intfdata(interface, ar2);
425
426 return 0;
427
428 fail2:
429 ati_remote2_urb_cleanup(ar2);
430
431 usb_driver_release_interface(&ati_remote2_driver, ar2->intf[1]);
432 fail1:
433 kfree(ar2);
434
435 return r;
436}
437
438static void ati_remote2_disconnect(struct usb_interface *interface)
439{
440 struct ati_remote2 *ar2;
441 struct usb_host_interface *alt = interface->cur_altsetting;
442
443 if (alt->desc.bInterfaceNumber)
444 return;
445
446 ar2 = usb_get_intfdata(interface);
447 usb_set_intfdata(interface, NULL);
448
449 input_unregister_device(ar2->idev);
450
451 ati_remote2_urb_cleanup(ar2);
452
453 usb_driver_release_interface(&ati_remote2_driver, ar2->intf[1]);
454
455 kfree(ar2);
456}
457
458static int __init ati_remote2_init(void)
459{
460 int r;
461
462 r = usb_register(&ati_remote2_driver);
463 if (r)
464 printk(KERN_ERR "ati_remote2: usb_register() = %d\n", r);
465 else
466 printk(KERN_INFO "ati_remote2: " DRIVER_DESC " " DRIVER_VERSION "\n");
467
468 return r;
469}
470
471static void __exit ati_remote2_exit(void)
472{
473 usb_deregister(&ati_remote2_driver);
474}
475
476module_init(ati_remote2_init);
477module_exit(ati_remote2_exit);
diff --git a/drivers/usb/input/fixp-arith.h b/drivers/usb/input/fixp-arith.h
index 26ca5b890a61..b44d398de071 100644
--- a/drivers/usb/input/fixp-arith.h
+++ b/drivers/usb/input/fixp-arith.h
@@ -38,7 +38,7 @@ typedef s16 fixp_t;
38#define FRAC_MASK ((1<<FRAC_N)-1) 38#define FRAC_MASK ((1<<FRAC_N)-1)
39 39
40// Not to be used directly. Use fixp_{cos,sin} 40// Not to be used directly. Use fixp_{cos,sin}
41static fixp_t cos_table[45] = { 41static const fixp_t cos_table[45] = {
42 0x0100, 0x00FF, 0x00FF, 0x00FE, 0x00FD, 0x00FC, 0x00FA, 0x00F8, 42 0x0100, 0x00FF, 0x00FF, 0x00FE, 0x00FD, 0x00FC, 0x00FA, 0x00F8,
43 0x00F6, 0x00F3, 0x00F0, 0x00ED, 0x00E9, 0x00E6, 0x00E2, 0x00DD, 43 0x00F6, 0x00F3, 0x00F0, 0x00ED, 0x00E9, 0x00E6, 0x00E2, 0x00DD,
44 0x00D9, 0x00D4, 0x00CF, 0x00C9, 0x00C4, 0x00BE, 0x00B8, 0x00B1, 44 0x00D9, 0x00D4, 0x00CF, 0x00C9, 0x00C4, 0x00BE, 0x00B8, 0x00B1,
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index a3e44ef1df43..5f52979af1c7 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -1454,7 +1454,7 @@ void hid_init_reports(struct hid_device *hid)
1454 * Alphabetically sorted blacklist by quirk type. 1454 * Alphabetically sorted blacklist by quirk type.
1455 */ 1455 */
1456 1456
1457static struct hid_blacklist { 1457static const struct hid_blacklist {
1458 __u16 idVendor; 1458 __u16 idVendor;
1459 __u16 idProduct; 1459 __u16 idProduct;
1460 unsigned quirks; 1460 unsigned quirks;
@@ -1930,7 +1930,6 @@ static struct usb_device_id hid_usb_ids [] = {
1930MODULE_DEVICE_TABLE (usb, hid_usb_ids); 1930MODULE_DEVICE_TABLE (usb, hid_usb_ids);
1931 1931
1932static struct usb_driver hid_driver = { 1932static struct usb_driver hid_driver = {
1933 .owner = THIS_MODULE,
1934 .name = "usbhid", 1933 .name = "usbhid",
1935 .probe = hid_probe, 1934 .probe = hid_probe,
1936 .disconnect = hid_disconnect, 1935 .disconnect = hid_disconnect,
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c
index 1220a5004a5c..192a03b28971 100644
--- a/drivers/usb/input/hid-input.c
+++ b/drivers/usb/input/hid-input.c
@@ -39,7 +39,7 @@
39 39
40#define unk KEY_UNKNOWN 40#define unk KEY_UNKNOWN
41 41
42static unsigned char hid_keyboard[256] = { 42static const unsigned char hid_keyboard[256] = {
43 0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, 43 0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38,
44 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44, 2, 3, 44 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44, 2, 3,
45 4, 5, 6, 7, 8, 9, 10, 11, 28, 1, 14, 15, 57, 12, 13, 26, 45 4, 5, 6, 7, 8, 9, 10, 11, 28, 1, 14, 15, 57, 12, 13, 26,
@@ -58,7 +58,7 @@ static unsigned char hid_keyboard[256] = {
58 150,158,159,128,136,177,178,176,142,152,173,140,unk,unk,unk,unk 58 150,158,159,128,136,177,178,176,142,152,173,140,unk,unk,unk,unk
59}; 59};
60 60
61static struct { 61static const struct {
62 __s32 x; 62 __s32 x;
63 __s32 y; 63 __s32 y;
64} hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}}; 64} hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}};
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c
index 440377c7a0da..4dff8473553d 100644
--- a/drivers/usb/input/hiddev.c
+++ b/drivers/usb/input/hiddev.c
@@ -826,7 +826,6 @@ static int hiddev_usbd_probe(struct usb_interface *intf,
826 826
827 827
828static /* const */ struct usb_driver hiddev_driver = { 828static /* const */ struct usb_driver hiddev_driver = {
829 .owner = THIS_MODULE,
830 .name = "hiddev", 829 .name = "hiddev",
831 .probe = hiddev_usbd_probe, 830 .probe = hiddev_usbd_probe,
832}; 831};
diff --git a/drivers/usb/input/itmtouch.c b/drivers/usb/input/itmtouch.c
index 4a50acb39d29..7618ae5c104f 100644
--- a/drivers/usb/input/itmtouch.c
+++ b/drivers/usb/input/itmtouch.c
@@ -250,7 +250,6 @@ static void itmtouch_disconnect(struct usb_interface *intf)
250MODULE_DEVICE_TABLE(usb, itmtouch_ids); 250MODULE_DEVICE_TABLE(usb, itmtouch_ids);
251 251
252static struct usb_driver itmtouch_driver = { 252static struct usb_driver itmtouch_driver = {
253 .owner = THIS_MODULE,
254 .name = "itmtouch", 253 .name = "itmtouch",
255 .probe = itmtouch_probe, 254 .probe = itmtouch_probe,
256 .disconnect = itmtouch_disconnect, 255 .disconnect = itmtouch_disconnect,
diff --git a/drivers/usb/input/kbtab.c b/drivers/usb/input/kbtab.c
index a248664b5d1d..f6d5cead542b 100644
--- a/drivers/usb/input/kbtab.c
+++ b/drivers/usb/input/kbtab.c
@@ -159,7 +159,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
159 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH); 159 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH);
160 input_dev->mscbit[0] |= BIT(MSC_SERIAL); 160 input_dev->mscbit[0] |= BIT(MSC_SERIAL);
161 input_set_abs_params(input_dev, ABS_X, 0, 0x2000, 4, 0); 161 input_set_abs_params(input_dev, ABS_X, 0, 0x2000, 4, 0);
162 input_set_abs_params(input_dev, ABS_X, 0, 0x1750, 4, 0); 162 input_set_abs_params(input_dev, ABS_Y, 0, 0x1750, 4, 0);
163 input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xff, 0, 0); 163 input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xff, 0, 0);
164 164
165 endpoint = &intf->cur_altsetting->endpoint[0].desc; 165 endpoint = &intf->cur_altsetting->endpoint[0].desc;
@@ -197,7 +197,6 @@ static void kbtab_disconnect(struct usb_interface *intf)
197} 197}
198 198
199static struct usb_driver kbtab_driver = { 199static struct usb_driver kbtab_driver = {
200 .owner = THIS_MODULE,
201 .name = "kbtab", 200 .name = "kbtab",
202 .probe = kbtab_probe, 201 .probe = kbtab_probe,
203 .disconnect = kbtab_disconnect, 202 .disconnect = kbtab_disconnect,
diff --git a/drivers/usb/input/keyspan_remote.c b/drivers/usb/input/keyspan_remote.c
index a32cfe51b77d..b4a051b549d1 100644
--- a/drivers/usb/input/keyspan_remote.c
+++ b/drivers/usb/input/keyspan_remote.c
@@ -95,7 +95,7 @@ struct usb_keyspan {
95 * Currently there are 15 and 17 button models so RESERVED codes 95 * Currently there are 15 and 17 button models so RESERVED codes
96 * are blank areas in the mapping. 96 * are blank areas in the mapping.
97 */ 97 */
98static int keyspan_key_table[] = { 98static const int keyspan_key_table[] = {
99 KEY_RESERVED, /* 0 is just a place holder. */ 99 KEY_RESERVED, /* 0 is just a place holder. */
100 KEY_RESERVED, 100 KEY_RESERVED,
101 KEY_STOP, 101 KEY_STOP,
@@ -559,7 +559,6 @@ static void keyspan_disconnect(struct usb_interface *interface)
559 */ 559 */
560static struct usb_driver keyspan_driver = 560static struct usb_driver keyspan_driver =
561{ 561{
562 .owner = THIS_MODULE,
563 .name = "keyspan_remote", 562 .name = "keyspan_remote",
564 .probe = keyspan_probe, 563 .probe = keyspan_probe,
565 .disconnect = keyspan_disconnect, 564 .disconnect = keyspan_disconnect,
diff --git a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c
index 52cc18cd247d..f018953a5485 100644
--- a/drivers/usb/input/mtouchusb.c
+++ b/drivers/usb/input/mtouchusb.c
@@ -310,7 +310,6 @@ static void mtouchusb_disconnect(struct usb_interface *intf)
310MODULE_DEVICE_TABLE(usb, mtouchusb_devices); 310MODULE_DEVICE_TABLE(usb, mtouchusb_devices);
311 311
312static struct usb_driver mtouchusb_driver = { 312static struct usb_driver mtouchusb_driver = {
313 .owner = THIS_MODULE,
314 .name = "mtouchusb", 313 .name = "mtouchusb",
315 .probe = mtouchusb_probe, 314 .probe = mtouchusb_probe,
316 .disconnect = mtouchusb_disconnect, 315 .disconnect = mtouchusb_disconnect,
diff --git a/drivers/usb/input/powermate.c b/drivers/usb/input/powermate.c
index b7476233ef5d..fdf0f788062c 100644
--- a/drivers/usb/input/powermate.c
+++ b/drivers/usb/input/powermate.c
@@ -441,7 +441,6 @@ static struct usb_device_id powermate_devices [] = {
441MODULE_DEVICE_TABLE (usb, powermate_devices); 441MODULE_DEVICE_TABLE (usb, powermate_devices);
442 442
443static struct usb_driver powermate_driver = { 443static struct usb_driver powermate_driver = {
444 .owner = THIS_MODULE,
445 .name = "powermate", 444 .name = "powermate",
446 .probe = powermate_probe, 445 .probe = powermate_probe,
447 .disconnect = powermate_disconnect, 446 .disconnect = powermate_disconnect,
diff --git a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c
index 7420c6b84284..3b3c7b4120a2 100644
--- a/drivers/usb/input/touchkitusb.c
+++ b/drivers/usb/input/touchkitusb.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 * touchkitusb.c -- Driver for eGalax TouchKit USB Touchscreens 2 * touchkitusb.c -- Driver for eGalax TouchKit USB Touchscreens
3 * 3 *
4 * Copyright (C) 2004 by Daniel Ritz 4 * Copyright (C) 2004-2005 by Daniel Ritz <daniel.ritz@gmx.ch>
5 * Copyright (C) by Todd E. Johnson (mtouchusb.c) 5 * Copyright (C) by Todd E. Johnson (mtouchusb.c)
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
@@ -41,15 +41,13 @@
41#define TOUCHKIT_MAX_YC 0x07ff 41#define TOUCHKIT_MAX_YC 0x07ff
42#define TOUCHKIT_YC_FUZZ 0x0 42#define TOUCHKIT_YC_FUZZ 0x0
43#define TOUCHKIT_YC_FLAT 0x0 43#define TOUCHKIT_YC_FLAT 0x0
44#define TOUCHKIT_REPORT_DATA_SIZE 8 44#define TOUCHKIT_REPORT_DATA_SIZE 16
45 45
46#define TOUCHKIT_DOWN 0x01 46#define TOUCHKIT_DOWN 0x01
47#define TOUCHKIT_POINT_TOUCH 0x81
48#define TOUCHKIT_POINT_NOTOUCH 0x80
49 47
50#define TOUCHKIT_GET_TOUCHED(dat) ((((dat)[0]) & TOUCHKIT_DOWN) ? 1 : 0) 48#define TOUCHKIT_PKT_TYPE_MASK 0xFE
51#define TOUCHKIT_GET_X(dat) (((dat)[3] << 7) | (dat)[4]) 49#define TOUCHKIT_PKT_TYPE_REPT 0x80
52#define TOUCHKIT_GET_Y(dat) (((dat)[1] << 7) | (dat)[2]) 50#define TOUCHKIT_PKT_TYPE_DIAG 0x0A
53 51
54#define DRIVER_VERSION "v0.1" 52#define DRIVER_VERSION "v0.1"
55#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>" 53#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
@@ -62,6 +60,8 @@ MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
62struct touchkit_usb { 60struct touchkit_usb {
63 unsigned char *data; 61 unsigned char *data;
64 dma_addr_t data_dma; 62 dma_addr_t data_dma;
63 char buffer[TOUCHKIT_REPORT_DATA_SIZE];
64 int buf_len;
65 struct urb *irq; 65 struct urb *irq;
66 struct usb_device *udev; 66 struct usb_device *udev;
67 struct input_dev *input; 67 struct input_dev *input;
@@ -77,11 +77,128 @@ static struct usb_device_id touchkit_devices[] = {
77 {} 77 {}
78}; 78};
79 79
80/* helpers to read the data */
81static inline int touchkit_get_touched(char *data)
82{
83 return (data[0] & TOUCHKIT_DOWN) ? 1 : 0;
84}
85
86static inline int touchkit_get_x(char *data)
87{
88 return ((data[3] & 0x0F) << 7) | (data[4] & 0x7F);
89}
90
91static inline int touchkit_get_y(char *data)
92{
93 return ((data[1] & 0x0F) << 7) | (data[2] & 0x7F);
94}
95
96
97/* processes one input packet. */
98static void touchkit_process_pkt(struct touchkit_usb *touchkit,
99 struct pt_regs *regs, char *pkt)
100{
101 int x, y;
102
103 /* only process report packets */
104 if ((pkt[0] & TOUCHKIT_PKT_TYPE_MASK) != TOUCHKIT_PKT_TYPE_REPT)
105 return;
106
107 if (swap_xy) {
108 y = touchkit_get_x(pkt);
109 x = touchkit_get_y(pkt);
110 } else {
111 x = touchkit_get_x(pkt);
112 y = touchkit_get_y(pkt);
113 }
114
115 input_regs(touchkit->input, regs);
116 input_report_key(touchkit->input, BTN_TOUCH, touchkit_get_touched(pkt));
117 input_report_abs(touchkit->input, ABS_X, x);
118 input_report_abs(touchkit->input, ABS_Y, y);
119 input_sync(touchkit->input);
120}
121
122
123static int touchkit_get_pkt_len(char *buf)
124{
125 switch (buf[0] & TOUCHKIT_PKT_TYPE_MASK) {
126 case TOUCHKIT_PKT_TYPE_REPT:
127 return 5;
128
129 case TOUCHKIT_PKT_TYPE_DIAG:
130 return buf[1] + 2;
131 }
132
133 return 0;
134}
135
136static void touchkit_process(struct touchkit_usb *touchkit, int len,
137 struct pt_regs *regs)
138{
139 char *buffer;
140 int pkt_len, buf_len, pos;
141
142 /* if the buffer contains data, append */
143 if (unlikely(touchkit->buf_len)) {
144 int tmp;
145
146 /* if only 1 byte in buffer, add another one to get length */
147 if (touchkit->buf_len == 1)
148 touchkit->buffer[1] = touchkit->data[0];
149
150 pkt_len = touchkit_get_pkt_len(touchkit->buffer);
151
152 /* unknown packet: drop everything */
153 if (!pkt_len)
154 return;
155
156 /* append, process */
157 tmp = pkt_len - touchkit->buf_len;
158 memcpy(touchkit->buffer + touchkit->buf_len, touchkit->data, tmp);
159 touchkit_process_pkt(touchkit, regs, touchkit->buffer);
160
161 buffer = touchkit->data + tmp;
162 buf_len = len - tmp;
163 } else {
164 buffer = touchkit->data;
165 buf_len = len;
166 }
167
168 /* only one byte left in buffer */
169 if (unlikely(buf_len == 1)) {
170 touchkit->buffer[0] = buffer[0];
171 touchkit->buf_len = 1;
172 return;
173 }
174
175 /* loop over the buffer */
176 pos = 0;
177 while (pos < buf_len) {
178 /* get packet len */
179 pkt_len = touchkit_get_pkt_len(buffer + pos);
180
181 /* unknown packet: drop everything */
182 if (unlikely(!pkt_len))
183 return;
184
185 /* full packet: process */
186 if (likely(pkt_len <= buf_len)) {
187 touchkit_process_pkt(touchkit, regs, buffer + pos);
188 } else {
189 /* incomplete packet: save in buffer */
190 memcpy(touchkit->buffer, buffer + pos, buf_len - pos);
191 touchkit->buf_len = buf_len - pos;
192 }
193 pos += pkt_len;
194 }
195}
196
197
80static void touchkit_irq(struct urb *urb, struct pt_regs *regs) 198static void touchkit_irq(struct urb *urb, struct pt_regs *regs)
81{ 199{
82 struct touchkit_usb *touchkit = urb->context; 200 struct touchkit_usb *touchkit = urb->context;
83 int retval; 201 int retval;
84 int x, y;
85 202
86 switch (urb->status) { 203 switch (urb->status) {
87 case 0: 204 case 0:
@@ -105,20 +222,7 @@ static void touchkit_irq(struct urb *urb, struct pt_regs *regs)
105 goto exit; 222 goto exit;
106 } 223 }
107 224
108 if (swap_xy) { 225 touchkit_process(touchkit, urb->actual_length, regs);
109 y = TOUCHKIT_GET_X(touchkit->data);
110 x = TOUCHKIT_GET_Y(touchkit->data);
111 } else {
112 x = TOUCHKIT_GET_X(touchkit->data);
113 y = TOUCHKIT_GET_Y(touchkit->data);
114 }
115
116 input_regs(touchkit->input, regs);
117 input_report_key(touchkit->input, BTN_TOUCH,
118 TOUCHKIT_GET_TOUCHED(touchkit->data));
119 input_report_abs(touchkit->input, ABS_X, x);
120 input_report_abs(touchkit->input, ABS_Y, y);
121 input_sync(touchkit->input);
122 226
123exit: 227exit:
124 retval = usb_submit_urb(urb, GFP_ATOMIC); 228 retval = usb_submit_urb(urb, GFP_ATOMIC);
@@ -267,7 +371,6 @@ static void touchkit_disconnect(struct usb_interface *intf)
267MODULE_DEVICE_TABLE(usb, touchkit_devices); 371MODULE_DEVICE_TABLE(usb, touchkit_devices);
268 372
269static struct usb_driver touchkit_driver = { 373static struct usb_driver touchkit_driver = {
270 .owner = THIS_MODULE,
271 .name = "touchkitusb", 374 .name = "touchkitusb",
272 .probe = touchkit_probe, 375 .probe = touchkit_probe,
273 .disconnect = touchkit_disconnect, 376 .disconnect = touchkit_disconnect,
diff --git a/drivers/usb/input/usbkbd.c b/drivers/usb/input/usbkbd.c
index 226b6f90a907..2f3edc26cb50 100644
--- a/drivers/usb/input/usbkbd.c
+++ b/drivers/usb/input/usbkbd.c
@@ -345,7 +345,6 @@ static struct usb_device_id usb_kbd_id_table [] = {
345MODULE_DEVICE_TABLE (usb, usb_kbd_id_table); 345MODULE_DEVICE_TABLE (usb, usb_kbd_id_table);
346 346
347static struct usb_driver usb_kbd_driver = { 347static struct usb_driver usb_kbd_driver = {
348 .owner = THIS_MODULE,
349 .name = "usbkbd", 348 .name = "usbkbd",
350 .probe = usb_kbd_probe, 349 .probe = usb_kbd_probe,
351 .disconnect = usb_kbd_disconnect, 350 .disconnect = usb_kbd_disconnect,
diff --git a/drivers/usb/input/usbmouse.c b/drivers/usb/input/usbmouse.c
index 230f6b1b314a..af526135d210 100644
--- a/drivers/usb/input/usbmouse.c
+++ b/drivers/usb/input/usbmouse.c
@@ -226,7 +226,6 @@ static struct usb_device_id usb_mouse_id_table [] = {
226MODULE_DEVICE_TABLE (usb, usb_mouse_id_table); 226MODULE_DEVICE_TABLE (usb, usb_mouse_id_table);
227 227
228static struct usb_driver usb_mouse_driver = { 228static struct usb_driver usb_mouse_driver = {
229 .owner = THIS_MODULE,
230 .name = "usbmouse", 229 .name = "usbmouse",
231 .probe = usb_mouse_probe, 230 .probe = usb_mouse_probe,
232 .disconnect = usb_mouse_disconnect, 231 .disconnect = usb_mouse_disconnect,
diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c
index aea1cfae34cc..48df4cfd5a42 100644
--- a/drivers/usb/input/wacom.c
+++ b/drivers/usb/input/wacom.c
@@ -854,7 +854,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
854 854
855 input_dev->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS); 855 input_dev->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS);
856 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH) | BIT(BTN_STYLUS); 856 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH) | BIT(BTN_STYLUS);
857 input_set_abs_params(input_dev, ABS_X, 0, wacom->features->y_max, 4, 0); 857 input_set_abs_params(input_dev, ABS_X, 0, wacom->features->x_max, 4, 0);
858 input_set_abs_params(input_dev, ABS_Y, 0, wacom->features->y_max, 4, 0); 858 input_set_abs_params(input_dev, ABS_Y, 0, wacom->features->y_max, 4, 0);
859 input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom->features->pressure_max, 0, 0); 859 input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom->features->pressure_max, 0, 0);
860 860
@@ -945,7 +945,6 @@ static void wacom_disconnect(struct usb_interface *intf)
945} 945}
946 946
947static struct usb_driver wacom_driver = { 947static struct usb_driver wacom_driver = {
948 .owner = THIS_MODULE,
949 .name = "wacom", 948 .name = "wacom",
950 .probe = wacom_probe, 949 .probe = wacom_probe,
951 .disconnect = wacom_disconnect, 950 .disconnect = wacom_disconnect,
diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c
index 43112f040b6d..e278489a80c6 100644
--- a/drivers/usb/input/xpad.c
+++ b/drivers/usb/input/xpad.c
@@ -70,7 +70,7 @@
70 70
71#define XPAD_PKT_LEN 32 71#define XPAD_PKT_LEN 32
72 72
73static struct xpad_device { 73static const struct xpad_device {
74 u16 idVendor; 74 u16 idVendor;
75 u16 idProduct; 75 u16 idProduct;
76 char *name; 76 char *name;
@@ -81,13 +81,13 @@ static struct xpad_device {
81 { 0x0000, 0x0000, "X-Box pad" } 81 { 0x0000, 0x0000, "X-Box pad" }
82}; 82};
83 83
84static signed short xpad_btn[] = { 84static const signed short xpad_btn[] = {
85 BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, /* "analog" buttons */ 85 BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, /* "analog" buttons */
86 BTN_START, BTN_BACK, BTN_THUMBL, BTN_THUMBR, /* start/back/sticks */ 86 BTN_START, BTN_BACK, BTN_THUMBL, BTN_THUMBR, /* start/back/sticks */
87 -1 /* terminating entry */ 87 -1 /* terminating entry */
88}; 88};
89 89
90static signed short xpad_abs[] = { 90static const signed short xpad_abs[] = {
91 ABS_X, ABS_Y, /* left stick */ 91 ABS_X, ABS_Y, /* left stick */
92 ABS_RX, ABS_RY, /* right stick */ 92 ABS_RX, ABS_RY, /* right stick */
93 ABS_Z, ABS_RZ, /* triggers left/right */ 93 ABS_Z, ABS_RZ, /* triggers left/right */
@@ -316,7 +316,6 @@ static void xpad_disconnect(struct usb_interface *intf)
316} 316}
317 317
318static struct usb_driver xpad_driver = { 318static struct usb_driver xpad_driver = {
319 .owner = THIS_MODULE,
320 .name = "xpad", 319 .name = "xpad",
321 .probe = xpad_probe, 320 .probe = xpad_probe,
322 .disconnect = xpad_disconnect, 321 .disconnect = xpad_disconnect,
diff --git a/drivers/usb/input/yealink.c b/drivers/usb/input/yealink.c
index f526aebea502..1bfc105ad4d6 100644
--- a/drivers/usb/input/yealink.c
+++ b/drivers/usb/input/yealink.c
@@ -987,7 +987,6 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
987} 987}
988 988
989static struct usb_driver yealink_driver = { 989static struct usb_driver yealink_driver = {
990 .owner = THIS_MODULE,
991 .name = "yealink", 990 .name = "yealink",
992 .probe = usb_probe, 991 .probe = usb_probe,
993 .disconnect = usb_disconnect, 992 .disconnect = usb_disconnect,