gpu: nvgpu: use nvgpu specific lock APIs in kmem

Use lock/mutex APIs from nvgpu/lock.h instead of
using Linux specific APIs in kmem.c
This patch is needed in order to remove Linux
dependency from nvgpu driver

Jira NVGPU-62

Change-Id: Ic3484857bc2fa1917724681f68c1626c1235baea
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1492107
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
This commit is contained in:
Deepak Nibade
2017-05-30 17:30:44 +05:30
committed by mobile promotions
parent a7e6339637
commit be7f22db8b
2 changed files with 7 additions and 7 deletions

View File

@@ -15,14 +15,13 @@
*/
#include <linux/mm.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/debugfs.h>
#include <linux/spinlock.h>
#include <linux/seq_file.h>
#include <linux/vmalloc.h>
#include <linux/stacktrace.h>
#include <nvgpu/lock.h>
#include <nvgpu/kmem.h>
#include <nvgpu/atomic.h>
#include <nvgpu/bug.h>
@@ -137,12 +136,12 @@ void __nvgpu_vfree(struct gk20a *g, void *addr)
static void lock_tracker(struct nvgpu_mem_alloc_tracker *tracker)
{
mutex_lock(&tracker->lock);
nvgpu_mutex_acquire(&tracker->lock);
}
static void unlock_tracker(struct nvgpu_mem_alloc_tracker *tracker)
{
mutex_unlock(&tracker->lock);
nvgpu_mutex_release(&tracker->lock);
}
static void kmem_print_mem_alloc(struct gk20a *g,
@@ -843,8 +842,8 @@ int nvgpu_kmem_init(struct gk20a *g)
g->vmallocs->allocs = NULL;
g->kmallocs->allocs = NULL;
mutex_init(&g->vmallocs->lock);
mutex_init(&g->kmallocs->lock);
nvgpu_mutex_init(&g->vmallocs->lock);
nvgpu_mutex_init(&g->kmallocs->lock);
g->vmallocs->min_alloc = PAGE_SIZE;
g->kmallocs->min_alloc = KMALLOC_MIN_SIZE;