Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1166316 > unrolled thread

[PATCH V2 net-next] net: rds: use for_each_sg() for scatterlist parsing

Started byFabian Frederick <fabf@skynet.be>
First post2015-06-16 20:50 +0200
Last post2015-06-21 18:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH V2 net-next] net: rds: use for_each_sg() for scatterlist parsing Fabian Frederick <fabf@skynet.be> - 2015-06-16 20:50 +0200
    Re: [PATCH V2 net-next] net: rds: use for_each_sg() for  scatterlist parsing David Miller <davem@davemloft.net> - 2015-06-21 18:30 +0200

#1166316 — [PATCH V2 net-next] net: rds: use for_each_sg() for scatterlist parsing

FromFabian Frederick <fabf@skynet.be>
Date2015-06-16 20:50 +0200
Subject[PATCH V2 net-next] net: rds: use for_each_sg() for scatterlist parsing
Message-ID<pC45P-2oS-15@gated-at.bofh.it>
This patch also renames sg to sglist and aligns function parameters.
See Documentation/DMA-API.txt - Part Id for scatterlist details

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
This is untested.
V2: reorder variables (suggested by David S. Miller)

 net/rds/ib.h | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/net/rds/ib.h b/net/rds/ib.h
index c36d713..2de2898 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -235,28 +235,34 @@ extern struct workqueue_struct *rds_ib_wq;
  * doesn't define it.
  */
 static inline void rds_ib_dma_sync_sg_for_cpu(struct ib_device *dev,
-		struct scatterlist *sg, unsigned int sg_dma_len, int direction)
+					      struct scatterlist *sglist,
+					      unsigned int sg_dma_len,
+					      int direction)
 {
+	struct scatterlist *sg;
 	unsigned int i;
 
-	for (i = 0; i < sg_dma_len; ++i) {
+	for_each_sg(sglist, sg, sg_dma_len, i) {
 		ib_dma_sync_single_for_cpu(dev,
-				ib_sg_dma_address(dev, &sg[i]),
-				ib_sg_dma_len(dev, &sg[i]),
+				ib_sg_dma_address(dev, sg),
+				ib_sg_dma_len(dev, sg),
 				direction);
 	}
 }
 #define ib_dma_sync_sg_for_cpu	rds_ib_dma_sync_sg_for_cpu
 
 static inline void rds_ib_dma_sync_sg_for_device(struct ib_device *dev,
-		struct scatterlist *sg, unsigned int sg_dma_len, int direction)
+						 struct scatterlist *sglist,
+						 unsigned int sg_dma_len,
+						 int direction)
 {
+	struct scatterlist *sg;
 	unsigned int i;
 
-	for (i = 0; i < sg_dma_len; ++i) {
+	for_each_sg(sglist, sg, sg_dma_len, i) {
 		ib_dma_sync_single_for_device(dev,
-				ib_sg_dma_address(dev, &sg[i]),
-				ib_sg_dma_len(dev, &sg[i]),
+				ib_sg_dma_address(dev, sg),
+				ib_sg_dma_len(dev, sg),
 				direction);
 	}
 }
-- 
2.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1169608 — Re: [PATCH V2 net-next] net: rds: use for_each_sg() for scatterlist parsing

FromDavid Miller <davem@davemloft.net>
Date2015-06-21 18:30 +0200
SubjectRe: [PATCH V2 net-next] net: rds: use for_each_sg() for scatterlist parsing
Message-ID<pDQi5-1TC-3@gated-at.bofh.it>
In reply to#1166316
From: Fabian Frederick <fabf@skynet.be>
Date: Tue, 16 Jun 2015 20:44:07 +0200

> This patch also renames sg to sglist and aligns function parameters.
> See Documentation/DMA-API.txt - Part Id for scatterlist details
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
> This is untested.
> V2: reorder variables (suggested by David S. Miller)

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web