From c11228d48be1825e1ec84afd38c6938504fa4100 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 8 Mar 2017 16:51:33 -0800 Subject: gpu: nvgpu: Use new kmem API functions (common/*) Use the new kmem API functions in common/* and common/mm/*. Add a struct gk20a pointer to struct nvgpu_allocator in order to store the gk20a pointer used for allocating memory. Bug 1799159 Bug 1823380 Change-Id: I881ea9545e8a8f0b75d77a1e35dd1812e0bb654e Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1318315 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/common/mm/lockless_allocator.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'drivers/gpu/nvgpu/common/mm/lockless_allocator.c') diff --git a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c index e3063a42..6fd9bc48 100644 --- a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c @@ -20,6 +20,7 @@ #include #include +#include #include "lockless_allocator_priv.h" @@ -106,7 +107,7 @@ static void nvgpu_lockless_alloc_destroy(struct nvgpu_allocator *a) nvgpu_fini_alloc_debug(a); vfree(pa->next); - kfree(pa); + nvgpu_kfree(nvgpu_alloc_to_gpu(a), pa); } static void nvgpu_lockless_print_stats(struct nvgpu_allocator *a, @@ -154,7 +155,7 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a, return -EINVAL; /* - * Ensure we have space for atleast one node & there's no overflow. + * Ensure we have space for at least one node & there's no overflow. * In order to control memory footprint, we require count < INT_MAX */ count = length; @@ -162,11 +163,11 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a, if (!base || !count || count > INT_MAX) return -EINVAL; - a = kzalloc(sizeof(struct nvgpu_lockless_allocator), GFP_KERNEL); + a = nvgpu_kzalloc(g, sizeof(struct nvgpu_lockless_allocator)); if (!a) return -ENOMEM; - err = __nvgpu_alloc_common_init(__a, name, a, false, &pool_ops); + err = __nvgpu_alloc_common_init(__a, g, name, a, false, &pool_ops); if (err) goto fail; @@ -202,6 +203,6 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a, return 0; fail: - kfree(a); + nvgpu_kfree(g, a); return err; } -- cgit v1.2.2