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/gk20a/sync_gk20a.c | |
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/gk20a/sync_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/sync_gk20a.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/sync_gk20a.c index edfe3deb..f57871d5 100644 --- a/drivers/gpu/nvgpu/gk20a/sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/sync_gk20a.c | |||
@@ -20,8 +20,7 @@ | |||
20 | #include <linux/hrtimer.h> | 20 | #include <linux/hrtimer.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/spinlock.h> | 23 | #include <nvgpu/lock.h> |
24 | |||
25 | #include <uapi/linux/nvgpu.h> | 24 | #include <uapi/linux/nvgpu.h> |
26 | 25 | ||
27 | #include <nvgpu/semaphore.h> | 26 | #include <nvgpu/semaphore.h> |
@@ -55,7 +54,7 @@ struct gk20a_sync_pt { | |||
55 | * than a mutex - there should be very little contention on this | 54 | * than a mutex - there should be very little contention on this |
56 | * lock. | 55 | * lock. |
57 | */ | 56 | */ |
58 | spinlock_t lock; | 57 | struct nvgpu_spinlock lock; |
59 | }; | 58 | }; |
60 | 59 | ||
61 | struct gk20a_sync_pt_inst { | 60 | struct gk20a_sync_pt_inst { |
@@ -242,7 +241,7 @@ static struct gk20a_sync_pt *gk20a_sync_pt_create_shared( | |||
242 | } | 241 | } |
243 | } | 242 | } |
244 | 243 | ||
245 | spin_lock_init(&shared->lock); | 244 | nvgpu_spinlock_init(&shared->lock); |
246 | 245 | ||
247 | nvgpu_semaphore_get(sema); | 246 | nvgpu_semaphore_get(sema); |
248 | 247 | ||
@@ -304,7 +303,7 @@ static int gk20a_sync_pt_has_signaled(struct sync_pt *sync_pt) | |||
304 | #endif | 303 | #endif |
305 | bool signaled = true; | 304 | bool signaled = true; |
306 | 305 | ||
307 | spin_lock(&pt->lock); | 306 | nvgpu_spinlock_acquire(&pt->lock); |
308 | if (!pt->sema) | 307 | if (!pt->sema) |
309 | goto done; | 308 | goto done; |
310 | 309 | ||
@@ -345,7 +344,7 @@ static int gk20a_sync_pt_has_signaled(struct sync_pt *sync_pt) | |||
345 | pt->sema = NULL; | 344 | pt->sema = NULL; |
346 | } | 345 | } |
347 | done: | 346 | done: |
348 | spin_unlock(&pt->lock); | 347 | nvgpu_spinlock_release(&pt->lock); |
349 | 348 | ||
350 | return signaled; | 349 | return signaled; |
351 | } | 350 | } |