diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2007-10-22 14:02:46 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2007-10-22 15:19:59 -0400 |
commit | 58b053e4ce9d2fc3023645c1b96e537c72aa8d9a (patch) | |
tree | 35fbd72eb62a37375bc06c01e356afd7da0c9693 /arch/mips/mm/dma-default.c | |
parent | f9527f121bd42c5d300815fbf12216bc1a63f60f (diff) |
Update arch/ to use sg helpers
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'arch/mips/mm/dma-default.c')
-rw-r--r-- | arch/mips/mm/dma-default.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c index 98b5e5bac02e..b0b034c4654f 100644 --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c | |||
@@ -165,12 +165,11 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
165 | for (i = 0; i < nents; i++, sg++) { | 165 | for (i = 0; i < nents; i++, sg++) { |
166 | unsigned long addr; | 166 | unsigned long addr; |
167 | 167 | ||
168 | addr = (unsigned long) page_address(sg->page); | 168 | addr = (unsigned long) sg_virt(sg); |
169 | if (!plat_device_is_coherent(dev) && addr) | 169 | if (!plat_device_is_coherent(dev) && addr) |
170 | __dma_sync(addr + sg->offset, sg->length, direction); | 170 | __dma_sync(addr, sg->length, direction); |
171 | sg->dma_address = plat_map_dma_mem(dev, | 171 | sg->dma_address = plat_map_dma_mem(dev, |
172 | (void *)(addr + sg->offset), | 172 | (void *)addr, sg->length); |
173 | sg->length); | ||
174 | } | 173 | } |
175 | 174 | ||
176 | return nents; | 175 | return nents; |
@@ -223,10 +222,9 @@ void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | |||
223 | for (i = 0; i < nhwentries; i++, sg++) { | 222 | for (i = 0; i < nhwentries; i++, sg++) { |
224 | if (!plat_device_is_coherent(dev) && | 223 | if (!plat_device_is_coherent(dev) && |
225 | direction != DMA_TO_DEVICE) { | 224 | direction != DMA_TO_DEVICE) { |
226 | addr = (unsigned long) page_address(sg->page); | 225 | addr = (unsigned long) sg_virt(sg); |
227 | if (addr) | 226 | if (addr) |
228 | __dma_sync(addr + sg->offset, sg->length, | 227 | __dma_sync(addr, sg->length, direction); |
229 | direction); | ||
230 | } | 228 | } |
231 | plat_unmap_dma_mem(sg->dma_address); | 229 | plat_unmap_dma_mem(sg->dma_address); |
232 | } | 230 | } |
@@ -304,7 +302,7 @@ void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, | |||
304 | /* Make sure that gcc doesn't leave the empty loop body. */ | 302 | /* Make sure that gcc doesn't leave the empty loop body. */ |
305 | for (i = 0; i < nelems; i++, sg++) { | 303 | for (i = 0; i < nelems; i++, sg++) { |
306 | if (cpu_is_noncoherent_r10000(dev)) | 304 | if (cpu_is_noncoherent_r10000(dev)) |
307 | __dma_sync((unsigned long)page_address(sg->page), | 305 | __dma_sync((unsigned long)page_address(sg_page(sg)), |
308 | sg->length, direction); | 306 | sg->length, direction); |
309 | plat_unmap_dma_mem(sg->dma_address); | 307 | plat_unmap_dma_mem(sg->dma_address); |
310 | } | 308 | } |
@@ -322,7 +320,7 @@ void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nele | |||
322 | /* Make sure that gcc doesn't leave the empty loop body. */ | 320 | /* Make sure that gcc doesn't leave the empty loop body. */ |
323 | for (i = 0; i < nelems; i++, sg++) { | 321 | for (i = 0; i < nelems; i++, sg++) { |
324 | if (!plat_device_is_coherent(dev)) | 322 | if (!plat_device_is_coherent(dev)) |
325 | __dma_sync((unsigned long)page_address(sg->page), | 323 | __dma_sync((unsigned long)page_address(sg_page(sg)), |
326 | sg->length, direction); | 324 | sg->length, direction); |
327 | plat_unmap_dma_mem(sg->dma_address); | 325 | plat_unmap_dma_mem(sg->dma_address); |
328 | } | 326 | } |