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

@@ -104,6 +104,14 @@ struct nvgpu_mem_sgl {
u64 length;
};
/*
* Iterate over the SGL entries in an SGT.
*/
#define nvgpu_sgt_for_each_sgl(__sgl__, __sgt__) \
for ((__sgl__) = (__sgt__)->sgl; \
(__sgl__) != NULL; \
(__sgl__) = nvgpu_sgt_get_next(__sgt__, __sgl__))
struct nvgpu_mem {
/*
* Populated for all nvgpu_mem structs - vidmem or system.