@@ -165,12 +165,11 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
165165 for (i = 0 ; i < nents ; i ++ , sg ++ ) {
166166 unsigned long addr ;
167167
168- addr = (unsigned long ) page_address (sg -> page );
168+ addr = (unsigned long ) sg_virt (sg );
169169 if (!plat_device_is_coherent (dev ) && addr )
170- __dma_sync (addr + sg -> offset , sg -> length , direction );
170+ __dma_sync (addr , sg -> length , direction );
171171 sg -> dma_address = plat_map_dma_mem (dev ,
172- (void * )(addr + sg -> offset ),
173- sg -> length );
172+ (void * )addr , sg -> length );
174173 }
175174
176175 return nents ;
@@ -223,10 +222,9 @@ void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
223222 for (i = 0 ; i < nhwentries ; i ++ , sg ++ ) {
224223 if (!plat_device_is_coherent (dev ) &&
225224 direction != DMA_TO_DEVICE ) {
226- addr = (unsigned long ) page_address (sg -> page );
225+ addr = (unsigned long ) sg_virt (sg );
227226 if (addr )
228- __dma_sync (addr + sg -> offset , sg -> length ,
229- direction );
227+ __dma_sync (addr , sg -> length , direction );
230228 }
231229 plat_unmap_dma_mem (sg -> dma_address );
232230 }
@@ -304,7 +302,7 @@ void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
304302 /* Make sure that gcc doesn't leave the empty loop body. */
305303 for (i = 0 ; i < nelems ; i ++ , sg ++ ) {
306304 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 ) ),
308306 sg -> length , direction );
309307 plat_unmap_dma_mem (sg -> dma_address );
310308 }
@@ -322,7 +320,7 @@ void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nele
322320 /* Make sure that gcc doesn't leave the empty loop body. */
323321 for (i = 0 ; i < nelems ; i ++ , sg ++ ) {
324322 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 ) ),
326324 sg -> length , direction );
327325 plat_unmap_dma_mem (sg -> dma_address );
328326 }
0 commit comments