History

USB: rename usb_buffer_alloc() and usb_buffer_free()

For more clearance what the functions actually do, usb_buffer_alloc() is renamed to usb_alloc_coherent() usb_buffer_free() is renamed to usb_free_coherent() They should only be used in code which really needs DMA coherency. [added compatibility macros so we can convert things easier - gregkh]

Daniel Mack committed 16 years ago

Commit 073900a1 parent 75181f32 files · +25 −13Browse files

Showing the changes to include (1 of 2 files). Show all

Unified · Split

include/linux/usb.h+15−3
@@ -1085,7 +1085,7 @@ typedef void (*usb_complete_t)(struct urb *); · 1084 unmodified lines
10851085 * Alternatively, drivers may pass the URB_NO_xxx_DMA_MAP transfer flags,
10861086 * which tell the host controller driver that no such mapping is needed since
10871087 * the device driver is DMA-aware. For example, a device driver might
1088− * allocate a DMA buffer with usb_buffer_alloc() or call usb_buffer_map().
1088+ * allocate a DMA buffer with usb_alloc_coherent() or call usb_buffer_map().
10891089 * When these transfer flags are provided, host controller drivers will
10901090 * attempt to use the dma addresses found in the transfer_dma and/or
10911091 * setup_dma fields rather than determining a dma address themselves.
@@ -1366,11 +1366,23 @@ static inline int usb_urb_dir_out(struct urb *urb) · 274 unmodified lines
13661366 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;
13671367 }
13681368
1369−void *usb_buffer_alloc(struct usb_device *dev, size_t size,
1369+void *usb_alloc_coherent(struct usb_device *dev, size_t size,
13701370 gfp_t mem_flags, dma_addr_t *dma);
1371−void usb_buffer_free(struct usb_device *dev, size_t size,
1371+void usb_free_coherent(struct usb_device *dev, size_t size,
13721372 void *addr, dma_addr_t dma);
13731373
1374+/* Compatible macros while we switch over */
1375+static inline void *usb_buffer_alloc(struct usb_device *dev, size_t size,
1376+ gfp_t mem_flags, dma_addr_t *dma)
1377+{
1378+ return usb_alloc_coherent(dev, size, mem_flags, dma);
1379+}
1380+static inline void usb_buffer_free(struct usb_device *dev, size_t size,
1381+ void *addr, dma_addr_t dma)
1382+{
1383+ return usb_free_coherent(dev, size, addr, dma);
1384+}
1385+
13741386 #if 0
13751387 struct urb *usb_buffer_map(struct urb *urb);
13761388 void usb_buffer_dmasync(struct urb *urb);