diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2017-01-24 08:30:42 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-02-22 07:15:02 -0500 |
commit | 8ee3aa4b3175d8d27e57a0f5d5e2cdf3d78a4a58 (patch) | |
tree | 505dfd2ea2aca2f1cbdb254baee980862d21e04d /drivers/gpu/nvgpu/include | |
parent | 1f855af63fdd31fe3dcfee75f4f5f9b62f30d87e (diff) |
gpu: nvgpu: use common nvgpu mutex/spinlock APIs
Instead of using Linux APIs for mutex and spinlocks
directly, use new APIs defined in <nvgpu/lock.h>
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 <nvgpu/lock.h> instead of including
<linux/mutex.h> and <linux/spinlock.h>
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 <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1293187
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/allocator.h | 9 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/semaphore.h | 4 |
2 files changed, 7 insertions, 6 deletions
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 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2011-2016, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/debugfs.h> | 20 | #include <linux/debugfs.h> |
21 | #include <linux/seq_file.h> | 21 | #include <linux/seq_file.h> |
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <nvgpu/lock.h> | ||
23 | 24 | ||
24 | /* #define ALLOCATOR_DEBUG */ | 25 | /* #define ALLOCATOR_DEBUG */ |
25 | 26 | ||
@@ -78,7 +79,7 @@ struct nvgpu_allocator_ops { | |||
78 | 79 | ||
79 | struct nvgpu_allocator { | 80 | struct nvgpu_allocator { |
80 | char name[32]; | 81 | char name[32]; |
81 | struct mutex lock; | 82 | struct nvgpu_mutex lock; |
82 | 83 | ||
83 | void *priv; | 84 | void *priv; |
84 | const struct nvgpu_allocator_ops *ops; | 85 | const struct nvgpu_allocator_ops *ops; |
@@ -167,12 +168,12 @@ struct nvgpu_alloc_carveout { | |||
167 | 168 | ||
168 | static inline void alloc_lock(struct nvgpu_allocator *a) | 169 | static inline void alloc_lock(struct nvgpu_allocator *a) |
169 | { | 170 | { |
170 | mutex_lock(&a->lock); | 171 | nvgpu_mutex_acquire(&a->lock); |
171 | } | 172 | } |
172 | 173 | ||
173 | static inline void alloc_unlock(struct nvgpu_allocator *a) | 174 | static inline void alloc_unlock(struct nvgpu_allocator *a) |
174 | { | 175 | { |
175 | mutex_unlock(&a->lock); | 176 | nvgpu_mutex_release(&a->lock); |
176 | } | 177 | } |
177 | 178 | ||
178 | /* | 179 | /* |
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 { | |||
84 | 84 | ||
85 | struct nvgpu_semaphore_sea *sema_sea; /* Sea that owns this pool. */ | 85 | struct nvgpu_semaphore_sea *sema_sea; /* Sea that owns this pool. */ |
86 | 86 | ||
87 | struct mutex pool_lock; | 87 | struct nvgpu_mutex pool_lock; |
88 | 88 | ||
89 | /* | 89 | /* |
90 | * This is the address spaces's personal RW table. Other channels will | 90 | * This is the address spaces's personal RW table. Other channels will |
@@ -143,7 +143,7 @@ struct nvgpu_semaphore_sea { | |||
143 | */ | 143 | */ |
144 | DECLARE_BITMAP(pools_alloced, SEMAPHORE_POOL_COUNT); | 144 | DECLARE_BITMAP(pools_alloced, SEMAPHORE_POOL_COUNT); |
145 | 145 | ||
146 | struct mutex sea_lock; /* Lock alloc/free calls. */ | 146 | struct nvgpu_mutex sea_lock; /* Lock alloc/free calls. */ |
147 | }; | 147 | }; |
148 | 148 | ||
149 | /* | 149 | /* |