linux - Difference between usb_alloc_coherent and kzalloc/kmalloc -


what fundamental difference between using usb_alloc_coherent , kzalloc/kmalloc in context of usb driver. both same, allocate memory area urb buffer. difference of them. there benefit of using usb_alloc_coherent instead of kzalloc/kmalloc?

drivers device (endpoint) centric memory allocation must consult capabilities of usb controller. because controller performs dma memory onto usb bus. usb_alloc_coherent wraps generic dma_alloc_coherent calls controller, not endpoint. using dma-api instead of kmalloc ensures no bounce-buffers required.

this saves device driver writes code ugliness (breaking abstractions) , handling of corner cases. usb_alloc_coherent uses memory poll speed things bit.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -