Google
  Web www.spinics.net

Re: [PATCH][1/2] usb: dma bounce buffer support V3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Jan 22, 2008 2:01 PM, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, 22 Jan 2008 12:20:10 +0900 Magnus Damm <magnus.damm@xxxxxxxxx> wrote:
>
> > usb: dma bounce buffer support V3
> >
> > This patch adds dma bounce buffer support to the usb core. These buffers
> > can be enabled with the HCD_LOCAL_MEM flag, and they make sure that all data
> > passed to the host controller is allocated using dma_alloc_coherent().
>
> It is unobvious (to me) why this code uses put_unaligned() and
> get_unaligned() in the places where it does.  So I'll assume that it will
> be unobvious to other reviewers and readers.

The HCD_LOCAL_MEM dma bounce buffer code is using unaligned functions
to temporarily save a pointer at the end of the dma data buffer.
hcd_alloc_coherent() saves the pointer which is needed by
hcd_free_coherent(). The unaligned functions are used because the size
of the buffer may be uneven.

It's of course possible to round up the size instead and use aligned
access if you prefer that. The memory area used for dma may be limited
though so I felt it was natural to optimize for small memory footprint
over access speed.

Thanks,

/ magnus

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
linux-usb-devel@xxxxxxxxxxxxxxxxxxxxx
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

[Home]     [Video for Linux]     [Photo]     [Yosemite Forum]     [Yosemite Photos]    [Video Projectors]     [PDAs]     [Hacking TiVo]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Devices]     [Big List of Linux Books]     [Free Dating]

  Powered by Linux