Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: cdns3: optimize OUT transfer by copying only actual received data

Previously, the entire length of the request, which is equal to or greater
than the actual data, was dma synced and memcpy when using the bounce
buffer. Actually only the actual data indicated by request->actual need be
synced and copied.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20230518204947.3770236-2-Frank.Li@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Frank Li and committed by
Greg Kroah-Hartman
31243875 2a1c4639

+2 -2
+2 -2
drivers/usb/cdns3/cdns3-gadget.c
··· 809 809 /* Make DMA buffer CPU accessible */ 810 810 dma_sync_single_for_cpu(priv_dev->sysdev, 811 811 priv_req->aligned_buf->dma, 812 - priv_req->aligned_buf->size, 812 + request->actual, 813 813 priv_req->aligned_buf->dir); 814 814 memcpy(request->buf, priv_req->aligned_buf->buf, 815 - request->length); 815 + request->actual); 816 816 } 817 817 818 818 priv_req->flags &= ~(REQUEST_PENDING | REQUEST_UNALIGNED);