aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/cdns3/cdns3-gadget.c
diff options
context:
space:
mode:
authorFrank Li <[email protected]>2023-05-18 20:49:46 +0000
committerGreg Kroah-Hartman <[email protected]>2023-05-29 14:52:37 +0000
commit3124387537bc94251e65c2841062d14736380ec4 (patch)
tree92910d9061d9839f529d19d007c61a9a4971b3c2 /drivers/usb/cdns3/cdns3-gadget.c
parentusb: cdns3: improve handling of unaligned address case (diff)
downloadkernel-3124387537bc94251e65c2841062d14736380ec4.tar.gz
kernel-3124387537bc94251e65c2841062d14736380ec4.zip
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/usb/cdns3/cdns3-gadget.c')
-rw-r--r--drivers/usb/cdns3/cdns3-gadget.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
index d2cedd6db88f..27199198cc26 100644
--- a/drivers/usb/cdns3/cdns3-gadget.c
+++ b/drivers/usb/cdns3/cdns3-gadget.c
@@ -809,10 +809,10 @@ void cdns3_gadget_giveback(struct cdns3_endpoint *priv_ep,
/* Make DMA buffer CPU accessible */
dma_sync_single_for_cpu(priv_dev->sysdev,
priv_req->aligned_buf->dma,
- priv_req->aligned_buf->size,
+ request->actual,
priv_req->aligned_buf->dir);
memcpy(request->buf, priv_req->aligned_buf->buf,
- request->length);
+ request->actual);
}
priv_req->flags &= ~(REQUEST_PENDING | REQUEST_UNALIGNED);