Input: evdev - fall back to vmalloc for client event buffer
authorDaniel Stone <daniel@fooishbar.org>
Thu, 31 Oct 2013 07:25:34 +0000 (00:25 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 31 Oct 2013 15:45:42 +0000 (08:45 -0700)
commit92eb77d0ffbaa71b501a0a8dabf09a351bf4267f
tree88ce9406ab92dc2c33d42baf9292dd616874a2ea
parent5df682b297f6b23ec35615ed7bb50cbb25d25869
Input: evdev - fall back to vmalloc for client event buffer

evdev always tries to allocate the event buffer for clients using
kzalloc rather than vmalloc, presumably to avoid mapping overhead where
possible.  However, drivers like bcm5974, which claims support for
reporting 16 fingers simultaneously, can have an extraordinarily large
buffer.  The resultant contiguous order-4 allocation attempt fails due
to fragmentation, and the device is thus unusable until reboot.

Try kzalloc if we can to avoid the mapping overhead, but if that fails,
fall back to vzalloc.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/evdev.c