Re: [PATCH 2/2] usb: cdns3: Optimize DMA request buffer allocation

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

 



On 21-03-15 15:51:04, Sanket Parmar wrote:
> > > +
> > >  	priv_req->flags |= REQUEST_UNALIGNED;
> > >  	trace_cdns3_prepare_aligned_request(priv_req);
> > >
> > > @@ -3088,11 +3113,11 @@ static void cdns3_gadget_exit(struct cdns
> > *cdns)
> > >  		struct cdns3_aligned_buf *buf;
> > >
> > >  		buf = cdns3_next_align_buf(&priv_dev->aligned_buf_list);
> > > -		dma_free_coherent(priv_dev->sysdev, buf->size,
> > > -				  buf->buf,
> > > -				  buf->dma);
> > > +		dma_unmap_single(priv_dev->sysdev, buf->dma, buf->size,
> > > +			buf->dir);
> > 
> > It only needs to DMA unmap after DMA has completed, this buf will not be
> > used, otherwise, the kfree below will cause issue.
> 
> This part is not clear.  Aligned DMA buffer is allocated and mapped in cdns3_prepare_aligned_request_buf()
> and put into aligned_buf_list. While unloading the gadget, We need to undo the same if aligned_buf_list is not
> empty.  Am I missing something here? 

My point is this unmap operation is useless since there is no user for
aligned buf, and it calls kfree afterwards. You could also keep it as it has
no harm.

> 
> Also, I will post v2 of this patch which uses dma_*_noncoherent APIs suggested by Christoph Hellwig.

-- 

Thanks,
Peter Chen




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux