diff options
author | Konsta Holtta <kholtta@nvidia.com> | 2018-01-22 05:19:08 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-03-01 15:24:06 -0500 |
commit | ba8fa334f40223ad491ab61a6c072a276017787f (patch) | |
tree | eb06807ed4fdee3a708f66949c6daf82f193a531 /drivers/gpu/nvgpu/common/mm/vidmem.c | |
parent | 5a35a95654d561fce09a3b9abf6b82bb7a29d74b (diff) |
gpu: nvgpu: introduce explicit nvgpu_sgl type
The operations in struct nvgpu_sgt_ops have a scatter-gather list (sgl)
argument which is a void pointer. Change the type signatures to take
struct nvgpu_sgl * which is an opaque marker type that makes it more
difficult to pass around wrong arguments, as anything goes for void *.
Explicit types add also self-documentation to the code.
For some added safety, some explicit type casts are now required in
implementors of the nvgpu_sgt_ops interface when converting between the
general nvgpu_sgl type and implementation-specific types. This is not
purely a bad thing because the casts explain clearly where type
conversions are happening.
Jira NVGPU-30
Jira NVGPU-52
Jira NVGPU-305
Change-Id: Ic64eed6d2d39ca5786e62b172ddb7133af16817a
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1643555
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm/vidmem.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/vidmem.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/vidmem.c b/drivers/gpu/nvgpu/common/mm/vidmem.c index a55b3a2b..4239bd06 100644 --- a/drivers/gpu/nvgpu/common/mm/vidmem.c +++ b/drivers/gpu/nvgpu/common/mm/vidmem.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * Permission is hereby granted, free of charge, to any person obtaining a | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
5 | * copy of this software and associated documentation files (the "Software"), | 5 | * copy of this software and associated documentation files (the "Software"), |
@@ -413,7 +413,7 @@ int nvgpu_vidmem_clear(struct gk20a *g, struct nvgpu_mem *mem) | |||
413 | struct gk20a_fence *gk20a_fence_out = NULL; | 413 | struct gk20a_fence *gk20a_fence_out = NULL; |
414 | struct gk20a_fence *gk20a_last_fence = NULL; | 414 | struct gk20a_fence *gk20a_last_fence = NULL; |
415 | struct nvgpu_page_alloc *alloc = NULL; | 415 | struct nvgpu_page_alloc *alloc = NULL; |
416 | void *sgl = NULL; | 416 | struct nvgpu_sgl *sgl = NULL; |
417 | int err = 0; | 417 | int err = 0; |
418 | 418 | ||
419 | if (g->mm.vidmem.ce_ctx_id == (u32)~0) | 419 | if (g->mm.vidmem.ce_ctx_id == (u32)~0) |