'\" t .\" Title: usb_alloc_coherent .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: January 2017 .\" Manual: USB Core APIs .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "USB_ALLOC_COHERENT" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "USB Core APIs" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" usb_alloc_coherent \- allocate dma\-consistent buffer for URB_NO_xxx_DMA_MAP .SH "SYNOPSIS" .HP \w'void\ *\ usb_alloc_coherent('u .BI "void * usb_alloc_coherent(struct\ usb_device\ *\ " "dev" ", size_t\ " "size" ", gfp_t\ " "mem_flags" ", dma_addr_t\ *\ " "dma" ");" .SH "ARGUMENTS" .PP \fIdev\fR .RS 4 device the buffer will be used with .RE .PP \fIsize\fR .RS 4 requested buffer size .RE .PP \fImem_flags\fR .RS 4 affect whether allocation may block .RE .PP \fIdma\fR .RS 4 used to return DMA address of buffer .RE .SH "RETURN" .PP Either null (indicating no buffer could be allocated), or the cpu\-space pointer to a buffer that may be used to perform DMA to the specified device\&. Such cpu\-space buffers are returned along with the DMA address (through the pointer provided)\&. .SH "NOTE" .PP These buffers are used with URB_NO_xxx_DMA_MAP set in urb\->transfer_flags to avoid behaviors like using \(lqDMA bounce buffers\(rq, or thrashing IOMMU hardware during URB completion/resubmit\&. The implementation varies between platforms, depending on details of how DMA will work to this device\&. Using these buffers also eliminates cacheline sharing problems on architectures where CPU caches are not DMA\-coherent\&. On systems without bus\-snooping caches, these buffers are uncached\&. .PP When the buffer is no longer used, free it with \fBusb_free_coherent\fR\&. .SH "COPYRIGHT" .br