All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ppc sg chaining support fixes
@ 2007-08-15 23:15 FUJITA Tomonori
  2007-08-16  6:51 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: FUJITA Tomonori @ 2007-08-15 23:15 UTC (permalink / raw)
  To: linux-scsi; +Cc: jens.axboe, paulus

This is for the sglist branch in Jens' block git tree.

---
>From 445923d1a8ff272293af3aadb6e58f82e6439e98 Mon Sep 17 00:00:00 2001
From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Date: Thu, 16 Aug 2007 02:25:32 +0900
Subject: [PATCH] ppc sg chaining support fixes

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 arch/powerpc/kernel/iommu.c       |    5 +++--
 include/asm-powerpc/dma-mapping.h |   15 +++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index a146856..324bbc1 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -342,7 +342,8 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
 			if (novmerge || (dma_addr != dma_next)) {
 				/* Can't merge: create a new segment */
 				segstart = s;
-				outcount++; outs++;
+				outcount++;
+				outs = sg_next(outs);
 				DBG("    can't merge, new segment.\n");
 			} else {
 				outs->dma_length += s->length;
@@ -375,7 +376,7 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
 	 * next entry of the sglist if we didn't fill the list completely
 	 */
 	if (outcount < incount) {
-		outs++;
+		outs = sg_next(outs);
 		outs->dma_address = DMA_ERROR_CODE;
 		outs->dma_length = 0;
 	}
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index 8e57c18..8ffc759 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -268,14 +268,15 @@ dma_map_page(struct device *dev, struct page *page,
 #define dma_unmap_page(dev, handle, size, dir)	((void)0)
 
 static inline int
-dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
+dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
 	   enum dma_data_direction direction)
 {
+	struct scatterlist *sg;
 	int i;
 
 	BUG_ON(direction == DMA_NONE);
 
-	for (i = 0; i < nents; i++, sg++) {
+	for_each_sg(sgl, sg, nents, i) {
 		BUG_ON(!sg->page);
 		__dma_sync_page(sg->page, sg->offset, sg->length, direction);
 		sg->dma_address = page_to_bus(sg->page) + sg->offset;
@@ -306,26 +307,28 @@ static inline void dma_sync_single_for_device(struct device *dev,
 }
 
 static inline void dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sg, int nents,
+		struct scatterlist *sgl, int nents,
 		enum dma_data_direction direction)
 {
+	struct scatterlist *sg;
 	int i;
 
 	BUG_ON(direction == DMA_NONE);
 
-	for (i = 0; i < nents; i++, sg++)
+	for_each_sg(sgl, sg, nents, i)
 		__dma_sync_page(sg->page, sg->offset, sg->length, direction);
 }
 
 static inline void dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sg, int nents,
+		struct scatterlist *sgl, int nents,
 		enum dma_data_direction direction)
 {
+	struct scatterlist *sg;
 	int i;
 
 	BUG_ON(direction == DMA_NONE);
 
-	for (i = 0; i < nents; i++, sg++)
+	for_each_sg(sgl, sg, nents, i)
 		__dma_sync_page(sg->page, sg->offset, sg->length, direction);
 }
 
-- 
1.5.2.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ppc sg chaining support fixes
  2007-08-15 23:15 [PATCH] ppc sg chaining support fixes FUJITA Tomonori
@ 2007-08-16  6:51 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2007-08-16  6:51 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linux-scsi, paulus

On Thu, Aug 16 2007, FUJITA Tomonori wrote:
> This is for the sglist branch in Jens' block git tree.
> 
> ---
> From 445923d1a8ff272293af3aadb6e58f82e6439e98 Mon Sep 17 00:00:00 2001
> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Date: Thu, 16 Aug 2007 02:25:32 +0900
> Subject: [PATCH] ppc sg chaining support fixes
> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> ---
>  arch/powerpc/kernel/iommu.c       |    5 +++--
>  include/asm-powerpc/dma-mapping.h |   15 +++++++++------
>  2 files changed, 12 insertions(+), 8 deletions(-)

Thanks Tomo!

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-16  6:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-15 23:15 [PATCH] ppc sg chaining support fixes FUJITA Tomonori
2007-08-16  6:51 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.