public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@kernel.org>
To: Frank Li <Frank.Li@nxp.com>
Cc: Pawel Laszczak <pawell@cadence.com>,
	Roger Quadros <rogerq@kernel.org>,
	Aswath Govindraju <a-govindraju@ti.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"open list:CADENCE USB3 DRD IP DRIVER"
	<linux-usb@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	imx@lists.linux.dev
Subject: Re: [PATCH 2/2] usb: cdns3: optimize OUT transfer by copying only actual received data
Date: Mon, 5 Jun 2023 07:03:01 +0800	[thread overview]
Message-ID: <20230604230301.GB258497@nchen-desktop> (raw)
In-Reply-To: <20230518204947.3770236-2-Frank.Li@nxp.com>

On 23-05-18 16:49:46, Frank Li wrote:
> 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>
> ---
>  drivers/usb/cdns3/cdns3-gadget.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> index 09a0882a4e97..ea19253fd2d0 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);
>  	}

Acked-by: Peter Chen <peter.chen@kernel.org>

>  
>  	priv_req->flags &= ~(REQUEST_PENDING | REQUEST_UNALIGNED);
> -- 
> 2.34.1
> 

-- 

Thanks,
Peter Chen

  reply	other threads:[~2023-06-04 23:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18 20:49 [PATCH 1/2] usb: cdns3: improve handling of unaligned address case Frank Li
2023-05-18 20:49 ` [PATCH 2/2] usb: cdns3: optimize OUT transfer by copying only actual received data Frank Li
2023-06-04 23:03   ` Peter Chen [this message]
2023-06-04 23:12 ` [PATCH 1/2] usb: cdns3: improve handling of unaligned address case Peter Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230604230301.GB258497@nchen-desktop \
    --to=peter.chen@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=a-govindraju@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pawell@cadence.com \
    --cc=rogerq@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox