aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-05-29 03:29:01 -0400
committerDmitry Torokhov <dtor_core@ameritech.net>2005-05-29 03:29:01 -0400
commit05f091ab4c8c1f12f8dd38ee789489904fea327d (patch)
tree6ad1f600921354b3ea834b84f33ce9397f6818a5 /drivers/usb/input
parentab0c3443ad2de03383f2549195badf64779d08a1 (diff)
Input: whitespace fixes in drivers/usb/input
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/usb/input')
-rw-r--r--drivers/usb/input/aiptek.c18
-rw-r--r--drivers/usb/input/ati_remote.c221
-rw-r--r--drivers/usb/input/hid-core.c4
-rw-r--r--drivers/usb/input/hid-debug.h16
-rw-r--r--drivers/usb/input/hid-input.c16
-rw-r--r--drivers/usb/input/hid-lgff.c18
-rw-r--r--drivers/usb/input/hid.h18
-rw-r--r--drivers/usb/input/hiddev.c56
-rw-r--r--drivers/usb/input/itmtouch.c55
-rw-r--r--drivers/usb/input/kbtab.c6
-rw-r--r--drivers/usb/input/powermate.c30
-rw-r--r--drivers/usb/input/usbkbd.c18
-rw-r--r--drivers/usb/input/usbmouse.c20
-rw-r--r--drivers/usb/input/wacom.c46
-rw-r--r--drivers/usb/input/xpad.c66
15 files changed, 300 insertions, 308 deletions
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
index 94ce2a9ad50f..68d9d281386c 100644
--- a/drivers/usb/input/aiptek.c
+++ b/drivers/usb/input/aiptek.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Native support for the Aiptek HyperPen USB Tablets 2 * Native support for the Aiptek HyperPen USB Tablets
3 * (4000U/5000U/6000U/8000U/12000U) 3 * (4000U/5000U/6000U/8000U/12000U)
4 * 4 *
5 * Copyright (c) 2001 Chris Atenasio <chris@crud.net> 5 * Copyright (c) 2001 Chris Atenasio <chris@crud.net>
6 * Copyright (c) 2002-2004 Bryan W. Headley <bwheadley@earthlink.net> 6 * Copyright (c) 2002-2004 Bryan W. Headley <bwheadley@earthlink.net>
7 * 7 *
@@ -31,7 +31,7 @@
31 * - Added support for the sysfs interface, deprecating the 31 * - Added support for the sysfs interface, deprecating the
32 * procfs interface for 2.5.x kernel. Also added support for 32 * procfs interface for 2.5.x kernel. Also added support for
33 * Wheel command. Bryan W. Headley July-15-2003. 33 * Wheel command. Bryan W. Headley July-15-2003.
34 * v1.2 - Reworked jitter timer as a kernel thread. 34 * v1.2 - Reworked jitter timer as a kernel thread.
35 * Bryan W. Headley November-28-2003/Jan-10-2004. 35 * Bryan W. Headley November-28-2003/Jan-10-2004.
36 * v1.3 - Repaired issue of kernel thread going nuts on single-processor 36 * v1.3 - Repaired issue of kernel thread going nuts on single-processor
37 * machines, introduced programmableDelay as a command line 37 * machines, introduced programmableDelay as a command line
@@ -49,10 +49,10 @@
49 * NOTE: 49 * NOTE:
50 * This kernel driver is augmented by the "Aiptek" XFree86 input 50 * This kernel driver is augmented by the "Aiptek" XFree86 input
51 * driver for your X server, as well as the Gaiptek GUI Front-end 51 * driver for your X server, as well as the Gaiptek GUI Front-end
52 * "Tablet Manager". 52 * "Tablet Manager".
53 * These three products are highly interactive with one another, 53 * These three products are highly interactive with one another,
54 * so therefore it's easier to document them all as one subsystem. 54 * so therefore it's easier to document them all as one subsystem.
55 * Please visit the project's "home page", located at, 55 * Please visit the project's "home page", located at,
56 * http://aiptektablet.sourceforge.net. 56 * http://aiptektablet.sourceforge.net.
57 * 57 *
58 * This program is free software; you can redistribute it and/or modify 58 * This program is free software; you can redistribute it and/or modify
@@ -156,7 +156,7 @@
156 * Command/Data Description Return Bytes Return Value 156 * Command/Data Description Return Bytes Return Value
157 * 0x10/0x00 SwitchToMouse 0 157 * 0x10/0x00 SwitchToMouse 0
158 * 0x10/0x01 SwitchToTablet 0 158 * 0x10/0x01 SwitchToTablet 0
159 * 0x18/0x04 SetResolution 0 159 * 0x18/0x04 SetResolution 0
160 * 0x12/0xFF AutoGainOn 0 160 * 0x12/0xFF AutoGainOn 0
161 * 0x17/0x00 FilterOn 0 161 * 0x17/0x00 FilterOn 0
162 * 0x01/0x00 GetXExtension 2 MaxX 162 * 0x01/0x00 GetXExtension 2 MaxX
@@ -247,7 +247,7 @@
247#define AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE 2 247#define AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE 2
248#define AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED 3 248#define AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED 3
249 249
250 /* Time to wait (in ms) to help mask hand jittering 250 /* Time to wait (in ms) to help mask hand jittering
251 * when pressing the stylus buttons. 251 * when pressing the stylus buttons.
252 */ 252 */
253#define AIPTEK_JITTER_DELAY_DEFAULT 50 253#define AIPTEK_JITTER_DELAY_DEFAULT 50
@@ -791,7 +791,7 @@ exit:
791 * specific Aiptek model numbers, because there has been overlaps, 791 * specific Aiptek model numbers, because there has been overlaps,
792 * use, and reuse of id's in existing models. Certain models have 792 * use, and reuse of id's in existing models. Certain models have
793 * been known to use more than one ID, indicative perhaps of 793 * been known to use more than one ID, indicative perhaps of
794 * manufacturing revisions. In any event, we consider these 794 * manufacturing revisions. In any event, we consider these
795 * IDs to not be model-specific nor unique. 795 * IDs to not be model-specific nor unique.
796 */ 796 */
797static const struct usb_device_id aiptek_ids[] = { 797static const struct usb_device_id aiptek_ids[] = {
@@ -840,7 +840,7 @@ static void aiptek_close(struct input_dev *inputdev)
840} 840}
841 841
842/*********************************************************************** 842/***********************************************************************
843 * aiptek_set_report and aiptek_get_report() are borrowed from Linux 2.4.x, 843 * aiptek_set_report and aiptek_get_report() are borrowed from Linux 2.4.x,
844 * where they were known as usb_set_report and usb_get_report. 844 * where they were known as usb_set_report and usb_get_report.
845 */ 845 */
846static int 846static int
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
index 860df26323b1..cf45add81713 100644
--- a/drivers/usb/input/ati_remote.c
+++ b/drivers/usb/input/ati_remote.c
@@ -1,15 +1,15 @@
1/* 1/*
2 * USB ATI Remote support 2 * USB ATI Remote support
3 * 3 *
4 * Version 2.2.0 Copyright (c) 2004 Torrey Hoffman <thoffman@arnor.net> 4 * Version 2.2.0 Copyright (c) 2004 Torrey Hoffman <thoffman@arnor.net>
5 * Version 2.1.1 Copyright (c) 2002 Vladimir Dergachev 5 * Version 2.1.1 Copyright (c) 2002 Vladimir Dergachev
6 * 6 *
7 * This 2.2.0 version is a rewrite / cleanup of the 2.1.1 driver, including 7 * This 2.2.0 version is a rewrite / cleanup of the 2.1.1 driver, including
8 * porting to the 2.6 kernel interfaces, along with other modification 8 * porting to the 2.6 kernel interfaces, along with other modification
9 * to better match the style of the existing usb/input drivers. However, the 9 * to better match the style of the existing usb/input drivers. However, the
10 * protocol and hardware handling is essentially unchanged from 2.1.1. 10 * protocol and hardware handling is essentially unchanged from 2.1.1.
11 * 11 *
12 * The 2.1.1 driver was derived from the usbati_remote and usbkbd drivers by 12 * The 2.1.1 driver was derived from the usbati_remote and usbkbd drivers by
13 * Vojtech Pavlik. 13 * Vojtech Pavlik.
14 * 14 *
15 * Changes: 15 * Changes:
@@ -23,64 +23,64 @@
23 * Added support for the "Lola" remote contributed by: 23 * Added support for the "Lola" remote contributed by:
24 * Seth Cohn <sethcohn@yahoo.com> 24 * Seth Cohn <sethcohn@yahoo.com>
25 * 25 *
26 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 26 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
27 * 27 *
28 * This program is free software; you can redistribute it and/or modify 28 * This program is free software; you can redistribute it and/or modify
29 * it under the terms of the GNU General Public License as published by 29 * it under the terms of the GNU General Public License as published by
30 * the Free Software Foundation; either version 2 of the License, or 30 * the Free Software Foundation; either version 2 of the License, or
31 * (at your option) any later version. 31 * (at your option) any later version.
32 * 32 *
33 * This program is distributed in the hope that it will be useful, 33 * This program is distributed in the hope that it will be useful,
34 * but WITHOUT ANY WARRANTY; without even the implied warranty of 34 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 * GNU General Public License for more details. 36 * GNU General Public License for more details.
37 * 37 *
38 * You should have received a copy of the GNU General Public License 38 * You should have received a copy of the GNU General Public License
39 * along with this program; if not, write to the Free Software 39 * along with this program; if not, write to the Free Software
40 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 40 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
41 * 41 *
42 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 42 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
43 * 43 *
44 * Hardware & software notes 44 * Hardware & software notes
45 * 45 *
46 * These remote controls are distributed by ATI as part of their 46 * These remote controls are distributed by ATI as part of their
47 * "All-In-Wonder" video card packages. The receiver self-identifies as a 47 * "All-In-Wonder" video card packages. The receiver self-identifies as a
48 * "USB Receiver" with manufacturer "X10 Wireless Technology Inc". 48 * "USB Receiver" with manufacturer "X10 Wireless Technology Inc".
49 * 49 *
50 * The "Lola" remote is available from X10. See: 50 * The "Lola" remote is available from X10. See:
51 * http://www.x10.com/products/lola_sg1.htm 51 * http://www.x10.com/products/lola_sg1.htm
52 * The Lola is similar to the ATI remote but has no mouse support, and slightly 52 * The Lola is similar to the ATI remote but has no mouse support, and slightly
53 * different keys. 53 * different keys.
54 * 54 *
55 * It is possible to use multiple receivers and remotes on multiple computers 55 * It is possible to use multiple receivers and remotes on multiple computers
56 * simultaneously by configuring them to use specific channels. 56 * simultaneously by configuring them to use specific channels.
57 * 57 *
58 * The RF protocol used by the remote supports 16 distinct channels, 1 to 16. 58 * The RF protocol used by the remote supports 16 distinct channels, 1 to 16.
59 * Actually, it may even support more, at least in some revisions of the 59 * Actually, it may even support more, at least in some revisions of the
60 * hardware. 60 * hardware.
61 * 61 *
62 * Each remote can be configured to transmit on one channel as follows: 62 * Each remote can be configured to transmit on one channel as follows:
63 * - Press and hold the "hand icon" button. 63 * - Press and hold the "hand icon" button.
64 * - When the red LED starts to blink, let go of the "hand icon" button. 64 * - When the red LED starts to blink, let go of the "hand icon" button.
65 * - When it stops blinking, input the channel code as two digits, from 01 65 * - When it stops blinking, input the channel code as two digits, from 01
66 * to 16, and press the hand icon again. 66 * to 16, and press the hand icon again.
67 * 67 *
68 * The timing can be a little tricky. Try loading the module with debug=1 68 * The timing can be a little tricky. Try loading the module with debug=1
69 * to have the kernel print out messages about the remote control number 69 * to have the kernel print out messages about the remote control number
70 * and mask. Note: debugging prints remote numbers as zero-based hexadecimal. 70 * and mask. Note: debugging prints remote numbers as zero-based hexadecimal.
71 * 71 *
72 * The driver has a "channel_mask" parameter. This bitmask specifies which 72 * The driver has a "channel_mask" parameter. This bitmask specifies which
73 * channels will be ignored by the module. To mask out channels, just add 73 * channels will be ignored by the module. To mask out channels, just add
74 * all the 2^channel_number values together. 74 * all the 2^channel_number values together.
75 * 75 *
76 * For instance, set channel_mask = 2^4 = 16 (binary 10000) to make ati_remote 76 * For instance, set channel_mask = 2^4 = 16 (binary 10000) to make ati_remote
77 * ignore signals coming from remote controls transmitting on channel 4, but 77 * ignore signals coming from remote controls transmitting on channel 4, but
78 * accept all other channels. 78 * accept all other channels.
79 * 79 *
80 * Or, set channel_mask = 65533, (0xFFFD), and all channels except 1 will be 80 * Or, set channel_mask = 65533, (0xFFFD), and all channels except 1 will be
81 * ignored. 81 * ignored.
82 * 82 *
83 * The default is 0 (respond to all channels). Bit 0 and bits 17-32 of this 83 * The default is 0 (respond to all channels). Bit 0 and bits 17-32 of this
84 * parameter are unused. 84 * parameter are unused.
85 * 85 *
86 */ 86 */
@@ -99,13 +99,13 @@
99/* 99/*
100 * Module and Version Information, Module Parameters 100 * Module and Version Information, Module Parameters
101 */ 101 */
102 102
103#define ATI_REMOTE_VENDOR_ID 0x0bc7 103#define ATI_REMOTE_VENDOR_ID 0x0bc7
104#define ATI_REMOTE_PRODUCT_ID 0x004 104#define ATI_REMOTE_PRODUCT_ID 0x004
105#define LOLA_REMOTE_PRODUCT_ID 0x002 105#define LOLA_REMOTE_PRODUCT_ID 0x002
106#define MEDION_REMOTE_PRODUCT_ID 0x006 106#define MEDION_REMOTE_PRODUCT_ID 0x006
107 107
108#define DRIVER_VERSION "2.2.1" 108#define DRIVER_VERSION "2.2.1"
109#define DRIVER_AUTHOR "Torrey Hoffman <thoffman@arnor.net>" 109#define DRIVER_AUTHOR "Torrey Hoffman <thoffman@arnor.net>"
110#define DRIVER_DESC "ATI/X10 RF USB Remote Control" 110#define DRIVER_DESC "ATI/X10 RF USB Remote Control"
111 111
@@ -124,7 +124,7 @@ MODULE_PARM_DESC(debug, "Enable extra debug messages and information");
124#define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) 124#define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0)
125#undef err 125#undef err
126#define err(format, arg...) printk(KERN_ERR format , ## arg) 126#define err(format, arg...) printk(KERN_ERR format , ## arg)
127 127
128static struct usb_device_id ati_remote_table[] = { 128static struct usb_device_id ati_remote_table[] = {
129 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID) }, 129 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID) },
130 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID) }, 130 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID) },
@@ -148,7 +148,7 @@ static char init2[] = { 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 };
148/* Acceleration curve for directional control pad */ 148/* Acceleration curve for directional control pad */
149static char accel[] = { 1, 2, 4, 6, 9, 13, 20 }; 149static char accel[] = { 1, 2, 4, 6, 9, 13, 20 };
150 150
151/* Duplicate event filtering time. 151/* Duplicate event filtering time.
152 * Sequential, identical KIND_FILTERED inputs with less than 152 * Sequential, identical KIND_FILTERED inputs with less than
153 * FILTER_TIME jiffies between them are considered as repeat 153 * FILTER_TIME jiffies between them are considered as repeat
154 * events. The hardware generates 5 events for the first keypress 154 * events. The hardware generates 5 events for the first keypress
@@ -161,10 +161,10 @@ static char accel[] = { 1, 2, 4, 6, 9, 13, 20 };
161static DECLARE_MUTEX(disconnect_sem); 161static DECLARE_MUTEX(disconnect_sem);
162 162
163struct ati_remote { 163struct ati_remote {
164 struct input_dev idev; 164 struct input_dev idev;
165 struct usb_device *udev; 165 struct usb_device *udev;
166 struct usb_interface *interface; 166 struct usb_interface *interface;
167 167
168 struct urb *irq_urb; 168 struct urb *irq_urb;
169 struct urb *out_urb; 169 struct urb *out_urb;
170 struct usb_endpoint_descriptor *endpoint_in; 170 struct usb_endpoint_descriptor *endpoint_in;
@@ -175,12 +175,12 @@ struct ati_remote {
175 dma_addr_t outbuf_dma; 175 dma_addr_t outbuf_dma;
176 176
177 int open; /* open counter */ 177 int open; /* open counter */
178 178
179 unsigned char old_data[2]; /* Detect duplicate events */ 179 unsigned char old_data[2]; /* Detect duplicate events */
180 unsigned long old_jiffies; 180 unsigned long old_jiffies;
181 unsigned long acc_jiffies; /* handle acceleration */ 181 unsigned long acc_jiffies; /* handle acceleration */
182 unsigned int repeat_count; 182 unsigned int repeat_count;
183 183
184 char name[NAME_BUFSIZE]; 184 char name[NAME_BUFSIZE];
185 char phys[NAME_BUFSIZE]; 185 char phys[NAME_BUFSIZE];
186 186
@@ -206,14 +206,14 @@ static struct
206 int type; 206 int type;
207 unsigned int code; 207 unsigned int code;
208 int value; 208 int value;
209} ati_remote_tbl[] = 209} ati_remote_tbl[] =
210{ 210{
211 /* Directional control pad axes */ 211 /* Directional control pad axes */
212 {KIND_ACCEL, 0x35, 0x70, EV_REL, REL_X, -1}, /* left */ 212 {KIND_ACCEL, 0x35, 0x70, EV_REL, REL_X, -1}, /* left */
213 {KIND_ACCEL, 0x36, 0x71, EV_REL, REL_X, 1}, /* right */ 213 {KIND_ACCEL, 0x36, 0x71, EV_REL, REL_X, 1}, /* right */
214 {KIND_ACCEL, 0x37, 0x72, EV_REL, REL_Y, -1}, /* up */ 214 {KIND_ACCEL, 0x37, 0x72, EV_REL, REL_Y, -1}, /* up */
215 {KIND_ACCEL, 0x38, 0x73, EV_REL, REL_Y, 1}, /* down */ 215 {KIND_ACCEL, 0x38, 0x73, EV_REL, REL_Y, 1}, /* down */
216 /* Directional control pad diagonals */ 216 /* Directional control pad diagonals */
217 {KIND_LU, 0x39, 0x74, EV_REL, 0, 0}, /* left up */ 217 {KIND_LU, 0x39, 0x74, EV_REL, 0, 0}, /* left up */
218 {KIND_RU, 0x3a, 0x75, EV_REL, 0, 0}, /* right up */ 218 {KIND_RU, 0x3a, 0x75, EV_REL, 0, 0}, /* right up */
219 {KIND_LD, 0x3c, 0x77, EV_REL, 0, 0}, /* left down */ 219 {KIND_LD, 0x3c, 0x77, EV_REL, 0, 0}, /* left down */
@@ -225,7 +225,7 @@ static struct
225 {KIND_LITERAL, 0x41, 0x7c, EV_KEY, BTN_RIGHT, 1},/* right btn down */ 225 {KIND_LITERAL, 0x41, 0x7c, EV_KEY, BTN_RIGHT, 1},/* right btn down */
226 {KIND_LITERAL, 0x42, 0x7d, EV_KEY, BTN_RIGHT, 0},/* right btn up */ 226 {KIND_LITERAL, 0x42, 0x7d, EV_KEY, BTN_RIGHT, 0},/* right btn up */
227 227
228 /* Artificial "doubleclick" events are generated by the hardware. 228 /* Artificial "doubleclick" events are generated by the hardware.
229 * They are mapped to the "side" and "extra" mouse buttons here. */ 229 * They are mapped to the "side" and "extra" mouse buttons here. */
230 {KIND_FILTERED, 0x3f, 0x7a, EV_KEY, BTN_SIDE, 1}, /* left dblclick */ 230 {KIND_FILTERED, 0x3f, 0x7a, EV_KEY, BTN_SIDE, 1}, /* left dblclick */
231 {KIND_FILTERED, 0x43, 0x7e, EV_KEY, BTN_EXTRA, 1},/* right dblclick */ 231 {KIND_FILTERED, 0x43, 0x7e, EV_KEY, BTN_EXTRA, 1},/* right dblclick */
@@ -273,15 +273,15 @@ static struct
273 {KIND_FILTERED, 0xea, 0x25, EV_KEY, KEY_PLAY, 1}, /* ( >) */ 273 {KIND_FILTERED, 0xea, 0x25, EV_KEY, KEY_PLAY, 1}, /* ( >) */
274 {KIND_FILTERED, 0xe9, 0x24, EV_KEY, KEY_REWIND, 1}, /* (<<) */ 274 {KIND_FILTERED, 0xe9, 0x24, EV_KEY, KEY_REWIND, 1}, /* (<<) */
275 {KIND_FILTERED, 0xeb, 0x26, EV_KEY, KEY_FORWARD, 1}, /* (>>) */ 275 {KIND_FILTERED, 0xeb, 0x26, EV_KEY, KEY_FORWARD, 1}, /* (>>) */
276 {KIND_FILTERED, 0xed, 0x28, EV_KEY, KEY_STOP, 1}, /* ([]) */ 276 {KIND_FILTERED, 0xed, 0x28, EV_KEY, KEY_STOP, 1}, /* ([]) */
277 {KIND_FILTERED, 0xee, 0x29, EV_KEY, KEY_PAUSE, 1}, /* ('') */ 277 {KIND_FILTERED, 0xee, 0x29, EV_KEY, KEY_PAUSE, 1}, /* ('') */
278 {KIND_FILTERED, 0xf0, 0x2b, EV_KEY, KEY_PREVIOUS, 1}, /* (<-) */ 278 {KIND_FILTERED, 0xf0, 0x2b, EV_KEY, KEY_PREVIOUS, 1}, /* (<-) */
279 {KIND_FILTERED, 0xef, 0x2a, EV_KEY, KEY_NEXT, 1}, /* (>+) */ 279 {KIND_FILTERED, 0xef, 0x2a, EV_KEY, KEY_NEXT, 1}, /* (>+) */
280 {KIND_FILTERED, 0xf2, 0x2D, EV_KEY, KEY_INFO, 1}, /* PLAYING */ 280 {KIND_FILTERED, 0xf2, 0x2D, EV_KEY, KEY_INFO, 1}, /* PLAYING */
281 {KIND_FILTERED, 0xf3, 0x2E, EV_KEY, KEY_HOME, 1}, /* TOP */ 281 {KIND_FILTERED, 0xf3, 0x2E, EV_KEY, KEY_HOME, 1}, /* TOP */
282 {KIND_FILTERED, 0xf4, 0x2F, EV_KEY, KEY_END, 1}, /* END */ 282 {KIND_FILTERED, 0xf4, 0x2F, EV_KEY, KEY_END, 1}, /* END */
283 {KIND_FILTERED, 0xf5, 0x30, EV_KEY, KEY_SELECT, 1}, /* SELECT */ 283 {KIND_FILTERED, 0xf5, 0x30, EV_KEY, KEY_SELECT, 1}, /* SELECT */
284 284
285 {KIND_END, 0x00, 0x00, EV_MAX + 1, 0, 0} 285 {KIND_END, 0x00, 0x00, EV_MAX + 1, 0, 0}
286}; 286};
287 287
@@ -315,7 +315,7 @@ static void ati_remote_dump(unsigned char *data, unsigned int len)
315 if ((len == 1) && (data[0] != (unsigned char)0xff) && (data[0] != 0x00)) 315 if ((len == 1) && (data[0] != (unsigned char)0xff) && (data[0] != 0x00))
316 warn("Weird byte 0x%02x", data[0]); 316 warn("Weird byte 0x%02x", data[0]);
317 else if (len == 4) 317 else if (len == 4)
318 warn("Weird key %02x %02x %02x %02x", 318 warn("Weird key %02x %02x %02x %02x",
319 data[0], data[1], data[2], data[3]); 319 data[0], data[1], data[2], data[3]);
320 else 320 else
321 warn("Weird data, len=%d %02x %02x %02x %02x %02x %02x ...", 321 warn("Weird data, len=%d %02x %02x %02x %02x %02x %02x ...",
@@ -338,7 +338,7 @@ static int ati_remote_open(struct input_dev *inputdev)
338 /* On first open, submit the read urb which was set up previously. */ 338 /* On first open, submit the read urb which was set up previously. */
339 ati_remote->irq_urb->dev = ati_remote->udev; 339 ati_remote->irq_urb->dev = ati_remote->udev;
340 if (usb_submit_urb(ati_remote->irq_urb, GFP_KERNEL)) { 340 if (usb_submit_urb(ati_remote->irq_urb, GFP_KERNEL)) {
341 dev_err(&ati_remote->interface->dev, 341 dev_err(&ati_remote->interface->dev,
342 "%s: usb_submit_urb failed!\n", __FUNCTION__); 342 "%s: usb_submit_urb failed!\n", __FUNCTION__);
343 ati_remote->open--; 343 ati_remote->open--;
344 retval = -EIO; 344 retval = -EIO;
@@ -355,7 +355,7 @@ exit:
355static void ati_remote_close(struct input_dev *inputdev) 355static void ati_remote_close(struct input_dev *inputdev)
356{ 356{
357 struct ati_remote *ati_remote = inputdev->private; 357 struct ati_remote *ati_remote = inputdev->private;
358 358
359 if (!--ati_remote->open) 359 if (!--ati_remote->open)
360 usb_kill_urb(ati_remote->irq_urb); 360 usb_kill_urb(ati_remote->irq_urb);
361} 361}
@@ -366,13 +366,13 @@ static void ati_remote_close(struct input_dev *inputdev)
366static void ati_remote_irq_out(struct urb *urb, struct pt_regs *regs) 366static void ati_remote_irq_out(struct urb *urb, struct pt_regs *regs)
367{ 367{
368 struct ati_remote *ati_remote = urb->context; 368 struct ati_remote *ati_remote = urb->context;
369 369
370 if (urb->status) { 370 if (urb->status) {
371 dev_dbg(&ati_remote->interface->dev, "%s: status %d\n", 371 dev_dbg(&ati_remote->interface->dev, "%s: status %d\n",
372 __FUNCTION__, urb->status); 372 __FUNCTION__, urb->status);
373 return; 373 return;
374 } 374 }
375 375
376 ati_remote->send_flags |= SEND_FLAG_COMPLETE; 376 ati_remote->send_flags |= SEND_FLAG_COMPLETE;
377 wmb(); 377 wmb();
378 wake_up(&ati_remote->wait); 378 wake_up(&ati_remote->wait);
@@ -380,16 +380,16 @@ static void ati_remote_irq_out(struct urb *urb, struct pt_regs *regs)
380 380
381/* 381/*
382 * ati_remote_sendpacket 382 * ati_remote_sendpacket
383 * 383 *
384 * Used to send device initialization strings 384 * Used to send device initialization strings
385 */ 385 */
386static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, unsigned char *data) 386static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, unsigned char *data)
387{ 387{
388 int retval = 0; 388 int retval = 0;
389 389
390 /* Set up out_urb */ 390 /* Set up out_urb */
391 memcpy(ati_remote->out_urb->transfer_buffer + 1, data, LO(cmd)); 391 memcpy(ati_remote->out_urb->transfer_buffer + 1, data, LO(cmd));
392 ((char *) ati_remote->out_urb->transfer_buffer)[0] = HI(cmd); 392 ((char *) ati_remote->out_urb->transfer_buffer)[0] = HI(cmd);
393 393
394 ati_remote->out_urb->transfer_buffer_length = LO(cmd) + 1; 394 ati_remote->out_urb->transfer_buffer_length = LO(cmd) + 1;
395 ati_remote->out_urb->dev = ati_remote->udev; 395 ati_remote->out_urb->dev = ati_remote->udev;
@@ -397,17 +397,17 @@ static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, unsigne
397 397
398 retval = usb_submit_urb(ati_remote->out_urb, GFP_ATOMIC); 398 retval = usb_submit_urb(ati_remote->out_urb, GFP_ATOMIC);
399 if (retval) { 399 if (retval) {
400 dev_dbg(&ati_remote->interface->dev, 400 dev_dbg(&ati_remote->interface->dev,
401 "sendpacket: usb_submit_urb failed: %d\n", retval); 401 "sendpacket: usb_submit_urb failed: %d\n", retval);
402 return retval; 402 return retval;
403 } 403 }
404 404
405 wait_event_timeout(ati_remote->wait, 405 wait_event_timeout(ati_remote->wait,
406 ((ati_remote->out_urb->status != -EINPROGRESS) || 406 ((ati_remote->out_urb->status != -EINPROGRESS) ||
407 (ati_remote->send_flags & SEND_FLAG_COMPLETE)), 407 (ati_remote->send_flags & SEND_FLAG_COMPLETE)),
408 HZ); 408 HZ);
409 usb_kill_urb(ati_remote->out_urb); 409 usb_kill_urb(ati_remote->out_urb);
410 410
411 return retval; 411 return retval;
412} 412}
413 413
@@ -419,15 +419,15 @@ static int ati_remote_event_lookup(int rem, unsigned char d1, unsigned char d2)
419 int i; 419 int i;
420 420
421 for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) { 421 for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) {
422 /* 422 /*
423 * Decide if the table entry matches the remote input. 423 * Decide if the table entry matches the remote input.
424 */ 424 */
425 if ((((ati_remote_tbl[i].data1 & 0x0f) == (d1 & 0x0f))) && 425 if ((((ati_remote_tbl[i].data1 & 0x0f) == (d1 & 0x0f))) &&
426 ((((ati_remote_tbl[i].data1 >> 4) - 426 ((((ati_remote_tbl[i].data1 >> 4) -
427 (d1 >> 4) + rem) & 0x0f) == 0x0f) && 427 (d1 >> 4) + rem) & 0x0f) == 0x0f) &&
428 (ati_remote_tbl[i].data2 == d2)) 428 (ati_remote_tbl[i].data2 == d2))
429 return i; 429 return i;
430 430
431 } 431 }
432 return -1; 432 return -1;
433} 433}
@@ -435,16 +435,16 @@ static int ati_remote_event_lookup(int rem, unsigned char d1, unsigned char d2)
435/* 435/*
436 * ati_remote_report_input 436 * ati_remote_report_input
437 */ 437 */
438static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) 438static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
439{ 439{
440 struct ati_remote *ati_remote = urb->context; 440 struct ati_remote *ati_remote = urb->context;
441 unsigned char *data= ati_remote->inbuf; 441 unsigned char *data= ati_remote->inbuf;
442 struct input_dev *dev = &ati_remote->idev; 442 struct input_dev *dev = &ati_remote->idev;
443 int index, acc; 443 int index, acc;
444 int remote_num; 444 int remote_num;
445 445
446 /* Deal with strange looking inputs */ 446 /* Deal with strange looking inputs */
447 if ( (urb->actual_length != 4) || (data[0] != 0x14) || 447 if ( (urb->actual_length != 4) || (data[0] != 0x14) ||
448 ((data[3] & 0x0f) != 0x00) ) { 448 ((data[3] & 0x0f) != 0x00) ) {
449 ati_remote_dump(data, urb->actual_length); 449 ati_remote_dump(data, urb->actual_length);
450 return; 450 return;
@@ -453,7 +453,7 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
453 /* Mask unwanted remote channels. */ 453 /* Mask unwanted remote channels. */
454 /* note: remote_num is 0-based, channel 1 on remote == 0 here */ 454 /* note: remote_num is 0-based, channel 1 on remote == 0 here */
455 remote_num = (data[3] >> 4) & 0x0f; 455 remote_num = (data[3] >> 4) & 0x0f;
456 if (channel_mask & (1 << (remote_num + 1))) { 456 if (channel_mask & (1 << (remote_num + 1))) {
457 dbginfo(&ati_remote->interface->dev, 457 dbginfo(&ati_remote->interface->dev,
458 "Masked input from channel 0x%02x: data %02x,%02x, mask= 0x%02lx\n", 458 "Masked input from channel 0x%02x: data %02x,%02x, mask= 0x%02lx\n",
459 remote_num, data[1], data[2], channel_mask); 459 remote_num, data[1], data[2], channel_mask);
@@ -463,37 +463,36 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
463 /* Look up event code index in translation table */ 463 /* Look up event code index in translation table */
464 index = ati_remote_event_lookup(remote_num, data[1], data[2]); 464 index = ati_remote_event_lookup(remote_num, data[1], data[2]);
465 if (index < 0) { 465 if (index < 0) {
466 dev_warn(&ati_remote->interface->dev, 466 dev_warn(&ati_remote->interface->dev,
467 "Unknown input from channel 0x%02x: data %02x,%02x\n", 467 "Unknown input from channel 0x%02x: data %02x,%02x\n",
468 remote_num, data[1], data[2]); 468 remote_num, data[1], data[2]);
469 return; 469 return;
470 } 470 }
471 dbginfo(&ati_remote->interface->dev, 471 dbginfo(&ati_remote->interface->dev,
472 "channel 0x%02x; data %02x,%02x; index %d; keycode %d\n", 472 "channel 0x%02x; data %02x,%02x; index %d; keycode %d\n",
473 remote_num, data[1], data[2], index, ati_remote_tbl[index].code); 473 remote_num, data[1], data[2], index, ati_remote_tbl[index].code);
474 474
475 if (ati_remote_tbl[index].kind == KIND_LITERAL) { 475 if (ati_remote_tbl[index].kind == KIND_LITERAL) {
476 input_regs(dev, regs); 476 input_regs(dev, regs);
477 input_event(dev, ati_remote_tbl[index].type, 477 input_event(dev, ati_remote_tbl[index].type,
478 ati_remote_tbl[index].code, 478 ati_remote_tbl[index].code,
479 ati_remote_tbl[index].value); 479 ati_remote_tbl[index].value);
480 input_sync(dev); 480 input_sync(dev);
481 481
482 ati_remote->old_jiffies = jiffies; 482 ati_remote->old_jiffies = jiffies;
483 return; 483 return;
484 } 484 }
485 485
486 if (ati_remote_tbl[index].kind == KIND_FILTERED) { 486 if (ati_remote_tbl[index].kind == KIND_FILTERED) {
487 /* Filter duplicate events which happen "too close" together. */ 487 /* Filter duplicate events which happen "too close" together. */
488 if ((ati_remote->old_data[0] == data[1]) && 488 if ((ati_remote->old_data[0] == data[1]) &&
489 (ati_remote->old_data[1] == data[2]) && 489 (ati_remote->old_data[1] == data[2]) &&
490 ((ati_remote->old_jiffies + FILTER_TIME) > jiffies)) { 490 ((ati_remote->old_jiffies + FILTER_TIME) > jiffies)) {
491 ati_remote->repeat_count++; 491 ati_remote->repeat_count++;
492 } 492 } else {
493 else {
494 ati_remote->repeat_count = 0; 493 ati_remote->repeat_count = 0;
495 } 494 }
496 495
497 ati_remote->old_data[0] = data[1]; 496 ati_remote->old_data[0] = data[1];
498 ati_remote->old_data[1] = data[2]; 497 ati_remote->old_data[1] = data[2];
499 ati_remote->old_jiffies = jiffies; 498 ati_remote->old_jiffies = jiffies;
@@ -501,7 +500,7 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
501 if ((ati_remote->repeat_count > 0) 500 if ((ati_remote->repeat_count > 0)
502 && (ati_remote->repeat_count < 5)) 501 && (ati_remote->repeat_count < 5))
503 return; 502 return;
504 503
505 504
506 input_regs(dev, regs); 505 input_regs(dev, regs);
507 input_event(dev, ati_remote_tbl[index].type, 506 input_event(dev, ati_remote_tbl[index].type,
@@ -511,13 +510,13 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
511 input_sync(dev); 510 input_sync(dev);
512 511
513 return; 512 return;
514 } 513 }
515 514
516 /* 515 /*
517 * Other event kinds are from the directional control pad, and have an 516 * Other event kinds are from the directional control pad, and have an
518 * acceleration factor applied to them. Without this acceleration, the 517 * acceleration factor applied to them. Without this acceleration, the
519 * control pad is mostly unusable. 518 * control pad is mostly unusable.
520 * 519 *
521 * If elapsed time since last event is > 1/4 second, user "stopped", 520 * If elapsed time since last event is > 1/4 second, user "stopped",
522 * so reset acceleration. Otherwise, user is probably holding the control 521 * so reset acceleration. Otherwise, user is probably holding the control
523 * pad down, so we increase acceleration, ramping up over two seconds to 522 * pad down, so we increase acceleration, ramping up over two seconds to
@@ -559,7 +558,7 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
559 input_report_rel(dev, REL_Y, acc); 558 input_report_rel(dev, REL_Y, acc);
560 break; 559 break;
561 default: 560 default:
562 dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n", 561 dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n",
563 ati_remote_tbl[index].kind); 562 ati_remote_tbl[index].kind);
564 } 563 }
565 input_sync(dev); 564 input_sync(dev);
@@ -586,12 +585,12 @@ static void ati_remote_irq_in(struct urb *urb, struct pt_regs *regs)
586 case -ESHUTDOWN: 585 case -ESHUTDOWN:
587 dev_dbg(&ati_remote->interface->dev, "%s: urb error status, unlink? \n", 586 dev_dbg(&ati_remote->interface->dev, "%s: urb error status, unlink? \n",
588 __FUNCTION__); 587 __FUNCTION__);
589 return; 588 return;
590 default: /* error */ 589 default: /* error */
591 dev_dbg(&ati_remote->interface->dev, "%s: Nonzero urb status %d\n", 590 dev_dbg(&ati_remote->interface->dev, "%s: Nonzero urb status %d\n",
592 __FUNCTION__, urb->status); 591 __FUNCTION__, urb->status);
593 } 592 }
594 593
595 retval = usb_submit_urb(urb, SLAB_ATOMIC); 594 retval = usb_submit_urb(urb, SLAB_ATOMIC);
596 if (retval) 595 if (retval)
597 dev_err(&ati_remote->interface->dev, "%s: usb_submit_urb()=%d\n", 596 dev_err(&ati_remote->interface->dev, "%s: usb_submit_urb()=%d\n",
@@ -614,16 +613,16 @@ static void ati_remote_delete(struct ati_remote *ati_remote)
614 input_unregister_device(&ati_remote->idev); 613 input_unregister_device(&ati_remote->idev);
615 614
616 if (ati_remote->inbuf) 615 if (ati_remote->inbuf)
617 usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, 616 usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,
618 ati_remote->inbuf, ati_remote->inbuf_dma); 617 ati_remote->inbuf, ati_remote->inbuf_dma);
619 618
620 if (ati_remote->outbuf) 619 if (ati_remote->outbuf)
621 usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, 620 usb_buffer_free(ati_remote->udev, DATA_BUFSIZE,
622 ati_remote->outbuf, ati_remote->outbuf_dma); 621 ati_remote->outbuf, ati_remote->outbuf_dma);
623 622
624 if (ati_remote->irq_urb) 623 if (ati_remote->irq_urb)
625 usb_free_urb(ati_remote->irq_urb); 624 usb_free_urb(ati_remote->irq_urb);
626 625
627 if (ati_remote->out_urb) 626 if (ati_remote->out_urb)
628 usb_free_urb(ati_remote->out_urb); 627 usb_free_urb(ati_remote->out_urb);
629 628
@@ -636,21 +635,21 @@ static void ati_remote_input_init(struct ati_remote *ati_remote)
636 int i; 635 int i;
637 636
638 idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 637 idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
639 idev->keybit[LONG(BTN_MOUSE)] = ( BIT(BTN_LEFT) | BIT(BTN_RIGHT) | 638 idev->keybit[LONG(BTN_MOUSE)] = ( BIT(BTN_LEFT) | BIT(BTN_RIGHT) |
640 BIT(BTN_SIDE) | BIT(BTN_EXTRA) ); 639 BIT(BTN_SIDE) | BIT(BTN_EXTRA) );
641 idev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 640 idev->relbit[0] = BIT(REL_X) | BIT(REL_Y);
642 for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) 641 for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++)
643 if (ati_remote_tbl[i].type == EV_KEY) 642 if (ati_remote_tbl[i].type == EV_KEY)
644 set_bit(ati_remote_tbl[i].code, idev->keybit); 643 set_bit(ati_remote_tbl[i].code, idev->keybit);
645 644
646 idev->private = ati_remote; 645 idev->private = ati_remote;
647 idev->open = ati_remote_open; 646 idev->open = ati_remote_open;
648 idev->close = ati_remote_close; 647 idev->close = ati_remote_close;
649 648
650 idev->name = ati_remote->name; 649 idev->name = ati_remote->name;
651 idev->phys = ati_remote->phys; 650 idev->phys = ati_remote->phys;
652 651
653 idev->id.bustype = BUS_USB; 652 idev->id.bustype = BUS_USB;
654 idev->id.vendor = le16_to_cpu(ati_remote->udev->descriptor.idVendor); 653 idev->id.vendor = le16_to_cpu(ati_remote->udev->descriptor.idVendor);
655 idev->id.product = le16_to_cpu(ati_remote->udev->descriptor.idProduct); 654 idev->id.product = le16_to_cpu(ati_remote->udev->descriptor.idProduct);
656 idev->id.version = le16_to_cpu(ati_remote->udev->descriptor.bcdDevice); 655 idev->id.version = le16_to_cpu(ati_remote->udev->descriptor.bcdDevice);
@@ -660,27 +659,27 @@ static int ati_remote_initialize(struct ati_remote *ati_remote)
660{ 659{
661 struct usb_device *udev = ati_remote->udev; 660 struct usb_device *udev = ati_remote->udev;
662 int pipe, maxp; 661 int pipe, maxp;
663 662
664 init_waitqueue_head(&ati_remote->wait); 663 init_waitqueue_head(&ati_remote->wait);
665 664
666 /* Set up irq_urb */ 665 /* Set up irq_urb */
667 pipe = usb_rcvintpipe(udev, ati_remote->endpoint_in->bEndpointAddress); 666 pipe = usb_rcvintpipe(udev, ati_remote->endpoint_in->bEndpointAddress);
668 maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); 667 maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
669 maxp = (maxp > DATA_BUFSIZE) ? DATA_BUFSIZE : maxp; 668 maxp = (maxp > DATA_BUFSIZE) ? DATA_BUFSIZE : maxp;
670 669
671 usb_fill_int_urb(ati_remote->irq_urb, udev, pipe, ati_remote->inbuf, 670 usb_fill_int_urb(ati_remote->irq_urb, udev, pipe, ati_remote->inbuf,
672 maxp, ati_remote_irq_in, ati_remote, 671 maxp, ati_remote_irq_in, ati_remote,
673 ati_remote->endpoint_in->bInterval); 672 ati_remote->endpoint_in->bInterval);
674 ati_remote->irq_urb->transfer_dma = ati_remote->inbuf_dma; 673 ati_remote->irq_urb->transfer_dma = ati_remote->inbuf_dma;
675 ati_remote->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 674 ati_remote->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
676 675
677 /* Set up out_urb */ 676 /* Set up out_urb */
678 pipe = usb_sndintpipe(udev, ati_remote->endpoint_out->bEndpointAddress); 677 pipe = usb_sndintpipe(udev, ati_remote->endpoint_out->bEndpointAddress);
679 maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); 678 maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
680 maxp = (maxp > DATA_BUFSIZE) ? DATA_BUFSIZE : maxp; 679 maxp = (maxp > DATA_BUFSIZE) ? DATA_BUFSIZE : maxp;
681 680
682 usb_fill_int_urb(ati_remote->out_urb, udev, pipe, ati_remote->outbuf, 681 usb_fill_int_urb(ati_remote->out_urb, udev, pipe, ati_remote->outbuf,
683 maxp, ati_remote_irq_out, ati_remote, 682 maxp, ati_remote_irq_out, ati_remote,
684 ati_remote->endpoint_out->bInterval); 683 ati_remote->endpoint_out->bInterval);
685 ati_remote->out_urb->transfer_dma = ati_remote->outbuf_dma; 684 ati_remote->out_urb->transfer_dma = ati_remote->outbuf_dma;
686 ati_remote->out_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 685 ati_remote->out_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
@@ -688,11 +687,11 @@ static int ati_remote_initialize(struct ati_remote *ati_remote)
688 /* send initialization strings */ 687 /* send initialization strings */
689 if ((ati_remote_sendpacket(ati_remote, 0x8004, init1)) || 688 if ((ati_remote_sendpacket(ati_remote, 0x8004, init1)) ||
690 (ati_remote_sendpacket(ati_remote, 0x8007, init2))) { 689 (ati_remote_sendpacket(ati_remote, 0x8007, init2))) {
691 dev_err(&ati_remote->interface->dev, 690 dev_err(&ati_remote->interface->dev,
692 "Initializing ati_remote hardware failed.\n"); 691 "Initializing ati_remote hardware failed.\n");
693 return 1; 692 return 1;
694 } 693 }
695 694
696 return 0; 695 return 0;
697} 696}
698 697
@@ -769,7 +768,7 @@ static int ati_remote_probe(struct usb_interface *interface, const struct usb_de
769 768
770 if (!strlen(ati_remote->name)) 769 if (!strlen(ati_remote->name))
771 sprintf(ati_remote->name, DRIVER_DESC "(%04x,%04x)", 770 sprintf(ati_remote->name, DRIVER_DESC "(%04x,%04x)",
772 le16_to_cpu(ati_remote->udev->descriptor.idVendor), 771 le16_to_cpu(ati_remote->udev->descriptor.idVendor),
773 le16_to_cpu(ati_remote->udev->descriptor.idProduct)); 772 le16_to_cpu(ati_remote->udev->descriptor.idProduct));
774 773
775 /* Device Hardware Initialization - fills in ati_remote->idev from udev. */ 774 /* Device Hardware Initialization - fills in ati_remote->idev from udev. */
@@ -781,11 +780,11 @@ static int ati_remote_probe(struct usb_interface *interface, const struct usb_de
781 ati_remote_input_init(ati_remote); 780 ati_remote_input_init(ati_remote);
782 input_register_device(&ati_remote->idev); 781 input_register_device(&ati_remote->idev);
783 782
784 dev_info(&ati_remote->interface->dev, "Input registered: %s on %s\n", 783 dev_info(&ati_remote->interface->dev, "Input registered: %s on %s\n",
785 ati_remote->name, path); 784 ati_remote->name, path);
786 785
787 usb_set_intfdata(interface, ati_remote); 786 usb_set_intfdata(interface, ati_remote);
788 787
789error: 788error:
790 if (retval) 789 if (retval)
791 ati_remote_delete(ati_remote); 790 ati_remote_delete(ati_remote);
@@ -808,7 +807,7 @@ static void ati_remote_disconnect(struct usb_interface *interface)
808 warn("%s - null device?\n", __FUNCTION__); 807 warn("%s - null device?\n", __FUNCTION__);
809 return; 808 return;
810 } 809 }
811 810
812 ati_remote_delete(ati_remote); 811 ati_remote_delete(ati_remote);
813 812
814 up(&disconnect_sem); 813 up(&disconnect_sem);
@@ -820,7 +819,7 @@ static void ati_remote_disconnect(struct usb_interface *interface)
820static int __init ati_remote_init(void) 819static int __init ati_remote_init(void)
821{ 820{
822 int result; 821 int result;
823 822
824 result = usb_register(&ati_remote_driver); 823 result = usb_register(&ati_remote_driver);
825 if (result) 824 if (result)
826 err("usb_register error #%d\n", result); 825 err("usb_register error #%d\n", result);
@@ -838,8 +837,8 @@ static void __exit ati_remote_exit(void)
838 usb_deregister(&ati_remote_driver); 837 usb_deregister(&ati_remote_driver);
839} 838}
840 839
841/* 840/*
842 * module specification 841 * module specification
843 */ 842 */
844 843
845module_init(ati_remote_init); 844module_init(ati_remote_init);
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index 6bf39656adc7..08e701bc9f64 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -232,7 +232,7 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
232 report->size += parser->global.report_size * parser->global.report_count; 232 report->size += parser->global.report_size * parser->global.report_count;
233 233
234 if (!parser->local.usage_index) /* Ignore padding fields */ 234 if (!parser->local.usage_index) /* Ignore padding fields */
235 return 0; 235 return 0;
236 236
237 usages = max_t(int, parser->local.usage_index, parser->global.report_count); 237 usages = max_t(int, parser->local.usage_index, parser->global.report_count);
238 238
@@ -1622,7 +1622,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
1622 /* Change the polling interval of mice. */ 1622 /* Change the polling interval of mice. */
1623 if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) 1623 if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0)
1624 interval = hid_mousepoll_interval; 1624 interval = hid_mousepoll_interval;
1625 1625
1626 if (endpoint->bEndpointAddress & USB_DIR_IN) { 1626 if (endpoint->bEndpointAddress & USB_DIR_IN) {
1627 if (hid->urbin) 1627 if (hid->urbin)
1628 continue; 1628 continue;
diff --git a/drivers/usb/input/hid-debug.h b/drivers/usb/input/hid-debug.h
index 2b91705740a7..52437e5e2e78 100644
--- a/drivers/usb/input/hid-debug.h
+++ b/drivers/usb/input/hid-debug.h
@@ -67,7 +67,7 @@ static const struct hid_usage_entry hid_usage_table[] = {
67 {0, 0x44, "Vbry"}, 67 {0, 0x44, "Vbry"},
68 {0, 0x45, "Vbrz"}, 68 {0, 0x45, "Vbrz"},
69 {0, 0x46, "Vno"}, 69 {0, 0x46, "Vno"},
70 {0, 0x80, "SystemControl"}, 70 {0, 0x80, "SystemControl"},
71 {0, 0x81, "SystemPowerDown"}, 71 {0, 0x81, "SystemPowerDown"},
72 {0, 0x82, "SystemSleep"}, 72 {0, 0x82, "SystemSleep"},
73 {0, 0x83, "SystemWakeUp"}, 73 {0, 0x83, "SystemWakeUp"},
@@ -347,7 +347,7 @@ __inline__ static void tab(int n) {
347 347
348static void hid_dump_field(struct hid_field *field, int n) { 348static void hid_dump_field(struct hid_field *field, int n) {
349 int j; 349 int j;
350 350
351 if (field->physical) { 351 if (field->physical) {
352 tab(n); 352 tab(n);
353 printk("Physical("); 353 printk("Physical(");
@@ -408,7 +408,7 @@ static void hid_dump_field(struct hid_field *field, int n) {
408 printk("%s", units[sys][i]); 408 printk("%s", units[sys][i]);
409 if(nibble != 1) { 409 if(nibble != 1) {
410 /* This is a _signed_ nibble(!) */ 410 /* This is a _signed_ nibble(!) */
411 411
412 int val = nibble & 0x7; 412 int val = nibble & 0x7;
413 if(nibble & 0x08) 413 if(nibble & 0x08)
414 val = -((0x7 & ~val) +1); 414 val = -((0x7 & ~val) +1);
@@ -443,7 +443,7 @@ static void __attribute__((unused)) hid_dump_device(struct hid_device *device) {
443 struct list_head *list; 443 struct list_head *list;
444 unsigned i,k; 444 unsigned i,k;
445 static char *table[] = {"INPUT", "OUTPUT", "FEATURE"}; 445 static char *table[] = {"INPUT", "OUTPUT", "FEATURE"};
446 446
447 for (i = 0; i < HID_REPORT_TYPES; i++) { 447 for (i = 0; i < HID_REPORT_TYPES; i++) {
448 report_enum = device->report_enum + i; 448 report_enum = device->report_enum + i;
449 list = report_enum->report_list.next; 449 list = report_enum->report_list.next;
@@ -664,8 +664,8 @@ static char *keys[KEY_MAX + 1] = {
664static char *relatives[REL_MAX + 1] = { 664static char *relatives[REL_MAX + 1] = {
665 [REL_X] = "X", [REL_Y] = "Y", 665 [REL_X] = "X", [REL_Y] = "Y",
666 [REL_Z] = "Z", [REL_HWHEEL] = "HWheel", 666 [REL_Z] = "Z", [REL_HWHEEL] = "HWheel",
667 [REL_DIAL] = "Dial", [REL_WHEEL] = "Wheel", 667 [REL_DIAL] = "Dial", [REL_WHEEL] = "Wheel",
668 [REL_MISC] = "Misc", 668 [REL_MISC] = "Misc",
669}; 669};
670 670
671static char *absolutes[ABS_MAX + 1] = { 671static char *absolutes[ABS_MAX + 1] = {
@@ -690,9 +690,9 @@ static char *misc[MSC_MAX + 1] = {
690}; 690};
691 691
692static char *leds[LED_MAX + 1] = { 692static char *leds[LED_MAX + 1] = {
693 [LED_NUML] = "NumLock", [LED_CAPSL] = "CapsLock", 693 [LED_NUML] = "NumLock", [LED_CAPSL] = "CapsLock",
694 [LED_SCROLLL] = "ScrollLock", [LED_COMPOSE] = "Compose", 694 [LED_SCROLLL] = "ScrollLock", [LED_COMPOSE] = "Compose",
695 [LED_KANA] = "Kana", [LED_SLEEP] = "Sleep", 695 [LED_KANA] = "Kana", [LED_SLEEP] = "Sleep",
696 [LED_SUSPEND] = "Suspend", [LED_MUTE] = "Mute", 696 [LED_SUSPEND] = "Suspend", [LED_MUTE] = "Mute",
697 [LED_MISC] = "Misc", 697 [LED_MISC] = "Misc",
698}; 698};
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c
index 5553c3553e9d..9ac1e9095334 100644
--- a/drivers/usb/input/hid-input.c
+++ b/drivers/usb/input/hid-input.c
@@ -164,7 +164,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
164 case HID_GD_X: case HID_GD_Y: case HID_GD_Z: 164 case HID_GD_X: case HID_GD_Y: case HID_GD_Z:
165 case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: 165 case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ:
166 case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL: 166 case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL:
167 if (field->flags & HID_MAIN_ITEM_RELATIVE) 167 if (field->flags & HID_MAIN_ITEM_RELATIVE)
168 map_rel(usage->hid & 0xf); 168 map_rel(usage->hid & 0xf);
169 else 169 else
170 map_abs(usage->hid & 0xf); 170 map_abs(usage->hid & 0xf);
@@ -297,7 +297,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
297 case HID_UP_MSVENDOR: 297 case HID_UP_MSVENDOR:
298 298
299 goto ignore; 299 goto ignore;
300 300
301 case HID_UP_PID: 301 case HID_UP_PID:
302 302
303 set_bit(EV_FF, input->evbit); 303 set_bit(EV_FF, input->evbit);
@@ -349,7 +349,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
349 goto ignore; 349 goto ignore;
350 350
351 if ((device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_7 | HID_QUIRK_2WHEEL_MOUSE_HACK_5)) && 351 if ((device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_7 | HID_QUIRK_2WHEEL_MOUSE_HACK_5)) &&
352 (usage->type == EV_REL) && (usage->code == REL_WHEEL)) 352 (usage->type == EV_REL) && (usage->code == REL_WHEEL))
353 set_bit(REL_HWHEEL, bit); 353 set_bit(REL_HWHEEL, bit);
354 354
355 if (((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_5) && (usage->hid == 0x00090005)) 355 if (((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_5) && (usage->hid == 0x00090005))
@@ -365,11 +365,11 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
365 a = field->logical_minimum = 0; 365 a = field->logical_minimum = 0;
366 b = field->logical_maximum = 255; 366 b = field->logical_maximum = 255;
367 } 367 }
368 368
369 if (field->application == HID_GD_GAMEPAD || field->application == HID_GD_JOYSTICK) 369 if (field->application == HID_GD_GAMEPAD || field->application == HID_GD_JOYSTICK)
370 input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4); 370 input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4);
371 else input_set_abs_params(input, usage->code, a, b, 0, 0); 371 else input_set_abs_params(input, usage->code, a, b, 0, 0);
372 372
373 } 373 }
374 374
375 if (usage->hat_min < usage->hat_max || usage->hat_dir) { 375 if (usage->hat_min < usage->hat_max || usage->hat_dir) {
@@ -420,7 +420,7 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
420 return; 420 return;
421 } 421 }
422 422
423 if (usage->hat_min < usage->hat_max || usage->hat_dir) { 423 if (usage->hat_min < usage->hat_max || usage->hat_dir) {
424 int hat_dir = usage->hat_dir; 424 int hat_dir = usage->hat_dir;
425 if (!hat_dir) 425 if (!hat_dir)
426 hat_dir = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1; 426 hat_dir = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1;
@@ -551,7 +551,7 @@ int hidinput_connect(struct hid_device *hid)
551 for (i = 0; i < hid->maxcollection; i++) 551 for (i = 0; i < hid->maxcollection; i++)
552 if (hid->collection[i].type == HID_COLLECTION_APPLICATION || 552 if (hid->collection[i].type == HID_COLLECTION_APPLICATION ||
553 hid->collection[i].type == HID_COLLECTION_PHYSICAL) 553 hid->collection[i].type == HID_COLLECTION_PHYSICAL)
554 if (IS_INPUT_APPLICATION(hid->collection[i].usage)) 554 if (IS_INPUT_APPLICATION(hid->collection[i].usage))
555 break; 555 break;
556 556
557 if (i == hid->maxcollection) 557 if (i == hid->maxcollection)
@@ -592,7 +592,7 @@ int hidinput_connect(struct hid_device *hid)
592 for (j = 0; j < report->field[i]->maxusage; j++) 592 for (j = 0; j < report->field[i]->maxusage; j++)
593 hidinput_configure_usage(hidinput, report->field[i], 593 hidinput_configure_usage(hidinput, report->field[i],
594 report->field[i]->usage + j); 594 report->field[i]->usage + j);
595 595
596 if (hid->quirks & HID_QUIRK_MULTI_INPUT) { 596 if (hid->quirks & HID_QUIRK_MULTI_INPUT) {
597 /* This will leave hidinput NULL, so that it 597 /* This will leave hidinput NULL, so that it
598 * allocates another one if we have more inputs on 598 * allocates another one if we have more inputs on
diff --git a/drivers/usb/input/hid-lgff.c b/drivers/usb/input/hid-lgff.c
index 0d7404bab92f..0c4c77aa31ea 100644
--- a/drivers/usb/input/hid-lgff.c
+++ b/drivers/usb/input/hid-lgff.c
@@ -94,7 +94,7 @@ struct lgff_device {
94 isn't really necessary */ 94 isn't really necessary */
95 95
96 unsigned long flags[1]; /* Contains various information about the 96 unsigned long flags[1]; /* Contains various information about the
97 state of the driver for this device */ 97 state of the driver for this device */
98 98
99 struct timer_list timer; 99 struct timer_list timer;
100}; 100};
@@ -234,7 +234,7 @@ static struct hid_report* hid_lgff_duplicate_report(struct hid_report* report)
234 kfree(ret); 234 kfree(ret);
235 return NULL; 235 return NULL;
236 } 236 }
237 memset(ret->field[0]->value, 0, sizeof(s32[8])); 237 memset(ret->field[0]->value, 0, sizeof(s32[8]));
238 238
239 return ret; 239 return ret;
240} 240}
@@ -295,11 +295,11 @@ static int hid_lgff_event(struct hid_device *hid, struct input_dev* input,
295 unsigned long flags; 295 unsigned long flags;
296 296
297 if (type != EV_FF) return -EINVAL; 297 if (type != EV_FF) return -EINVAL;
298 if (!LGFF_CHECK_OWNERSHIP(code, lgff)) return -EACCES; 298 if (!LGFF_CHECK_OWNERSHIP(code, lgff)) return -EACCES;
299 if (value < 0) return -EINVAL; 299 if (value < 0) return -EINVAL;
300 300
301 spin_lock_irqsave(&lgff->lock, flags); 301 spin_lock_irqsave(&lgff->lock, flags);
302 302
303 if (value > 0) { 303 if (value > 0) {
304 if (test_bit(EFFECT_STARTED, effect->flags)) { 304 if (test_bit(EFFECT_STARTED, effect->flags)) {
305 spin_unlock_irqrestore(&lgff->lock, flags); 305 spin_unlock_irqrestore(&lgff->lock, flags);
@@ -345,7 +345,7 @@ static int hid_lgff_flush(struct input_dev *dev, struct file *file)
345 and perform ioctls on the same fd all at the same time */ 345 and perform ioctls on the same fd all at the same time */
346 if ( current->pid == lgff->effects[i].owner 346 if ( current->pid == lgff->effects[i].owner
347 && test_bit(EFFECT_USED, lgff->effects[i].flags)) { 347 && test_bit(EFFECT_USED, lgff->effects[i].flags)) {
348 348
349 if (hid_lgff_erase(dev, i)) 349 if (hid_lgff_erase(dev, i))
350 warn("erase effect %d failed", i); 350 warn("erase effect %d failed", i);
351 } 351 }
@@ -378,7 +378,7 @@ static int hid_lgff_upload_effect(struct input_dev* input,
378 struct lgff_effect new; 378 struct lgff_effect new;
379 int id; 379 int id;
380 unsigned long flags; 380 unsigned long flags;
381 381
382 dbg("ioctl rumble"); 382 dbg("ioctl rumble");
383 383
384 if (!test_bit(effect->type, input->ffbit)) return -EINVAL; 384 if (!test_bit(effect->type, input->ffbit)) return -EINVAL;
@@ -441,7 +441,7 @@ static void hid_lgff_timer(unsigned long timer_data)
441 441
442 spin_lock_irqsave(&lgff->lock, flags); 442 spin_lock_irqsave(&lgff->lock, flags);
443 443
444 for (i=0; i<LGFF_EFFECTS; ++i) { 444 for (i=0; i<LGFF_EFFECTS; ++i) {
445 struct lgff_effect* effect = lgff->effects +i; 445 struct lgff_effect* effect = lgff->effects +i;
446 446
447 if (test_bit(EFFECT_PLAYING, effect->flags)) { 447 if (test_bit(EFFECT_PLAYING, effect->flags)) {
@@ -491,7 +491,7 @@ static void hid_lgff_timer(unsigned long timer_data)
491 set_bit(EFFECT_PLAYING, lgff->effects[i].flags); 491 set_bit(EFFECT_PLAYING, lgff->effects[i].flags);
492 } 492 }
493 } 493 }
494 } 494 }
495 495
496#define CLAMP(x) if (x < 0) x = 0; if (x > 0xff) x = 0xff 496#define CLAMP(x) if (x < 0) x = 0; if (x > 0xff) x = 0xff
497 497
@@ -524,5 +524,5 @@ static void hid_lgff_timer(unsigned long timer_data)
524 add_timer(&lgff->timer); 524 add_timer(&lgff->timer);
525 } 525 }
526 526
527 spin_unlock_irqrestore(&lgff->lock, flags); 527 spin_unlock_irqrestore(&lgff->lock, flags);
528} 528}
diff --git a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h
index 6d9329c698d9..c1b6b69bc4a4 100644
--- a/drivers/usb/input/hid.h
+++ b/drivers/usb/input/hid.h
@@ -118,7 +118,7 @@ struct hid_item {
118#define HID_MAIN_ITEM_CONSTANT 0x001 118#define HID_MAIN_ITEM_CONSTANT 0x001
119#define HID_MAIN_ITEM_VARIABLE 0x002 119#define HID_MAIN_ITEM_VARIABLE 0x002
120#define HID_MAIN_ITEM_RELATIVE 0x004 120#define HID_MAIN_ITEM_RELATIVE 0x004
121#define HID_MAIN_ITEM_WRAP 0x008 121#define HID_MAIN_ITEM_WRAP 0x008
122#define HID_MAIN_ITEM_NONLINEAR 0x010 122#define HID_MAIN_ITEM_NONLINEAR 0x010
123#define HID_MAIN_ITEM_NO_PREFERRED 0x020 123#define HID_MAIN_ITEM_NO_PREFERRED 0x020
124#define HID_MAIN_ITEM_NULL_STATE 0x040 124#define HID_MAIN_ITEM_NULL_STATE 0x040
@@ -172,14 +172,14 @@ struct hid_item {
172#define HID_USAGE_PAGE 0xffff0000 172#define HID_USAGE_PAGE 0xffff0000
173 173
174#define HID_UP_UNDEFINED 0x00000000 174#define HID_UP_UNDEFINED 0x00000000
175#define HID_UP_GENDESK 0x00010000 175#define HID_UP_GENDESK 0x00010000
176#define HID_UP_KEYBOARD 0x00070000 176#define HID_UP_KEYBOARD 0x00070000
177#define HID_UP_LED 0x00080000 177#define HID_UP_LED 0x00080000
178#define HID_UP_BUTTON 0x00090000 178#define HID_UP_BUTTON 0x00090000
179#define HID_UP_ORDINAL 0x000a0000 179#define HID_UP_ORDINAL 0x000a0000
180#define HID_UP_CONSUMER 0x000c0000 180#define HID_UP_CONSUMER 0x000c0000
181#define HID_UP_DIGITIZER 0x000d0000 181#define HID_UP_DIGITIZER 0x000d0000
182#define HID_UP_PID 0x000f0000 182#define HID_UP_PID 0x000f0000
183#define HID_UP_HPVENDOR 0xff7f0000 183#define HID_UP_HPVENDOR 0xff7f0000
184#define HID_UP_MSVENDOR 0xff000000 184#define HID_UP_MSVENDOR 0xff000000
185 185
@@ -406,7 +406,7 @@ struct hid_device { /* device report descriptor */
406 dma_addr_t outbuf_dma; /* Output buffer dma */ 406 dma_addr_t outbuf_dma; /* Output buffer dma */
407 spinlock_t outlock; /* Output fifo spinlock */ 407 spinlock_t outlock; /* Output fifo spinlock */
408 408
409 unsigned claimed; /* Claimed by hidinput, hiddev? */ 409 unsigned claimed; /* Claimed by hidinput, hiddev? */
410 unsigned quirks; /* Various quirks the device can pull on us */ 410 unsigned quirks; /* Various quirks the device can pull on us */
411 411
412 struct list_head inputs; /* The list of inputs */ 412 struct list_head inputs; /* The list of inputs */
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c
index 96b7c9067951..4c13331b5f41 100644
--- a/drivers/usb/input/hiddev.c
+++ b/drivers/usb/input/hiddev.c
@@ -95,7 +95,7 @@ hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo)
95 return NULL; 95 return NULL;
96 rinfo->report_id = ((struct hid_report *) list)->id; 96 rinfo->report_id = ((struct hid_report *) list)->id;
97 break; 97 break;
98 98
99 case HID_REPORT_ID_NEXT: 99 case HID_REPORT_ID_NEXT:
100 list = (struct list_head *) 100 list = (struct list_head *)
101 report_enum->report_id_hash[rinfo->report_id & HID_REPORT_ID_MASK]; 101 report_enum->report_id_hash[rinfo->report_id & HID_REPORT_ID_MASK];
@@ -106,7 +106,7 @@ hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo)
106 return NULL; 106 return NULL;
107 rinfo->report_id = ((struct hid_report *) list)->id; 107 rinfo->report_id = ((struct hid_report *) list)->id;
108 break; 108 break;
109 109
110 default: 110 default:
111 return NULL; 111 return NULL;
112 } 112 }
@@ -158,7 +158,7 @@ static void hiddev_send_event(struct hid_device *hid,
158 if (uref->field_index != HID_FIELD_INDEX_NONE || 158 if (uref->field_index != HID_FIELD_INDEX_NONE ||
159 (list->flags & HIDDEV_FLAG_REPORT) != 0) { 159 (list->flags & HIDDEV_FLAG_REPORT) != 0) {
160 list->buffer[list->head] = *uref; 160 list->buffer[list->head] = *uref;
161 list->head = (list->head + 1) & 161 list->head = (list->head + 1) &
162 (HIDDEV_BUFFER_SIZE - 1); 162 (HIDDEV_BUFFER_SIZE - 1);
163 kill_fasync(&list->fasync, SIGIO, POLL_IN); 163 kill_fasync(&list->fasync, SIGIO, POLL_IN);
164 } 164 }
@@ -179,9 +179,9 @@ void hiddev_hid_event(struct hid_device *hid, struct hid_field *field,
179 unsigned type = field->report_type; 179 unsigned type = field->report_type;
180 struct hiddev_usage_ref uref; 180 struct hiddev_usage_ref uref;
181 181
182 uref.report_type = 182 uref.report_type =
183 (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : 183 (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
184 ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : 184 ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
185 ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0)); 185 ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0));
186 uref.report_id = field->report->id; 186 uref.report_id = field->report->id;
187 uref.field_index = field->index; 187 uref.field_index = field->index;
@@ -199,9 +199,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report)
199 struct hiddev_usage_ref uref; 199 struct hiddev_usage_ref uref;
200 200
201 memset(&uref, 0, sizeof(uref)); 201 memset(&uref, 0, sizeof(uref));
202 uref.report_type = 202 uref.report_type =
203 (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : 203 (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
204 ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : 204 ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
205 ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0)); 205 ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0));
206 uref.report_id = report->id; 206 uref.report_id = report->id;
207 uref.field_index = HID_FIELD_INDEX_NONE; 207 uref.field_index = HID_FIELD_INDEX_NONE;
@@ -236,7 +236,7 @@ static int hiddev_release(struct inode * inode, struct file * file)
236 *listptr = (*listptr)->next; 236 *listptr = (*listptr)->next;
237 237
238 if (!--list->hiddev->open) { 238 if (!--list->hiddev->open) {
239 if (list->hiddev->exist) 239 if (list->hiddev->exist)
240 hid_close(list->hiddev->hid); 240 hid_close(list->hiddev->hid);
241 else 241 else
242 kfree(list->hiddev); 242 kfree(list->hiddev);
@@ -303,7 +303,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
303 if (list->head == list->tail) { 303 if (list->head == list->tail) {
304 add_wait_queue(&list->hiddev->wait, &wait); 304 add_wait_queue(&list->hiddev->wait, &wait);
305 set_current_state(TASK_INTERRUPTIBLE); 305 set_current_state(TASK_INTERRUPTIBLE);
306 306
307 while (list->head == list->tail) { 307 while (list->head == list->tail) {
308 if (file->f_flags & O_NONBLOCK) { 308 if (file->f_flags & O_NONBLOCK) {
309 retval = -EAGAIN; 309 retval = -EAGAIN;
@@ -317,7 +317,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
317 retval = -EIO; 317 retval = -EIO;
318 break; 318 break;
319 } 319 }
320 320
321 schedule(); 321 schedule();
322 } 322 }
323 323
@@ -329,7 +329,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
329 return retval; 329 return retval;
330 330
331 331
332 while (list->head != list->tail && 332 while (list->head != list->tail &&
333 retval + event_size <= count) { 333 retval + event_size <= count) {
334 if ((list->flags & HIDDEV_FLAG_UREF) == 0) { 334 if ((list->flags & HIDDEV_FLAG_UREF) == 0) {
335 if (list->buffer[list->tail].field_index != 335 if (list->buffer[list->tail].field_index !=
@@ -405,10 +405,10 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
405 return -EINVAL; 405 return -EINVAL;
406 406
407 for (i = 0; i < hid->maxcollection; i++) 407 for (i = 0; i < hid->maxcollection; i++)
408 if (hid->collection[i].type == 408 if (hid->collection[i].type ==
409 HID_COLLECTION_APPLICATION && arg-- == 0) 409 HID_COLLECTION_APPLICATION && arg-- == 0)
410 break; 410 break;
411 411
412 if (i == hid->maxcollection) 412 if (i == hid->maxcollection)
413 return -EINVAL; 413 return -EINVAL;
414 414
@@ -562,7 +562,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
562 if (!uref_multi) 562 if (!uref_multi)
563 return -ENOMEM; 563 return -ENOMEM;
564 uref = &uref_multi->uref; 564 uref = &uref_multi->uref;
565 if (copy_from_user(uref, user_arg, sizeof(*uref))) 565 if (copy_from_user(uref, user_arg, sizeof(*uref)))
566 goto fault; 566 goto fault;
567 567
568 rinfo.report_type = uref->report_type; 568 rinfo.report_type = uref->report_type;
@@ -595,7 +595,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
595 return -ENOMEM; 595 return -ENOMEM;
596 uref = &uref_multi->uref; 596 uref = &uref_multi->uref;
597 if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) { 597 if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {
598 if (copy_from_user(uref_multi, user_arg, 598 if (copy_from_user(uref_multi, user_arg,
599 sizeof(*uref_multi))) 599 sizeof(*uref_multi)))
600 goto fault; 600 goto fault;
601 } else { 601 } else {
@@ -603,7 +603,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
603 goto fault; 603 goto fault;
604 } 604 }
605 605
606 if (cmd != HIDIOCGUSAGE && 606 if (cmd != HIDIOCGUSAGE &&
607 cmd != HIDIOCGUSAGES && 607 cmd != HIDIOCGUSAGES &&
608 uref->report_type == HID_REPORT_TYPE_INPUT) 608 uref->report_type == HID_REPORT_TYPE_INPUT)
609 goto inval; 609 goto inval;
@@ -651,16 +651,16 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
651 return field->usage[uref->usage_index].collection_index; 651 return field->usage[uref->usage_index].collection_index;
652 case HIDIOCGUSAGES: 652 case HIDIOCGUSAGES:
653 for (i = 0; i < uref_multi->num_values; i++) 653 for (i = 0; i < uref_multi->num_values; i++)
654 uref_multi->values[i] = 654 uref_multi->values[i] =
655 field->value[uref->usage_index + i]; 655 field->value[uref->usage_index + i];
656 if (copy_to_user(user_arg, uref_multi, 656 if (copy_to_user(user_arg, uref_multi,
657 sizeof(*uref_multi))) 657 sizeof(*uref_multi)))
658 goto fault; 658 goto fault;
659 goto goodreturn; 659 goto goodreturn;
660 case HIDIOCSUSAGES: 660 case HIDIOCSUSAGES:
661 for (i = 0; i < uref_multi->num_values; i++) 661 for (i = 0; i < uref_multi->num_values; i++)
662 field->value[uref->usage_index + i] = 662 field->value[uref->usage_index + i] =
663 uref_multi->values[i]; 663 uref_multi->values[i];
664 goto goodreturn; 664 goto goodreturn;
665 } 665 }
666 666
@@ -670,7 +670,7 @@ goodreturn:
670fault: 670fault:
671 kfree(uref_multi); 671 kfree(uref_multi);
672 return -EFAULT; 672 return -EFAULT;
673inval: 673inval:
674 kfree(uref_multi); 674 kfree(uref_multi);
675 return -EINVAL; 675 return -EINVAL;
676 676
@@ -734,7 +734,7 @@ static struct usb_class_driver hiddev_class = {
734 .name = "usb/hid/hiddev%d", 734 .name = "usb/hid/hiddev%d",
735 .fops = &hiddev_fops, 735 .fops = &hiddev_fops,
736 .mode = S_IFCHR | S_IRUGO | S_IWUSR, 736 .mode = S_IFCHR | S_IRUGO | S_IWUSR,
737 .minor_base = HIDDEV_MINOR_BASE, 737 .minor_base = HIDDEV_MINOR_BASE,
738}; 738};
739 739
740/* 740/*
@@ -747,7 +747,7 @@ int hiddev_connect(struct hid_device *hid)
747 int retval; 747 int retval;
748 748
749 for (i = 0; i < hid->maxcollection; i++) 749 for (i = 0; i < hid->maxcollection; i++)
750 if (hid->collection[i].type == 750 if (hid->collection[i].type ==
751 HID_COLLECTION_APPLICATION && 751 HID_COLLECTION_APPLICATION &&
752 !IS_INPUT_APPLICATION(hid->collection[i].usage)) 752 !IS_INPUT_APPLICATION(hid->collection[i].usage))
753 break; 753 break;
@@ -755,11 +755,11 @@ int hiddev_connect(struct hid_device *hid)
755 if (i == hid->maxcollection && (hid->quirks & HID_QUIRK_HIDDEV) == 0) 755 if (i == hid->maxcollection && (hid->quirks & HID_QUIRK_HIDDEV) == 0)
756 return -1; 756 return -1;
757 757
758 if (!(hiddev = kmalloc(sizeof(struct hiddev), GFP_KERNEL))) 758 if (!(hiddev = kmalloc(sizeof(struct hiddev), GFP_KERNEL)))
759 return -1; 759 return -1;
760 memset(hiddev, 0, sizeof(struct hiddev)); 760 memset(hiddev, 0, sizeof(struct hiddev));
761 761
762 retval = usb_register_dev(hid->intf, &hiddev_class); 762 retval = usb_register_dev(hid->intf, &hiddev_class);
763 if (retval) { 763 if (retval) {
764 err("Not able to get a minor for this device."); 764 err("Not able to get a minor for this device.");
765 kfree(hiddev); 765 kfree(hiddev);
@@ -768,12 +768,12 @@ int hiddev_connect(struct hid_device *hid)
768 768
769 init_waitqueue_head(&hiddev->wait); 769 init_waitqueue_head(&hiddev->wait);
770 770
771 hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; 771 hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;
772 772
773 hiddev->hid = hid; 773 hiddev->hid = hid;
774 hiddev->exist = 1; 774 hiddev->exist = 1;
775 775
776 hid->minor = hid->intf->minor; 776 hid->minor = hid->intf->minor;
777 hid->hiddev = hiddev; 777 hid->hiddev = hiddev;
778 778
779 return 0; 779 return 0;
@@ -818,7 +818,7 @@ void hiddev_disconnect(struct hid_device *hid)
818/* We never attach in this manner, and rely on HID to connect us. This 818/* We never attach in this manner, and rely on HID to connect us. This
819 * is why there is no disconnect routine defined in the usb_driver either. 819 * is why there is no disconnect routine defined in the usb_driver either.
820 */ 820 */
821static int hiddev_usbd_probe(struct usb_interface *intf, 821static int hiddev_usbd_probe(struct usb_interface *intf,
822 const struct usb_device_id *hiddev_info) 822 const struct usb_device_id *hiddev_info)
823{ 823{
824 return -ENODEV; 824 return -ENODEV;
diff --git a/drivers/usb/input/itmtouch.c b/drivers/usb/input/itmtouch.c
index 4c27c104f63e..5122a7f701a9 100644
--- a/drivers/usb/input/itmtouch.c
+++ b/drivers/usb/input/itmtouch.c
@@ -18,14 +18,14 @@
18 * Based upon original work by Chris Collins <xfire-itmtouch@xware.cx>. 18 * Based upon original work by Chris Collins <xfire-itmtouch@xware.cx>.
19 * 19 *
20 * Kudos to ITM for providing me with the datasheet for the panel, 20 * Kudos to ITM for providing me with the datasheet for the panel,
21 * even though it was a day later than I had finished writing this 21 * even though it was a day later than I had finished writing this
22 * driver. 22 * driver.
23 * 23 *
24 * It has meant that I've been able to correct my interpretation of the 24 * It has meant that I've been able to correct my interpretation of the
25 * protocol packets however. 25 * protocol packets however.
26 * 26 *
27 * CC -- 2003/9/29 27 * CC -- 2003/9/29
28 * 28 *
29 * History 29 * History
30 * 1.0 & 1.1 2003 (CC) vojtech@suse.cz 30 * 1.0 & 1.1 2003 (CC) vojtech@suse.cz
31 * Original version for 2.4.x kernels 31 * Original version for 2.4.x kernels
@@ -33,10 +33,10 @@
33 * 1.2 02/03/2005 (HCE) hc@mivu.no 33 * 1.2 02/03/2005 (HCE) hc@mivu.no
34 * Complete rewrite to support Linux 2.6.10, thanks to mtouchusb.c for hints. 34 * Complete rewrite to support Linux 2.6.10, thanks to mtouchusb.c for hints.
35 * Unfortunately no calibration support at this time. 35 * Unfortunately no calibration support at this time.
36 * 36 *
37 * 1.2.1 09/03/2005 (HCE) hc@mivu.no 37 * 1.2.1 09/03/2005 (HCE) hc@mivu.no
38 * Code cleanup and adjusting syntax to start matching kernel standards 38 * Code cleanup and adjusting syntax to start matching kernel standards
39 * 39 *
40 *****************************************************************************/ 40 *****************************************************************************/
41 41
42#include <linux/config.h> 42#include <linux/config.h>
@@ -71,7 +71,7 @@ MODULE_DESCRIPTION( DRIVER_DESC );
71MODULE_LICENSE( DRIVER_LICENSE ); 71MODULE_LICENSE( DRIVER_LICENSE );
72 72
73struct itmtouch_dev { 73struct itmtouch_dev {
74 struct usb_device *usbdev; /* usb device */ 74 struct usb_device *usbdev; /* usb device */
75 struct input_dev inputdev; /* input device */ 75 struct input_dev inputdev; /* input device */
76 struct urb *readurb; /* urb */ 76 struct urb *readurb; /* urb */
77 char rbuf[ITM_BUFSIZE]; /* data */ 77 char rbuf[ITM_BUFSIZE]; /* data */
@@ -121,7 +121,7 @@ static void itmtouch_irq(struct urb *urb, struct pt_regs *regs)
121 input_report_abs(dev, ABS_X, (data[0] & 0x1F) << 7 | (data[3] & 0x7F)); 121 input_report_abs(dev, ABS_X, (data[0] & 0x1F) << 7 | (data[3] & 0x7F));
122 input_report_abs(dev, ABS_Y, (data[1] & 0x1F) << 7 | (data[4] & 0x7F)); 122 input_report_abs(dev, ABS_Y, (data[1] & 0x1F) << 7 | (data[4] & 0x7F));
123 } 123 }
124 124
125 input_report_abs(dev, ABS_PRESSURE, (data[2] & 1) << 7 | (data[5] & 0x7F)); 125 input_report_abs(dev, ABS_PRESSURE, (data[2] & 1) << 7 | (data[5] & 0x7F));
126 input_report_key(dev, BTN_TOUCH, ~data[7] & 0x20); 126 input_report_key(dev, BTN_TOUCH, ~data[7] & 0x20);
127 input_sync(dev); 127 input_sync(dev);
@@ -142,8 +142,7 @@ static int itmtouch_open(struct input_dev *input)
142 142
143 itmtouch->readurb->dev = itmtouch->usbdev; 143 itmtouch->readurb->dev = itmtouch->usbdev;
144 144
145 if (usb_submit_urb(itmtouch->readurb, GFP_KERNEL)) 145 if (usb_submit_urb(itmtouch->readurb, GFP_KERNEL)) {
146 {
147 itmtouch->users--; 146 itmtouch->users--;
148 return -EIO; 147 return -EIO;
149 } 148 }
@@ -178,13 +177,13 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id
178 } 177 }
179 178
180 itmtouch->usbdev = udev; 179 itmtouch->usbdev = udev;
181 180
182 itmtouch->inputdev.private = itmtouch; 181 itmtouch->inputdev.private = itmtouch;
183 itmtouch->inputdev.open = itmtouch_open; 182 itmtouch->inputdev.open = itmtouch_open;
184 itmtouch->inputdev.close = itmtouch_close; 183 itmtouch->inputdev.close = itmtouch_close;
185 184
186 usb_make_path(udev, path, PATH_SIZE); 185 usb_make_path(udev, path, PATH_SIZE);
187 186
188 itmtouch->inputdev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 187 itmtouch->inputdev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
189 itmtouch->inputdev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE); 188 itmtouch->inputdev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);
190 itmtouch->inputdev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 189 itmtouch->inputdev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
@@ -194,12 +193,12 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id
194 itmtouch->inputdev.id.bustype = BUS_USB; 193 itmtouch->inputdev.id.bustype = BUS_USB;
195 itmtouch->inputdev.id.vendor = udev->descriptor.idVendor; 194 itmtouch->inputdev.id.vendor = udev->descriptor.idVendor;
196 itmtouch->inputdev.id.product = udev->descriptor.idProduct; 195 itmtouch->inputdev.id.product = udev->descriptor.idProduct;
197 itmtouch->inputdev.id.version = udev->descriptor.bcdDevice; 196 itmtouch->inputdev.id.version = udev->descriptor.bcdDevice;
198 itmtouch->inputdev.dev = &intf->dev; 197 itmtouch->inputdev.dev = &intf->dev;
199 198
200 if (!strlen(itmtouch->name)) 199 if (!strlen(itmtouch->name))
201 sprintf(itmtouch->name, "USB ITM touchscreen"); 200 sprintf(itmtouch->name, "USB ITM touchscreen");
202 201
203 /* device limits */ 202 /* device limits */
204 /* as specified by the ITM datasheet, X and Y are 12bit, 203 /* as specified by the ITM datasheet, X and Y are 12bit,
205 * Z (pressure) is 8 bit. However, the fields are defined up 204 * Z (pressure) is 8 bit. However, the fields are defined up
@@ -212,26 +211,20 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id
212 /* initialise the URB so we can read from the transport stream */ 211 /* initialise the URB so we can read from the transport stream */
213 pipe = usb_rcvintpipe(itmtouch->usbdev, endpoint->bEndpointAddress); 212 pipe = usb_rcvintpipe(itmtouch->usbdev, endpoint->bEndpointAddress);
214 maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); 213 maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
215 214
216 if (maxp > ITM_BUFSIZE) 215 if (maxp > ITM_BUFSIZE)
217 maxp = ITM_BUFSIZE; 216 maxp = ITM_BUFSIZE;
218 217
219 itmtouch->readurb = usb_alloc_urb(0, GFP_KERNEL); 218 itmtouch->readurb = usb_alloc_urb(0, GFP_KERNEL);
220 219
221 if (!itmtouch->readurb) { 220 if (!itmtouch->readurb) {
222 dbg("%s - usb_alloc_urb failed: itmtouch->readurb", __FUNCTION__); 221 dbg("%s - usb_alloc_urb failed: itmtouch->readurb", __FUNCTION__);
223 kfree(itmtouch); 222 kfree(itmtouch);
224 return -ENOMEM; 223 return -ENOMEM;
225 } 224 }
226 225
227 usb_fill_int_urb(itmtouch->readurb, 226 usb_fill_int_urb(itmtouch->readurb, itmtouch->usbdev, pipe, itmtouch->rbuf,
228 itmtouch->usbdev, 227 maxp, itmtouch_irq, itmtouch, endpoint->bInterval);
229 pipe,
230 itmtouch->rbuf,
231 maxp,
232 itmtouch_irq,
233 itmtouch,
234 endpoint->bInterval);
235 228
236 input_register_device(&itmtouch->inputdev); 229 input_register_device(&itmtouch->inputdev);
237 230
@@ -242,7 +235,7 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id
242} 235}
243 236
244static void itmtouch_disconnect(struct usb_interface *intf) 237static void itmtouch_disconnect(struct usb_interface *intf)
245{ 238{
246 struct itmtouch_dev *itmtouch = usb_get_intfdata(intf); 239 struct itmtouch_dev *itmtouch = usb_get_intfdata(intf);
247 240
248 usb_set_intfdata(intf, NULL); 241 usb_set_intfdata(intf, NULL);
@@ -258,11 +251,11 @@ static void itmtouch_disconnect(struct usb_interface *intf)
258MODULE_DEVICE_TABLE(usb, itmtouch_ids); 251MODULE_DEVICE_TABLE(usb, itmtouch_ids);
259 252
260static struct usb_driver itmtouch_driver = { 253static struct usb_driver itmtouch_driver = {
261 .owner = THIS_MODULE, 254 .owner = THIS_MODULE,
262 .name = "itmtouch", 255 .name = "itmtouch",
263 .probe = itmtouch_probe, 256 .probe = itmtouch_probe,
264 .disconnect = itmtouch_disconnect, 257 .disconnect = itmtouch_disconnect,
265 .id_table = itmtouch_ids, 258 .id_table = itmtouch_ids,
266}; 259};
267 260
268static int __init itmtouch_init(void) 261static int __init itmtouch_init(void)
diff --git a/drivers/usb/input/kbtab.c b/drivers/usb/input/kbtab.c
index a68c5b4e7b37..fff5753b16ca 100644
--- a/drivers/usb/input/kbtab.c
+++ b/drivers/usb/input/kbtab.c
@@ -79,12 +79,12 @@ static void kbtab_irq(struct urb *urb, struct pt_regs *regs)
79 /*input_report_key(dev, BTN_TOUCH , data[0] & 0x01);*/ 79 /*input_report_key(dev, BTN_TOUCH , data[0] & 0x01);*/
80 input_report_key(dev, BTN_RIGHT, data[0] & 0x02); 80 input_report_key(dev, BTN_RIGHT, data[0] & 0x02);
81 81
82 if( -1 == kb_pressure_click){ 82 if (-1 == kb_pressure_click) {
83 input_report_abs(dev, ABS_PRESSURE, kbtab->pressure); 83 input_report_abs(dev, ABS_PRESSURE, kbtab->pressure);
84 } else { 84 } else {
85 input_report_key(dev, BTN_LEFT, (kbtab->pressure > kb_pressure_click) ? 1 : 0); 85 input_report_key(dev, BTN_LEFT, (kbtab->pressure > kb_pressure_click) ? 1 : 0);
86 }; 86 };
87 87
88 input_sync(dev); 88 input_sync(dev);
89 89
90 exit: 90 exit:
@@ -161,7 +161,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
161 kbtab->dev.absmax[ABS_X] = 0x2000; 161 kbtab->dev.absmax[ABS_X] = 0x2000;
162 kbtab->dev.absmax[ABS_Y] = 0x1750; 162 kbtab->dev.absmax[ABS_Y] = 0x1750;
163 kbtab->dev.absmax[ABS_PRESSURE] = 0xff; 163 kbtab->dev.absmax[ABS_PRESSURE] = 0xff;
164 164
165 kbtab->dev.absfuzz[ABS_X] = 4; 165 kbtab->dev.absfuzz[ABS_X] = 4;
166 kbtab->dev.absfuzz[ABS_Y] = 4; 166 kbtab->dev.absfuzz[ABS_Y] = 4;
167 167
diff --git a/drivers/usb/input/powermate.c b/drivers/usb/input/powermate.c
index 7fa2f9b9fb69..3975b309d55f 100644
--- a/drivers/usb/input/powermate.c
+++ b/drivers/usb/input/powermate.c
@@ -10,7 +10,7 @@
10 * back to the host when polled by the USB controller. 10 * back to the host when polled by the USB controller.
11 * 11 *
12 * Testing with the knob I have has shown that it measures approximately 94 "clicks" 12 * Testing with the knob I have has shown that it measures approximately 94 "clicks"
13 * for one full rotation. Testing with my High Speed Rotation Actuator (ok, it was 13 * for one full rotation. Testing with my High Speed Rotation Actuator (ok, it was
14 * a variable speed cordless electric drill) has shown that the device can measure 14 * a variable speed cordless electric drill) has shown that the device can measure
15 * speeds of up to 7 clicks either clockwise or anticlockwise between pollings from 15 * speeds of up to 7 clicks either clockwise or anticlockwise between pollings from
16 * the host. If it counts more than 7 clicks before it is polled, it will wrap back 16 * the host. If it counts more than 7 clicks before it is polled, it will wrap back
@@ -120,9 +120,9 @@ exit:
120/* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */ 120/* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */
121static void powermate_sync_state(struct powermate_device *pm) 121static void powermate_sync_state(struct powermate_device *pm)
122{ 122{
123 if (pm->requires_update == 0) 123 if (pm->requires_update == 0)
124 return; /* no updates are required */ 124 return; /* no updates are required */
125 if (pm->config->status == -EINPROGRESS) 125 if (pm->config->status == -EINPROGRESS)
126 return; /* an update is already in progress; it'll issue this update when it completes */ 126 return; /* an update is already in progress; it'll issue this update when it completes */
127 127
128 if (pm->requires_update & UPDATE_PULSE_ASLEEP){ 128 if (pm->requires_update & UPDATE_PULSE_ASLEEP){
@@ -142,7 +142,7 @@ static void powermate_sync_state(struct powermate_device *pm)
142 2: multiply the speed 142 2: multiply the speed
143 the argument only has an effect for operations 0 and 2, and ranges between 143 the argument only has an effect for operations 0 and 2, and ranges between
144 1 (least effect) to 255 (maximum effect). 144 1 (least effect) to 255 (maximum effect).
145 145
146 thus, several states are equivalent and are coalesced into one state. 146 thus, several states are equivalent and are coalesced into one state.
147 147
148 we map this onto a range from 0 to 510, with: 148 we map this onto a range from 0 to 510, with:
@@ -151,7 +151,7 @@ static void powermate_sync_state(struct powermate_device *pm)
151 256 -- 510 -- use multiple (510 = fastest). 151 256 -- 510 -- use multiple (510 = fastest).
152 152
153 Only values of 'arg' quite close to 255 are particularly useful/spectacular. 153 Only values of 'arg' quite close to 255 are particularly useful/spectacular.
154 */ 154 */
155 if (pm->pulse_speed < 255){ 155 if (pm->pulse_speed < 255){
156 op = 0; // divide 156 op = 0; // divide
157 arg = 255 - pm->pulse_speed; 157 arg = 255 - pm->pulse_speed;
@@ -199,14 +199,14 @@ static void powermate_config_complete(struct urb *urb, struct pt_regs *regs)
199 199
200 if (urb->status) 200 if (urb->status)
201 printk(KERN_ERR "powermate: config urb returned %d\n", urb->status); 201 printk(KERN_ERR "powermate: config urb returned %d\n", urb->status);
202 202
203 spin_lock_irqsave(&pm->lock, flags); 203 spin_lock_irqsave(&pm->lock, flags);
204 powermate_sync_state(pm); 204 powermate_sync_state(pm);
205 spin_unlock_irqrestore(&pm->lock, flags); 205 spin_unlock_irqrestore(&pm->lock, flags);
206} 206}
207 207
208/* Set the LED up as described and begin the sync with the hardware if required */ 208/* Set the LED up as described and begin the sync with the hardware if required */
209static void powermate_pulse_led(struct powermate_device *pm, int static_brightness, int pulse_speed, 209static void powermate_pulse_led(struct powermate_device *pm, int static_brightness, int pulse_speed,
210 int pulse_table, int pulse_asleep, int pulse_awake) 210 int pulse_table, int pulse_asleep, int pulse_awake)
211{ 211{
212 unsigned long flags; 212 unsigned long flags;
@@ -229,7 +229,7 @@ static void powermate_pulse_led(struct powermate_device *pm, int static_brightne
229 /* mark state updates which are required */ 229 /* mark state updates which are required */
230 if (static_brightness != pm->static_brightness){ 230 if (static_brightness != pm->static_brightness){
231 pm->static_brightness = static_brightness; 231 pm->static_brightness = static_brightness;
232 pm->requires_update |= UPDATE_STATIC_BRIGHTNESS; 232 pm->requires_update |= UPDATE_STATIC_BRIGHTNESS;
233 } 233 }
234 if (pulse_asleep != pm->pulse_asleep){ 234 if (pulse_asleep != pm->pulse_asleep){
235 pm->pulse_asleep = pulse_asleep; 235 pm->pulse_asleep = pulse_asleep;
@@ -246,7 +246,7 @@ static void powermate_pulse_led(struct powermate_device *pm, int static_brightne
246 } 246 }
247 247
248 powermate_sync_state(pm); 248 powermate_sync_state(pm);
249 249
250 spin_unlock_irqrestore(&pm->lock, flags); 250 spin_unlock_irqrestore(&pm->lock, flags);
251} 251}
252 252
@@ -257,19 +257,19 @@ static int powermate_input_event(struct input_dev *dev, unsigned int type, unsig
257 struct powermate_device *pm = dev->private; 257 struct powermate_device *pm = dev->private;
258 258
259 if (type == EV_MSC && code == MSC_PULSELED){ 259 if (type == EV_MSC && code == MSC_PULSELED){
260 /* 260 /*
261 bits 0- 7: 8 bits: LED brightness 261 bits 0- 7: 8 bits: LED brightness
262 bits 8-16: 9 bits: pulsing speed modifier (0 ... 510); 0-254 = slower, 255 = standard, 256-510 = faster. 262 bits 8-16: 9 bits: pulsing speed modifier (0 ... 510); 0-254 = slower, 255 = standard, 256-510 = faster.
263 bits 17-18: 2 bits: pulse table (0, 1, 2 valid) 263 bits 17-18: 2 bits: pulse table (0, 1, 2 valid)
264 bit 19: 1 bit : pulse whilst asleep? 264 bit 19: 1 bit : pulse whilst asleep?
265 bit 20: 1 bit : pulse constantly? 265 bit 20: 1 bit : pulse constantly?
266 */ 266 */
267 int static_brightness = command & 0xFF; // bits 0-7 267 int static_brightness = command & 0xFF; // bits 0-7
268 int pulse_speed = (command >> 8) & 0x1FF; // bits 8-16 268 int pulse_speed = (command >> 8) & 0x1FF; // bits 8-16
269 int pulse_table = (command >> 17) & 0x3; // bits 17-18 269 int pulse_table = (command >> 17) & 0x3; // bits 17-18
270 int pulse_asleep = (command >> 19) & 0x1; // bit 19 270 int pulse_asleep = (command >> 19) & 0x1; // bit 19
271 int pulse_awake = (command >> 20) & 0x1; // bit 20 271 int pulse_awake = (command >> 20) & 0x1; // bit 20
272 272
273 powermate_pulse_led(pm, static_brightness, pulse_speed, pulse_table, pulse_asleep, pulse_awake); 273 powermate_pulse_led(pm, static_brightness, pulse_speed, pulse_table, pulse_asleep, pulse_awake);
274 } 274 }
275 275
@@ -378,7 +378,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
378 switch (le16_to_cpu(udev->descriptor.idProduct)) { 378 switch (le16_to_cpu(udev->descriptor.idProduct)) {
379 case POWERMATE_PRODUCT_NEW: pm->input.name = pm_name_powermate; break; 379 case POWERMATE_PRODUCT_NEW: pm->input.name = pm_name_powermate; break;
380 case POWERMATE_PRODUCT_OLD: pm->input.name = pm_name_soundknob; break; 380 case POWERMATE_PRODUCT_OLD: pm->input.name = pm_name_soundknob; break;
381 default: 381 default:
382 pm->input.name = pm_name_soundknob; 382 pm->input.name = pm_name_soundknob;
383 printk(KERN_WARNING "powermate: unknown product id %04x\n", 383 printk(KERN_WARNING "powermate: unknown product id %04x\n",
384 le16_to_cpu(udev->descriptor.idProduct)); 384 le16_to_cpu(udev->descriptor.idProduct));
@@ -402,11 +402,11 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
402 usb_make_path(udev, path, 64); 402 usb_make_path(udev, path, 64);
403 snprintf(pm->phys, 64, "%s/input0", path); 403 snprintf(pm->phys, 64, "%s/input0", path);
404 printk(KERN_INFO "input: %s on %s\n", pm->input.name, pm->input.phys); 404 printk(KERN_INFO "input: %s on %s\n", pm->input.name, pm->input.phys);
405 405
406 /* force an update of everything */ 406 /* force an update of everything */
407 pm->requires_update = UPDATE_PULSE_ASLEEP | UPDATE_PULSE_AWAKE | UPDATE_PULSE_MODE | UPDATE_STATIC_BRIGHTNESS; 407 pm->requires_update = UPDATE_PULSE_ASLEEP | UPDATE_PULSE_AWAKE | UPDATE_PULSE_MODE | UPDATE_STATIC_BRIGHTNESS;
408 powermate_pulse_led(pm, 0x80, 255, 0, 1, 0); // set default pulse parameters 408 powermate_pulse_led(pm, 0x80, 255, 0, 1, 0); // set default pulse parameters
409 409
410 usb_set_intfdata(intf, pm); 410 usb_set_intfdata(intf, pm);
411 return 0; 411 return 0;
412} 412}
diff --git a/drivers/usb/input/usbkbd.c b/drivers/usb/input/usbkbd.c
index 7038fb9d1ced..255b47a517b1 100644
--- a/drivers/usb/input/usbkbd.c
+++ b/drivers/usb/input/usbkbd.c
@@ -9,18 +9,18 @@
9/* 9/*
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or 12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. 13 * (at your option) any later version.
14 * 14 *
15 * This program is distributed in the hope that it will be useful, 15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details. 18 * GNU General Public License for more details.
19 * 19 *
20 * You should have received a copy of the GNU General Public License 20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software 21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * 23 *
24 * Should you need to contact me, the author, you can do so either by 24 * Should you need to contact me, the author, you can do so either by
25 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: 25 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
26 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic 26 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -166,7 +166,7 @@ static void usb_kbd_led(struct urb *urb, struct pt_regs *regs)
166 166
167 if (urb->status) 167 if (urb->status)
168 warn("led urb status %d received", urb->status); 168 warn("led urb status %d received", urb->status);
169 169
170 if (*(kbd->leds) == kbd->newleds) 170 if (*(kbd->leds) == kbd->newleds)
171 return; 171 return;
172 172
@@ -230,7 +230,7 @@ static void usb_kbd_free_mem(struct usb_device *dev, struct usb_kbd *kbd)
230 usb_buffer_free(dev, 1, kbd->leds, kbd->leds_dma); 230 usb_buffer_free(dev, 1, kbd->leds, kbd->leds_dma);
231} 231}
232 232
233static int usb_kbd_probe(struct usb_interface *iface, 233static int usb_kbd_probe(struct usb_interface *iface,
234 const struct usb_device_id *id) 234 const struct usb_device_id *id)
235{ 235{
236 struct usb_device * dev = interface_to_usbdev(iface); 236 struct usb_device * dev = interface_to_usbdev(iface);
@@ -272,7 +272,7 @@ static int usb_kbd_probe(struct usb_interface *iface,
272 for (i = 0; i < 255; i++) 272 for (i = 0; i < 255; i++)
273 set_bit(usb_kbd_keycode[i], kbd->dev.keybit); 273 set_bit(usb_kbd_keycode[i], kbd->dev.keybit);
274 clear_bit(0, kbd->dev.keybit); 274 clear_bit(0, kbd->dev.keybit);
275 275
276 kbd->dev.private = kbd; 276 kbd->dev.private = kbd;
277 kbd->dev.event = usb_kbd_event; 277 kbd->dev.event = usb_kbd_event;
278 kbd->dev.open = usb_kbd_open; 278 kbd->dev.open = usb_kbd_open;
@@ -294,7 +294,7 @@ static int usb_kbd_probe(struct usb_interface *iface,
294 sprintf(kbd->phys, "%s/input0", path); 294 sprintf(kbd->phys, "%s/input0", path);
295 295
296 kbd->dev.name = kbd->name; 296 kbd->dev.name = kbd->name;
297 kbd->dev.phys = kbd->phys; 297 kbd->dev.phys = kbd->phys;
298 kbd->dev.id.bustype = BUS_USB; 298 kbd->dev.id.bustype = BUS_USB;
299 kbd->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor); 299 kbd->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
300 kbd->dev.id.product = le16_to_cpu(dev->descriptor.idProduct); 300 kbd->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
@@ -329,7 +329,7 @@ static int usb_kbd_probe(struct usb_interface *iface,
329static void usb_kbd_disconnect(struct usb_interface *intf) 329static void usb_kbd_disconnect(struct usb_interface *intf)
330{ 330{
331 struct usb_kbd *kbd = usb_get_intfdata (intf); 331 struct usb_kbd *kbd = usb_get_intfdata (intf);
332 332
333 usb_set_intfdata(intf, NULL); 333 usb_set_intfdata(intf, NULL);
334 if (kbd) { 334 if (kbd) {
335 usb_kill_urb(kbd->irq); 335 usb_kill_urb(kbd->irq);
diff --git a/drivers/usb/input/usbmouse.c b/drivers/usb/input/usbmouse.c
index 01155bbddd43..8ca2811fd174 100644
--- a/drivers/usb/input/usbmouse.c
+++ b/drivers/usb/input/usbmouse.c
@@ -9,18 +9,18 @@
9/* 9/*
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or 12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. 13 * (at your option) any later version.
14 * 14 *
15 * This program is distributed in the hope that it will be useful, 15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details. 18 * GNU General Public License for more details.
19 * 19 *
20 * You should have received a copy of the GNU General Public License 20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software 21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * 23 *
24 * Should you need to contact me, the author, you can do so either by 24 * Should you need to contact me, the author, you can do so either by
25 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: 25 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
26 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic 26 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -132,19 +132,19 @@ static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_
132 132
133 interface = intf->cur_altsetting; 133 interface = intf->cur_altsetting;
134 134
135 if (interface->desc.bNumEndpoints != 1) 135 if (interface->desc.bNumEndpoints != 1)
136 return -ENODEV; 136 return -ENODEV;
137 137
138 endpoint = &interface->endpoint[0].desc; 138 endpoint = &interface->endpoint[0].desc;
139 if (!(endpoint->bEndpointAddress & 0x80)) 139 if (!(endpoint->bEndpointAddress & 0x80))
140 return -ENODEV; 140 return -ENODEV;
141 if ((endpoint->bmAttributes & 3) != 3) 141 if ((endpoint->bmAttributes & 3) != 3)
142 return -ENODEV; 142 return -ENODEV;
143 143
144 pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress); 144 pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
145 maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe)); 145 maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
146 146
147 if (!(mouse = kmalloc(sizeof(struct usb_mouse), GFP_KERNEL))) 147 if (!(mouse = kmalloc(sizeof(struct usb_mouse), GFP_KERNEL)))
148 return -ENOMEM; 148 return -ENOMEM;
149 memset(mouse, 0, sizeof(struct usb_mouse)); 149 memset(mouse, 0, sizeof(struct usb_mouse));
150 150
@@ -209,7 +209,7 @@ static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_
209static void usb_mouse_disconnect(struct usb_interface *intf) 209static void usb_mouse_disconnect(struct usb_interface *intf)
210{ 210{
211 struct usb_mouse *mouse = usb_get_intfdata (intf); 211 struct usb_mouse *mouse = usb_get_intfdata (intf);
212 212
213 usb_set_intfdata(intf, NULL); 213 usb_set_intfdata(intf, NULL);
214 if (mouse) { 214 if (mouse) {
215 usb_kill_urb(mouse->irq); 215 usb_kill_urb(mouse->irq);
@@ -238,7 +238,7 @@ static struct usb_driver usb_mouse_driver = {
238static int __init usb_mouse_init(void) 238static int __init usb_mouse_init(void)
239{ 239{
240 int retval = usb_register(&usb_mouse_driver); 240 int retval = usb_register(&usb_mouse_driver);
241 if (retval == 0) 241 if (retval == 0)
242 info(DRIVER_VERSION ":" DRIVER_DESC); 242 info(DRIVER_VERSION ":" DRIVER_DESC);
243 return retval; 243 return retval;
244} 244}
diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c
index fec04dda088e..b3420e12ae4f 100644
--- a/drivers/usb/input/wacom.c
+++ b/drivers/usb/input/wacom.c
@@ -18,7 +18,7 @@
18 * v0.4 (sm) - Support for more Intuos models, menustrip 18 * v0.4 (sm) - Support for more Intuos models, menustrip
19 * relative mode, proximity. 19 * relative mode, proximity.
20 * v0.5 (vp) - Big cleanup, nifty features removed, 20 * v0.5 (vp) - Big cleanup, nifty features removed,
21 * they belong in userspace 21 * they belong in userspace
22 * v1.8 (vp) - Submit URB only when operating, moved to CVS, 22 * v1.8 (vp) - Submit URB only when operating, moved to CVS,
23 * use input_report_key instead of report_btn and 23 * use input_report_key instead of report_btn and
24 * other cleanups 24 * other cleanups
@@ -149,7 +149,7 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs)
149 prox = data[1] & 0x40; 149 prox = data[1] & 0x40;
150 150
151 input_regs(dev, regs); 151 input_regs(dev, regs);
152 152
153 if (prox) { 153 if (prox) {
154 154
155 pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); 155 pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1));
@@ -545,7 +545,7 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
545 545
546 /* process general packets */ 546 /* process general packets */
547 wacom_intuos_general(urb); 547 wacom_intuos_general(urb);
548 548
549 if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0) { /* 4D mouse or Lens cursor packets */ 549 if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0) { /* 4D mouse or Lens cursor packets */
550 550
551 if (data[1] & 0x02) { /* Rotation packet */ 551 if (data[1] & 0x02) { /* Rotation packet */
@@ -555,7 +555,7 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
555 555
556 } else { 556 } else {
557 557
558 if ((data[1] & 0x10) == 0) { /* 4D mouse packets */ 558 if ((data[1] & 0x10) == 0) { /* 4D mouse packets */
559 559
560 input_report_key(dev, BTN_LEFT, data[8] & 0x01); 560 input_report_key(dev, BTN_LEFT, data[8] & 0x01);
561 input_report_key(dev, BTN_MIDDLE, data[8] & 0x02); 561 input_report_key(dev, BTN_MIDDLE, data[8] & 0x02);
@@ -567,11 +567,11 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
567 input_report_abs(dev, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); 567 input_report_abs(dev, ABS_THROTTLE, (data[8] & 0x08) ? -t : t);
568 568
569 } else { 569 } else {
570 if (wacom->tool[idx] == BTN_TOOL_MOUSE) { /* 2D mouse packets */ 570 if (wacom->tool[idx] == BTN_TOOL_MOUSE) { /* 2D mouse packets */
571 input_report_key(dev, BTN_LEFT, data[8] & 0x04); 571 input_report_key(dev, BTN_LEFT, data[8] & 0x04);
572 input_report_key(dev, BTN_MIDDLE, data[8] & 0x08); 572 input_report_key(dev, BTN_MIDDLE, data[8] & 0x08);
573 input_report_key(dev, BTN_RIGHT, data[8] & 0x10); 573 input_report_key(dev, BTN_RIGHT, data[8] & 0x10);
574 input_report_rel(dev, REL_WHEEL, 574 input_report_rel(dev, REL_WHEEL,
575 (-(__u32)(data[8] & 0x01) + (__u32)((data[8] & 0x02) >> 1))); 575 (-(__u32)(data[8] & 0x01) + (__u32)((data[8] & 0x02) >> 1)));
576 } 576 }
577 else { /* Lens cursor packets */ 577 else { /* Lens cursor packets */
@@ -584,7 +584,7 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
584 } 584 }
585 } 585 }
586 } 586 }
587 587
588 input_report_key(dev, wacom->tool[idx], 1); 588 input_report_key(dev, wacom->tool[idx], 1);
589 input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); 589 input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
590 input_sync(dev); 590 input_sync(dev);
@@ -705,20 +705,20 @@ static struct wacom_features wacom_features[] = {
705 { "Wacom Penpartner", 7, 5040, 3780, 255, 32, 0, wacom_penpartner_irq }, 705 { "Wacom Penpartner", 7, 5040, 3780, 255, 32, 0, wacom_penpartner_irq },
706 { "Wacom Graphire", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq }, 706 { "Wacom Graphire", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq },
707 { "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq }, 707 { "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq },
708 { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, 1, wacom_graphire_irq }, 708 { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, 1, wacom_graphire_irq },
709 { "Wacom Graphire3", 8, 10208, 7424, 511, 32, 1, wacom_graphire_irq }, 709 { "Wacom Graphire3", 8, 10208, 7424, 511, 32, 1, wacom_graphire_irq },
710 { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, 1, wacom_graphire_irq }, 710 { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, 1, wacom_graphire_irq },
711 { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq }, 711 { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq },
712 { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, 712 { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq },
713 { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq }, 713 { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq },
714 { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 15, 2, wacom_intuos_irq }, 714 { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 15, 2, wacom_intuos_irq },
715 { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 15, 2, wacom_intuos_irq }, 715 { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 15, 2, wacom_intuos_irq },
716 { "Wacom PL400", 8, 5408, 4056, 255, 32, 3, wacom_pl_irq }, 716 { "Wacom PL400", 8, 5408, 4056, 255, 32, 3, wacom_pl_irq },
717 { "Wacom PL500", 8, 6144, 4608, 255, 32, 3, wacom_pl_irq }, 717 { "Wacom PL500", 8, 6144, 4608, 255, 32, 3, wacom_pl_irq },
718 { "Wacom PL600", 8, 6126, 4604, 255, 32, 3, wacom_pl_irq }, 718 { "Wacom PL600", 8, 6126, 4604, 255, 32, 3, wacom_pl_irq },
719 { "Wacom PL600SX", 8, 6260, 5016, 255, 32, 3, wacom_pl_irq }, 719 { "Wacom PL600SX", 8, 6260, 5016, 255, 32, 3, wacom_pl_irq },
720 { "Wacom PL550", 8, 6144, 4608, 511, 32, 3, wacom_pl_irq }, 720 { "Wacom PL550", 8, 6144, 4608, 511, 32, 3, wacom_pl_irq },
721 { "Wacom PL800", 8, 7220, 5780, 511, 32, 3, wacom_pl_irq }, 721 { "Wacom PL800", 8, 7220, 5780, 511, 32, 3, wacom_pl_irq },
722 { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq }, 722 { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq },
723 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, 723 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq },
724 { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq }, 724 { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq },
@@ -730,7 +730,7 @@ static struct wacom_features wacom_features[] = {
730 { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, 4, wacom_intuos3_irq }, 730 { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, 4, wacom_intuos3_irq },
731 { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, 4, wacom_intuos3_irq }, 731 { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, 4, wacom_intuos3_irq },
732 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, 732 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq },
733 { } 733 { }
734}; 734};
735 735
736static struct usb_device_id wacom_ids[] = { 736static struct usb_device_id wacom_ids[] = {
@@ -828,7 +828,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
828 wacom->dev.relbit[0] |= BIT(REL_WHEEL); 828 wacom->dev.relbit[0] |= BIT(REL_WHEEL);
829 wacom->dev.absbit[0] |= BIT(ABS_DISTANCE); 829 wacom->dev.absbit[0] |= BIT(ABS_DISTANCE);
830 wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); 830 wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE);
831 wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_STYLUS2); 831 wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_STYLUS2);
832 break; 832 break;
833 833
834 case 4: /* new functions for Intuos3 */ 834 case 4: /* new functions for Intuos3 */
@@ -842,13 +842,13 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
842 wacom->dev.mscbit[0] |= BIT(MSC_SERIAL); 842 wacom->dev.mscbit[0] |= BIT(MSC_SERIAL);
843 wacom->dev.relbit[0] |= BIT(REL_WHEEL); 843 wacom->dev.relbit[0] |= BIT(REL_WHEEL);
844 wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE) | BIT(BTN_SIDE) | BIT(BTN_EXTRA); 844 wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE) | BIT(BTN_SIDE) | BIT(BTN_EXTRA);
845 wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_TOOL_BRUSH) 845 wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_TOOL_BRUSH)
846 | BIT(BTN_TOOL_PENCIL) | BIT(BTN_TOOL_AIRBRUSH) | BIT(BTN_TOOL_LENS) | BIT(BTN_STYLUS2); 846 | BIT(BTN_TOOL_PENCIL) | BIT(BTN_TOOL_AIRBRUSH) | BIT(BTN_TOOL_LENS) | BIT(BTN_STYLUS2);
847 wacom->dev.absbit[0] |= BIT(ABS_DISTANCE) | BIT(ABS_WHEEL) | BIT(ABS_TILT_X) | BIT(ABS_TILT_Y) | BIT(ABS_RZ) | BIT(ABS_THROTTLE); 847 wacom->dev.absbit[0] |= BIT(ABS_DISTANCE) | BIT(ABS_WHEEL) | BIT(ABS_TILT_X) | BIT(ABS_TILT_Y) | BIT(ABS_RZ) | BIT(ABS_THROTTLE);
848 break; 848 break;
849 849
850 case 3: 850 case 3:
851 wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_STYLUS2) | BIT(BTN_TOOL_RUBBER); 851 wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_STYLUS2) | BIT(BTN_TOOL_RUBBER);
852 break; 852 break;
853 } 853 }
854 854
diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c
index d65edb22e545..a8076ccc0b2e 100644
--- a/drivers/usb/input/xpad.c
+++ b/drivers/usb/input/xpad.c
@@ -104,11 +104,11 @@ MODULE_DEVICE_TABLE (usb, xpad_table);
104struct usb_xpad { 104struct usb_xpad {
105 struct input_dev dev; /* input device interface */ 105 struct input_dev dev; /* input device interface */
106 struct usb_device *udev; /* usb device */ 106 struct usb_device *udev; /* usb device */
107 107
108 struct urb *irq_in; /* urb for interrupt in report */ 108 struct urb *irq_in; /* urb for interrupt in report */
109 unsigned char *idata; /* input data */ 109 unsigned char *idata; /* input data */
110 dma_addr_t idata_dma; 110 dma_addr_t idata_dma;
111 111
112 char phys[65]; /* physical device path */ 112 char phys[65]; /* physical device path */
113 int open_count; /* reference count */ 113 int open_count; /* reference count */
114}; 114};
@@ -128,35 +128,35 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d
128 struct input_dev *dev = &xpad->dev; 128 struct input_dev *dev = &xpad->dev;
129 129
130 input_regs(dev, regs); 130 input_regs(dev, regs);
131 131
132 /* left stick */ 132 /* left stick */
133 input_report_abs(dev, ABS_X, (__s16) (((__s16)data[13] << 8) | data[12])); 133 input_report_abs(dev, ABS_X, (__s16) (((__s16)data[13] << 8) | data[12]));
134 input_report_abs(dev, ABS_Y, (__s16) (((__s16)data[15] << 8) | data[14])); 134 input_report_abs(dev, ABS_Y, (__s16) (((__s16)data[15] << 8) | data[14]));
135 135
136 /* right stick */ 136 /* right stick */
137 input_report_abs(dev, ABS_RX, (__s16) (((__s16)data[17] << 8) | data[16])); 137 input_report_abs(dev, ABS_RX, (__s16) (((__s16)data[17] << 8) | data[16]));
138 input_report_abs(dev, ABS_RY, (__s16) (((__s16)data[19] << 8) | data[18])); 138 input_report_abs(dev, ABS_RY, (__s16) (((__s16)data[19] << 8) | data[18]));
139 139
140 /* triggers left/right */ 140 /* triggers left/right */
141 input_report_abs(dev, ABS_Z, data[10]); 141 input_report_abs(dev, ABS_Z, data[10]);
142 input_report_abs(dev, ABS_RZ, data[11]); 142 input_report_abs(dev, ABS_RZ, data[11]);
143 143
144 /* digital pad */ 144 /* digital pad */
145 input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x08) - !!(data[2] & 0x04)); 145 input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x08) - !!(data[2] & 0x04));
146 input_report_abs(dev, ABS_HAT0Y, !!(data[2] & 0x02) - !!(data[2] & 0x01)); 146 input_report_abs(dev, ABS_HAT0Y, !!(data[2] & 0x02) - !!(data[2] & 0x01));
147 147
148 /* start/back buttons and stick press left/right */ 148 /* start/back buttons and stick press left/right */
149 input_report_key(dev, BTN_START, (data[2] & 0x10) >> 4); 149 input_report_key(dev, BTN_START, (data[2] & 0x10) >> 4);
150 input_report_key(dev, BTN_BACK, (data[2] & 0x20) >> 5); 150 input_report_key(dev, BTN_BACK, (data[2] & 0x20) >> 5);
151 input_report_key(dev, BTN_THUMBL, (data[2] & 0x40) >> 6); 151 input_report_key(dev, BTN_THUMBL, (data[2] & 0x40) >> 6);
152 input_report_key(dev, BTN_THUMBR, data[2] >> 7); 152 input_report_key(dev, BTN_THUMBR, data[2] >> 7);
153 153
154 /* "analog" buttons A, B, X, Y */ 154 /* "analog" buttons A, B, X, Y */
155 input_report_key(dev, BTN_A, data[4]); 155 input_report_key(dev, BTN_A, data[4]);
156 input_report_key(dev, BTN_B, data[5]); 156 input_report_key(dev, BTN_B, data[5]);
157 input_report_key(dev, BTN_X, data[6]); 157 input_report_key(dev, BTN_X, data[6]);
158 input_report_key(dev, BTN_Y, data[7]); 158 input_report_key(dev, BTN_Y, data[7]);
159 159
160 /* "analog" buttons black, white */ 160 /* "analog" buttons black, white */
161 input_report_key(dev, BTN_C, data[8]); 161 input_report_key(dev, BTN_C, data[8]);
162 input_report_key(dev, BTN_Z, data[9]); 162 input_report_key(dev, BTN_Z, data[9]);
@@ -168,7 +168,7 @@ static void xpad_irq_in(struct urb *urb, struct pt_regs *regs)
168{ 168{
169 struct usb_xpad *xpad = urb->context; 169 struct usb_xpad *xpad = urb->context;
170 int retval; 170 int retval;
171 171
172 switch (urb->status) { 172 switch (urb->status) {
173 case 0: 173 case 0:
174 /* success */ 174 /* success */
@@ -183,7 +183,7 @@ static void xpad_irq_in(struct urb *urb, struct pt_regs *regs)
183 dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); 183 dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
184 goto exit; 184 goto exit;
185 } 185 }
186 186
187 xpad_process_packet(xpad, 0, xpad->idata, regs); 187 xpad_process_packet(xpad, 0, xpad->idata, regs);
188 188
189exit: 189exit:
@@ -196,23 +196,23 @@ exit:
196static int xpad_open (struct input_dev *dev) 196static int xpad_open (struct input_dev *dev)
197{ 197{
198 struct usb_xpad *xpad = dev->private; 198 struct usb_xpad *xpad = dev->private;
199 199
200 if (xpad->open_count++) 200 if (xpad->open_count++)
201 return 0; 201 return 0;
202 202
203 xpad->irq_in->dev = xpad->udev; 203 xpad->irq_in->dev = xpad->udev;
204 if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) { 204 if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) {
205 xpad->open_count--; 205 xpad->open_count--;
206 return -EIO; 206 return -EIO;
207 } 207 }
208 208
209 return 0; 209 return 0;
210} 210}
211 211
212static void xpad_close (struct input_dev *dev) 212static void xpad_close (struct input_dev *dev)
213{ 213{
214 struct usb_xpad *xpad = dev->private; 214 struct usb_xpad *xpad = dev->private;
215 215
216 if (!--xpad->open_count) 216 if (!--xpad->open_count)
217 usb_kill_urb(xpad->irq_in); 217 usb_kill_urb(xpad->irq_in);
218} 218}
@@ -224,19 +224,19 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
224 struct usb_endpoint_descriptor *ep_irq_in; 224 struct usb_endpoint_descriptor *ep_irq_in;
225 char path[64]; 225 char path[64];
226 int i; 226 int i;
227 227
228 for (i = 0; xpad_device[i].idVendor; i++) { 228 for (i = 0; xpad_device[i].idVendor; i++) {
229 if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) && 229 if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) &&
230 (le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct)) 230 (le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct))
231 break; 231 break;
232 } 232 }
233 233
234 if ((xpad = kmalloc (sizeof(struct usb_xpad), GFP_KERNEL)) == NULL) { 234 if ((xpad = kmalloc (sizeof(struct usb_xpad), GFP_KERNEL)) == NULL) {
235 err("cannot allocate memory for new pad"); 235 err("cannot allocate memory for new pad");
236 return -ENOMEM; 236 return -ENOMEM;
237 } 237 }
238 memset(xpad, 0, sizeof(struct usb_xpad)); 238 memset(xpad, 0, sizeof(struct usb_xpad));
239 239
240 xpad->idata = usb_buffer_alloc(udev, XPAD_PKT_LEN, 240 xpad->idata = usb_buffer_alloc(udev, XPAD_PKT_LEN,
241 SLAB_ATOMIC, &xpad->idata_dma); 241 SLAB_ATOMIC, &xpad->idata_dma);
242 if (!xpad->idata) { 242 if (!xpad->idata) {
@@ -251,18 +251,18 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
251 kfree(xpad); 251 kfree(xpad);
252 return -ENOMEM; 252 return -ENOMEM;
253 } 253 }
254 254
255 ep_irq_in = &intf->cur_altsetting->endpoint[0].desc; 255 ep_irq_in = &intf->cur_altsetting->endpoint[0].desc;
256 256
257 usb_fill_int_urb(xpad->irq_in, udev, 257 usb_fill_int_urb(xpad->irq_in, udev,
258 usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress), 258 usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress),
259 xpad->idata, XPAD_PKT_LEN, xpad_irq_in, 259 xpad->idata, XPAD_PKT_LEN, xpad_irq_in,
260 xpad, ep_irq_in->bInterval); 260 xpad, ep_irq_in->bInterval);
261 xpad->irq_in->transfer_dma = xpad->idata_dma; 261 xpad->irq_in->transfer_dma = xpad->idata_dma;
262 xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 262 xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
263 263
264 xpad->udev = udev; 264 xpad->udev = udev;
265 265
266 xpad->dev.id.bustype = BUS_USB; 266 xpad->dev.id.bustype = BUS_USB;
267 xpad->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor); 267 xpad->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
268 xpad->dev.id.product = le16_to_cpu(udev->descriptor.idProduct); 268 xpad->dev.id.product = le16_to_cpu(udev->descriptor.idProduct);
@@ -273,21 +273,21 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
273 xpad->dev.phys = xpad->phys; 273 xpad->dev.phys = xpad->phys;
274 xpad->dev.open = xpad_open; 274 xpad->dev.open = xpad_open;
275 xpad->dev.close = xpad_close; 275 xpad->dev.close = xpad_close;
276 276
277 usb_make_path(udev, path, 64); 277 usb_make_path(udev, path, 64);
278 snprintf(xpad->phys, 64, "%s/input0", path); 278 snprintf(xpad->phys, 64, "%s/input0", path);
279 279
280 xpad->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 280 xpad->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
281 281
282 for (i = 0; xpad_btn[i] >= 0; i++) 282 for (i = 0; xpad_btn[i] >= 0; i++)
283 set_bit(xpad_btn[i], xpad->dev.keybit); 283 set_bit(xpad_btn[i], xpad->dev.keybit);
284 284
285 for (i = 0; xpad_abs[i] >= 0; i++) { 285 for (i = 0; xpad_abs[i] >= 0; i++) {
286 286
287 signed short t = xpad_abs[i]; 287 signed short t = xpad_abs[i];
288 288
289 set_bit(t, xpad->dev.absbit); 289 set_bit(t, xpad->dev.absbit);
290 290
291 switch (t) { 291 switch (t) {
292 case ABS_X: 292 case ABS_X:
293 case ABS_Y: 293 case ABS_Y:
@@ -310,11 +310,11 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
310 break; 310 break;
311 } 311 }
312 } 312 }
313 313
314 input_register_device(&xpad->dev); 314 input_register_device(&xpad->dev);
315 315
316 printk(KERN_INFO "input: %s on %s", xpad->dev.name, path); 316 printk(KERN_INFO "input: %s on %s", xpad->dev.name, path);
317 317
318 usb_set_intfdata(intf, xpad); 318 usb_set_intfdata(intf, xpad);
319 return 0; 319 return 0;
320} 320}
@@ -322,7 +322,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
322static void xpad_disconnect(struct usb_interface *intf) 322static void xpad_disconnect(struct usb_interface *intf)
323{ 323{
324 struct usb_xpad *xpad = usb_get_intfdata (intf); 324 struct usb_xpad *xpad = usb_get_intfdata (intf);
325 325
326 usb_set_intfdata(intf, NULL); 326 usb_set_intfdata(intf, NULL);
327 if (xpad) { 327 if (xpad) {
328 usb_kill_urb(xpad->irq_in); 328 usb_kill_urb(xpad->irq_in);