Skip to content

Commit

Permalink
net: rds: use for_each_sg() for scatterlist parsing
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Fabian Frederick authored and David S. Miller committed Jun 21, 2015
1 parent 59f2111 commit d2a9ec6
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions net/rds/ib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit d2a9ec6

Please sign in to comment.