linux/drivers/usb/input
Grant Grundler 4550718f6c USB: input: extract() and implement() are bit field manipulation routines
extract() and implement() have brain damaged attempts to handle 32-bit wide
"fields".

The problem is the index math in the original code didn't clear all the
relevant bits.  (offset >> 5) only compensated for 32-bit index.  We need
(offset >> 6) if we want to use 64-bit loads.

But it was also wrong in that it tried to use quasi-aligned loads.  Ie
"report" was only incremented in multiples of 4 bytes and then the offset
was masked off for values greater than 4 bytes.  The right way is to
pretend "report" points at a byte array.  And offset is then only minor
adjustment for < 8 bits of offset.  "n" (field width) can then be as big as
24 (assuming 32-bit loads) since "offset" will never be bigger than 7.

If someone needs either function to handle more than 24-bits, please
document why - point at a specification or specific USB hid device - in
comments in the code.

extract/implement() are also an eyesore to read.  Please banish whoever
wrote it to read CodingStyle 3 times in a row to a classroom full of 1st
graders armed with rubberbands.  Or just flame them.  Whatever.  Globbing
all the code together on two lines does NOT make it faster and is Just
Wrong.

I've tested this patch on j6000 (dual 750Mhz PA-RISC, 32-bit 2.6.12-rc5). 
Kyle McMartin tested on c3000 (up 400Mhz PA-RISC, same kernel).  "p2-mate"
(Peter De Schrijver?) tested on sb1250 (dual core Mips, broadcom "swarm"
eval board).

Signed-off-by: Grant Grundler <grundler@parisc-linux.org>
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Cc: Vojtech Pavlik <vojtech@suse.cz>
Cc: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-10-17 14:46:33 -07:00
..
acecad.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
aiptek.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
appletouch.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
ati_remote2.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
ati_remote.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hid-core.c USB: input: extract() and implement() are bit field manipulation routines 2006-10-17 14:46:33 -07:00
hid-debug.h Input: fix misspelling of Hangeul key 2006-06-26 01:51:23 -04:00
hid-ff.c Input: add force feedback driver for PSX-style Zeroplus devices 2006-07-19 01:44:17 -04:00
hid-input.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hid-lgff.c Input: use new FF interface in the HID force feedback drivers 2006-07-19 01:40:55 -04:00
hid-pidff.c Input: add force feedback driver for PID devices 2006-07-19 01:40:47 -04:00
hid-tmff.c Input: use new FF interface in the HID force feedback drivers 2006-07-19 01:40:55 -04:00
hid-zpff.c Input: add force feedback driver for PSX-style Zeroplus devices 2006-07-19 01:44:17 -04:00
hid.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
hiddev.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
itmtouch.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
kbtab.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
Kconfig USB: move trancevibrator.c to the proper usb directory 2006-10-17 14:46:32 -07:00
keyspan_remote.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
Makefile USB: move trancevibrator.c to the proper usb directory 2006-10-17 14:46:32 -07:00
map_to_7segment.h [PATCH] USB: Buffer overflow patch for Yealink driver 2005-10-28 16:47:44 -07:00
mtouchusb.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
powermate.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
touchkitusb.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
usbkbd.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
usbmouse.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
usbtouchscreen.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
wacom_sys.c USB: fix use after free in wacom_sys.c 2006-10-17 14:46:30 -07:00
wacom_wac.c USB: Wacom driver updates 2006-10-17 14:46:30 -07:00
wacom_wac.h USB: Wacom driver updates 2006-10-17 14:46:30 -07:00
wacom.h USB: Wacom driver updates 2006-10-17 14:46:30 -07:00
xpad.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
yealink.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
yealink.h [PATCH] input-driver-yealink-P1K-usb-phone 2005-09-08 16:40:57 -07:00