@@ -7,6 +7,7 @@
#include <linux/dma-buf.h>
#include <linux/highmem.h>
#include <linux/dma-resv.h>
+#include <linux/scatterlist.h>
#include "i915_drv.h"
#include "i915_gem_object.h"
@@ -40,12 +41,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->nents; i++) {
+ for_each_sg(obj->mm.pages->sgl, src, obj->mm.pages->nents, i) {
sg_set_page(dst, sg_page(src), src->length, 0);
dst = sg_next(dst);
- src = sg_next(src);
}
if (!dma_map_sg_attrs(attach->dev,
Update open coded for loop to use the standard scatterlist for_each_sg API. Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com> --- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)