usb: gadget: f_fs: Allow scatter-gather buffers
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Wed, 14 Nov 2018 09:47:48 +0000 (10:47 +0100)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 26 Nov 2018 07:06:32 +0000 (09:06 +0200)
commit772a7a724f69d258025fedd87dde1aafe4171aef
tree5e104d07a9fa9e667a5b08c7cf378089cea2ce94
parent7f7c548c5f652375a61c1072bac3db11f7a48326
usb: gadget: f_fs: Allow scatter-gather buffers

Some protocols implemented in userspace with FunctionFS might require large
buffers, e.g. 64kB or more. Currently the said memory is allocated with
kmalloc, which might fail should system memory be highly fragmented.

On the other hand, some UDC hardware allows scatter-gather operation and
this patch takes advantage of this capability: if the requested buffer
is larger than PAGE_SIZE and the UDC allows scatter-gather operation, then
the buffer is allocated with vmalloc and a scatterlist describing it is
created and passed to usb request.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/function/f_fs.c