lkml.org 
[lkml]   [2021]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 2/2] usb: cdns3: Optimize DMA request buffer allocation
Date
> On Tue, Mar 09, 2021 at 06:19:40AM +0100, Sanket Parmar wrote:
> > dma_alloc_coherent() might fail on the platform with a small DMA region.
> >
> > To avoid such failure in cdns3_prepare_aligned_request_buf(),
> > dma_alloc_coherent() is replaced with kmalloc and dma_map API to
> > allocate aligned request buffer of dynamic length.
>
> dma_alloc_noncoherent is the proper API instead of using kmalloc, which
> can lead to unaddressable memory that might require bounce buffering.

cdns3 device required DMA coherent buffer to perform operations. So
dma_alloc_noncoherent will not help here.

Also all gadget classes(except g_ether) use kmalloc to allocated request buffer,
and device driver uses usb_gadget_map_request_by_dev to map the request
buffer. Similar approach is used to allocate aligned buffer.

Thanks,
Sanket

\
 
 \ /
  Last update: 2021-03-09 11:20    [W:0.113 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site