gpu: nvgpu: Add for_each construct for nvgpu_sgts

Add a macro to iterate across nvgpu_sgts. This makes it easier on
developers who may accidentally forget to move to the next SGL.

JIRA NVGPU-243

Change-Id: I90154a5d23f0014cb79bbcd5b6e8d8dbda303820
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1566627
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Alex Waterman
2017-09-19 15:28:00 -07:00
committed by mobile promotions
parent 0e8aee1c1a
commit 7a3dbdd43f
3 changed files with 14 additions and 10 deletions

View File

@@ -105,7 +105,8 @@ void nvgpu_pramin_access_batched(struct gk20a *g, struct nvgpu_mem *mem,
alloc = get_vidmem_page_alloc(mem->priv.sgt->sgl);
sgt = &alloc->sgt;
for (sgl = sgt->sgl; sgl; sgl = nvgpu_sgt_get_next(sgt, sgl)) {
nvgpu_sgt_for_each_sgl(sgl, sgt) {
if (offset >= nvgpu_sgt_get_length(sgt, sgl))
offset -= nvgpu_sgt_get_length(sgt, sgl);
else