netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 net-next] net: rds: use for_each_sg() for scatterlist parsing
@ 2015-06-16 18:44 Fabian Frederick
  2015-06-21 16:32 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2015-06-16 18:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: Fabian Frederick, Chien Yen, David S. Miller, rds-devel, netdev

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

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

* Re: [PATCH V2 net-next] net: rds: use for_each_sg() for scatterlist parsing
  2015-06-16 18:44 [PATCH V2 net-next] net: rds: use for_each_sg() for scatterlist parsing Fabian Frederick
@ 2015-06-21 16:32 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-06-21 16:32 UTC (permalink / raw)
  To: fabf; +Cc: linux-kernel, chien.yen, rds-devel, netdev

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.

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

end of thread, other threads:[~2015-06-21 16:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-16 18:44 [PATCH V2 net-next] net: rds: use for_each_sg() for scatterlist parsing Fabian Frederick
2015-06-21 16:32 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).