From c81bf7b30e6e42676323e86d4ec4582d44b74b15 Mon Sep 17 00:00:00 2001 From: "John W. Linville" Date: Thu, 29 Sep 2005 14:43:32 -0700 Subject: [PATCH] --- yaml --- r: 12159 b: refs/heads/master c: 8270f3f1a605c83b3aa516c1eaed209fe0884e84 h: refs/heads/master i: 12157: 7128d863cc06d24ad56f2fba920ac0cbe7d9593b 12155: 161f3e5d318d6d08463ad18a970858ee419fbea3 12151: 1601b2d7d873b09dcca7896f53bc4ffd5de051e9 12143: f455d82a85180ae73fa6c4427d159b8798555e9a 12127: 13e144c4d3f07477fe02f258492a24e02c68d18f 12095: 4d326735d09d799f9909ecb8b70e140783c7776d 12031: f85e109a44ab67426d2854e935ca97ee386bf9a1 v: v3 --- [refs] | 2 +- trunk/lib/swiotlb.c | 45 ++++++++++++++++++++++----------------------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/[refs] b/[refs] index da8a8749c1dd..357843f83fa1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6c654b5fdf093cd05f35f7c9c2a00182fa5636dc +refs/heads/master: 8270f3f1a605c83b3aa516c1eaed209fe0884e84 diff --git a/trunk/lib/swiotlb.c b/trunk/lib/swiotlb.c index 875b0c16250c..9719a14649e7 100644 --- a/trunk/lib/swiotlb.c +++ b/trunk/lib/swiotlb.c @@ -594,9 +594,9 @@ swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, size_t size, * address back to the card, you must first perform a * swiotlb_dma_sync_for_device, and then the device again owns the buffer */ -void -swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr, - size_t size, int dir) +static inline void +swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr, + size_t size, int dir) { char *dma_addr = phys_to_virt(dev_addr); @@ -608,18 +608,18 @@ swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr, mark_clean(dma_addr, size); } +void +swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr, + size_t size, int dir) +{ + swiotlb_sync_single(hwdev, dev_addr, size, dir); +} + void swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr, size_t size, int dir) { - char *dma_addr = phys_to_virt(dev_addr); - - if (dir == DMA_NONE) - BUG(); - if (dma_addr >= io_tlb_start && dma_addr < io_tlb_end) - sync_single(hwdev, dma_addr, size, dir); - else if (dir == DMA_FROM_DEVICE) - mark_clean(dma_addr, size); + swiotlb_sync_single(hwdev, dev_addr, size, dir); } /* @@ -696,9 +696,9 @@ swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nelems, * The same as swiotlb_sync_single_* but for a scatter-gather list, same rules * and usage. */ -void -swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, - int nelems, int dir) +static inline void +swiotlb_sync_sg(struct device *hwdev, struct scatterlist *sg, + int nelems, int dir) { int i; @@ -711,19 +711,18 @@ swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, sg->dma_length, dir); } +void +swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, + int nelems, int dir) +{ + swiotlb_sync_sg(hwdev, sg, nelems, dir); +} + void swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, int nelems, int dir) { - int i; - - if (dir == DMA_NONE) - BUG(); - - for (i = 0; i < nelems; i++, sg++) - if (sg->dma_address != SG_ENT_PHYS_ADDRESS(sg)) - sync_single(hwdev, (void *) sg->dma_address, - sg->dma_length, dir); + swiotlb_sync_sg(hwdev, sg, nelems, dir); } int