if (dir == DMA_FROM_DEVICE) memcpy(buffer, dma_addr, size); else if (dir == DMA_TO_DEVICE) memcpy(dma_addr, buffer, size); else
switch (target) { case SYNC_FOR_CPU: if (likely(dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL)) memcpy(buffer, dma_addr, size); else if (dir != DMA_TO_DEVICE) BUG(); break; case SYNC_FOR_DEVICE: if (likely(dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL)) memcpy(dma_addr, buffer, size); else if (dir != DMA_FROM_DEVICE) BUG(); break; default:
sync_single(struct device *hwdev, char *dma_addr, size_t size, int dir){	int index = (dma_addr - io_tlb_start) >> IO_TLB_SHIFT;	char *buffer = io_tlb_orig_addr[index];	/*	 * bounce... copy the data back into/from the original buffer	 * XXX How do you handle DMA_BIDIRECTIONAL here ?	 */	if (dir == DMA_FROM_DEVICE)		memcpy(buffer, dma_addr, size);	else if (dir == DMA_TO_DEVICE)		memcpy(dma_addr, buffer, size);	else		BUG();}