diff options
author | Michael J. Ruhl <michael.j.ruhl@intel.com> | 2022-10-28 18:50:29 +0300 |
---|---|---|
committer | Matthew Auld <matthew.auld@intel.com> | 2022-10-31 17:16:13 +0300 |
commit | 3096ae43cc815835cbaa846ae54e18cb92307730 (patch) | |
tree | ce710cdbe718b8a6db5d891349c8f2b291fd8cc1 | |
parent | 81aa3f8e26e0fd8bffcaaaaf7e7a79ccc0a46111 (diff) | |
download | linux-3096ae43cc815835cbaa846ae54e18cb92307730.tar.xz |
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 <tvrtko.ursulin@intel.com>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221028155029.494736-4-matthew.auld@intel.com
-rw-r--r-- | drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c index 5359745d1185..98b2d2950df6 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c @@ -47,12 +47,10 @@ static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attach, if (ret) goto err_free; - src = obj->mm.pages->sgl; dst = sgt->sgl; - for (i = 0; i < obj->mm.pages->orig_nents; i++) { + for_each_sg(obj->mm.pages->sgl, src, obj->mm.pages->orig_nents, i) { sg_set_page(dst, sg_page(src), src->length, 0); dst = sg_next(dst); - src = sg_next(src); } ret = dma_map_sgtable(attach->dev, sgt, dir, DMA_ATTR_SKIP_CPU_SYNC); |