From 8ee3aa4b3175d8d27e57a0f5d5e2cdf3d78a4a58 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Tue, 24 Jan 2017 19:00:42 +0530 Subject: gpu: nvgpu: use common nvgpu mutex/spinlock APIs Instead of using Linux APIs for mutex and spinlocks directly, use new APIs defined in Replace Linux specific mutex/spinlock declaration, init, lock, unlock APIs with new APIs e.g struct mutex is replaced by struct nvgpu_mutex and mutex_lock() is replaced by nvgpu_mutex_acquire() And also include instead of including and Add explicit nvgpu/lock.h includes to below files to fix complilation failures. gk20a/platform_gk20a.h include/nvgpu/allocator.h Jira NVGPU-13 Change-Id: I81a05d21ecdbd90c2076a9f0aefd0e40b215bd33 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1293187 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/allocator.h | 9 +++++---- drivers/gpu/nvgpu/include/nvgpu/semaphore.h | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'drivers/gpu/nvgpu/include') diff --git a/drivers/gpu/nvgpu/include/nvgpu/allocator.h b/drivers/gpu/nvgpu/include/nvgpu/allocator.h index d5a90c87..16fe2641 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/allocator.h +++ b/drivers/gpu/nvgpu/include/nvgpu/allocator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2016, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -20,6 +20,7 @@ #include #include #include +#include /* #define ALLOCATOR_DEBUG */ @@ -78,7 +79,7 @@ struct nvgpu_allocator_ops { struct nvgpu_allocator { char name[32]; - struct mutex lock; + struct nvgpu_mutex lock; void *priv; const struct nvgpu_allocator_ops *ops; @@ -167,12 +168,12 @@ struct nvgpu_alloc_carveout { static inline void alloc_lock(struct nvgpu_allocator *a) { - mutex_lock(&a->lock); + nvgpu_mutex_acquire(&a->lock); } static inline void alloc_unlock(struct nvgpu_allocator *a) { - mutex_unlock(&a->lock); + nvgpu_mutex_release(&a->lock); } /* diff --git a/drivers/gpu/nvgpu/include/nvgpu/semaphore.h b/drivers/gpu/nvgpu/include/nvgpu/semaphore.h index cc4921d3..6f479383 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/semaphore.h +++ b/drivers/gpu/nvgpu/include/nvgpu/semaphore.h @@ -84,7 +84,7 @@ struct nvgpu_semaphore_pool { struct nvgpu_semaphore_sea *sema_sea; /* Sea that owns this pool. */ - struct mutex pool_lock; + struct nvgpu_mutex pool_lock; /* * This is the address spaces's personal RW table. Other channels will @@ -143,7 +143,7 @@ struct nvgpu_semaphore_sea { */ DECLARE_BITMAP(pools_alloced, SEMAPHORE_POOL_COUNT); - struct mutex sea_lock; /* Lock alloc/free calls. */ + struct nvgpu_mutex sea_lock; /* Lock alloc/free calls. */ }; /* -- cgit v1.2.2