diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-09-19 18:28:00 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-10-04 05:29:53 -0400 |
commit | 7a3dbdd43f142f7f94a19ff6a320e589f0b23324 (patch) | |
tree | 8d2341fea4c6e146dae8fdaa69845b86e9c6a7e6 /drivers/gpu/nvgpu/include/nvgpu | |
parent | 0e8aee1c1a38abbc2dccf3f604a9843cf38071e0 (diff) |
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>
Diffstat (limited to 'drivers/gpu/nvgpu/include/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h index c2f0e37b..23a1bad7 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h +++ b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h | |||
@@ -104,6 +104,14 @@ struct nvgpu_mem_sgl { | |||
104 | u64 length; | 104 | u64 length; |
105 | }; | 105 | }; |
106 | 106 | ||
107 | /* | ||
108 | * Iterate over the SGL entries in an SGT. | ||
109 | */ | ||
110 | #define nvgpu_sgt_for_each_sgl(__sgl__, __sgt__) \ | ||
111 | for ((__sgl__) = (__sgt__)->sgl; \ | ||
112 | (__sgl__) != NULL; \ | ||
113 | (__sgl__) = nvgpu_sgt_get_next(__sgt__, __sgl__)) | ||
114 | |||
107 | struct nvgpu_mem { | 115 | struct nvgpu_mem { |
108 | /* | 116 | /* |
109 | * Populated for all nvgpu_mem structs - vidmem or system. | 117 | * Populated for all nvgpu_mem structs - vidmem or system. |