From: Johan Hovold <johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Frans Klaver <fransklaver-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Johan Hovold <johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Greg Kroah-Hartman
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>,
Alan Stern
<stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>,
"linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
Thierry Reding
<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Alexandre Courbot
<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 2/3] USB: ehci-tegra: fix inefficient copy of unaligned buffers
Date: Thu, 23 Apr 2015 16:45:08 +0200 [thread overview]
Message-ID: <20150423144508.GA22193@localhost> (raw)
In-Reply-To: <CAH6sp9PFE_kQn5hpXaGhn6d_WTtKZUbfS-DpDRfRCKbBj9S4fQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Thu, Apr 23, 2015 at 04:31:51PM +0200, Frans Klaver wrote:
> On Thu, Apr 23, 2015 at 4:06 PM, Johan Hovold <johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> > static void free_dma_aligned_buffer(struct urb *urb)
> > {
> > struct dma_aligned_buffer *temp;
> > + size_t length;
> >
> > if (!(urb->transfer_flags & URB_ALIGNED_TEMP_BUFFER))
> > return;
> > @@ -311,9 +312,14 @@ static void free_dma_aligned_buffer(struct urb *urb)
> > temp = container_of(urb->transfer_buffer,
> > struct dma_aligned_buffer, data);
> >
> > - if (usb_urb_dir_in(urb))
> > - memcpy(temp->old_xfer_buffer, temp->data,
> > - urb->transfer_buffer_length);
> > + if (usb_urb_dir_in(urb)) {
> > + if (usb_pipeisoc(urb->pipe))
> > + length = urb->transfer_buffer_length;
> > + else
> > + length = urb->actual_length;
> > +
> > + memcpy(temp->old_xfer_buffer, temp->data, length);
> > + }
> > urb->transfer_buffer = temp->old_xfer_buffer;
> > kfree(temp->kmalloc_ptr);
>
> Out of curiosity: any reason not to declare that length variable
> inside this new compound?
Just my style preference.
Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Johan Hovold <johan@kernel.org>
To: Frans Klaver <fransklaver@gmail.com>
Cc: Johan Hovold <johan@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Felipe Balbi <balbi@ti.com>,
Alan Stern <stern@rowland.harvard.edu>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Stephen Warren <swarren@wwwdotorg.org>,
Thierry Reding <thierry.reding@gmail.com>,
Alexandre Courbot <gnurou@gmail.com>,
linux-tegra@vger.kernel.org
Subject: Re: [PATCH v2 2/3] USB: ehci-tegra: fix inefficient copy of unaligned buffers
Date: Thu, 23 Apr 2015 16:45:08 +0200 [thread overview]
Message-ID: <20150423144508.GA22193@localhost> (raw)
In-Reply-To: <CAH6sp9PFE_kQn5hpXaGhn6d_WTtKZUbfS-DpDRfRCKbBj9S4fQ@mail.gmail.com>
On Thu, Apr 23, 2015 at 04:31:51PM +0200, Frans Klaver wrote:
> On Thu, Apr 23, 2015 at 4:06 PM, Johan Hovold <johan@kernel.org> wrote:
> > static void free_dma_aligned_buffer(struct urb *urb)
> > {
> > struct dma_aligned_buffer *temp;
> > + size_t length;
> >
> > if (!(urb->transfer_flags & URB_ALIGNED_TEMP_BUFFER))
> > return;
> > @@ -311,9 +312,14 @@ static void free_dma_aligned_buffer(struct urb *urb)
> > temp = container_of(urb->transfer_buffer,
> > struct dma_aligned_buffer, data);
> >
> > - if (usb_urb_dir_in(urb))
> > - memcpy(temp->old_xfer_buffer, temp->data,
> > - urb->transfer_buffer_length);
> > + if (usb_urb_dir_in(urb)) {
> > + if (usb_pipeisoc(urb->pipe))
> > + length = urb->transfer_buffer_length;
> > + else
> > + length = urb->actual_length;
> > +
> > + memcpy(temp->old_xfer_buffer, temp->data, length);
> > + }
> > urb->transfer_buffer = temp->old_xfer_buffer;
> > kfree(temp->kmalloc_ptr);
>
> Out of curiosity: any reason not to declare that length variable
> inside this new compound?
Just my style preference.
Johan
next prev parent reply other threads:[~2015-04-23 14:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-23 14:06 [PATCH v2 0/3] USB: fix inefficient copy of unaligned buffers Johan Hovold
2015-04-23 14:06 ` Johan Hovold
2015-04-23 14:06 ` [PATCH v2 1/3] USB: musb: " Johan Hovold
[not found] ` <1429798012-21916-1-git-send-email-johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-04-23 14:06 ` [PATCH v2 2/3] USB: ehci-tegra: " Johan Hovold
2015-04-23 14:06 ` Johan Hovold
2015-04-23 14:31 ` Frans Klaver
[not found] ` <CAH6sp9PFE_kQn5hpXaGhn6d_WTtKZUbfS-DpDRfRCKbBj9S4fQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-23 14:45 ` Johan Hovold [this message]
2015-04-23 14:45 ` Johan Hovold
[not found] ` <1429798012-21916-3-git-send-email-johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-04-23 14:48 ` Alan Stern
2015-04-23 14:48 ` Alan Stern
2015-04-23 20:32 ` Stephen Warren
[not found] ` <553956DA.2090300-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-04-24 6:31 ` Johan Hovold
2015-04-24 6:31 ` Johan Hovold
2015-04-23 14:06 ` [PATCH v2 3/3] staging: octeon-usb: fix unaligned isochronous transfers Johan Hovold
2015-04-23 14:06 ` Johan Hovold
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=20150423144508.GA22193@localhost \
--to=johan-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=balbi-l0cyMroinI0@public.gmane.org \
--cc=fransklaver-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.