Skip to content

Commit 3096ae4

Browse files
mjruhlmatt-auld
authored andcommitted
drm/i915/dmabuf: Use scatterlist for_each_sg API
Update open coded for loop to use the standard scatterlist for_each_sg API. Cc: Tvrtko Ursulin <[email protected]> Signed-off-by: Michael J. Ruhl <[email protected]> Reviewed-by: Matthew Auld <[email protected]> Signed-off-by: Matthew Auld <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 81aa3f8 commit 3096ae4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@ static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attach,
4747
if (ret)
4848
goto err_free;
4949

50-
src = obj->mm.pages->sgl;
5150
dst = sgt->sgl;
52-
for (i = 0; i < obj->mm.pages->orig_nents; i++) {
51+
for_each_sg(obj->mm.pages->sgl, src, obj->mm.pages->orig_nents, i) {
5352
sg_set_page(dst, sg_page(src), src->length, 0);
5453
dst = sg_next(dst);
55-
src = sg_next(src);
5654
}
5755

5856
ret = dma_map_sgtable(attach->dev, sgt, dir, DMA_ATTR_SKIP_CPU_SYNC);

0 commit comments

Comments
 (0)