提交 d2a9ec64 编写于 作者: F Fabian Frederick 提交者: David S. Miller

net: rds: use for_each_sg() for scatterlist parsing

This patch also renames sg to sglist and aligns function parameters.
See Documentation/DMA-API.txt - Part Id for scatterlist details
Signed-off-by: NFabian Frederick <fabf@skynet.be>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 59f21118
...@@ -235,28 +235,34 @@ extern struct workqueue_struct *rds_ib_wq; ...@@ -235,28 +235,34 @@ extern struct workqueue_struct *rds_ib_wq;
* doesn't define it. * doesn't define it.
*/ */
static inline void rds_ib_dma_sync_sg_for_cpu(struct ib_device *dev, 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; 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_dma_sync_single_for_cpu(dev,
ib_sg_dma_address(dev, &sg[i]), ib_sg_dma_address(dev, sg),
ib_sg_dma_len(dev, &sg[i]), ib_sg_dma_len(dev, sg),
direction); direction);
} }
} }
#define ib_dma_sync_sg_for_cpu rds_ib_dma_sync_sg_for_cpu #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, 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; 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_dma_sync_single_for_device(dev,
ib_sg_dma_address(dev, &sg[i]), ib_sg_dma_address(dev, sg),
ib_sg_dma_len(dev, &sg[i]), ib_sg_dma_len(dev, sg),
direction); direction);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册