diff options
Diffstat (limited to 'include/nvgpu/linux/lock.h')
| -rw-r--r-- | include/nvgpu/linux/lock.h | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/include/nvgpu/linux/lock.h b/include/nvgpu/linux/lock.h deleted file mode 100644 index fbf26e9..0000000 --- a/include/nvgpu/linux/lock.h +++ /dev/null | |||
| @@ -1,81 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | ||
| 3 | * | ||
| 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, | ||
| 6 | * version 2, as published by the Free Software Foundation. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 11 | * more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef NVGPU_LOCK_LINUX_H | ||
| 18 | #define NVGPU_LOCK_LINUX_H | ||
| 19 | |||
| 20 | #include <linux/mutex.h> | ||
| 21 | #include <linux/spinlock.h> | ||
| 22 | |||
| 23 | struct nvgpu_mutex { | ||
| 24 | struct mutex mutex; | ||
| 25 | }; | ||
| 26 | struct nvgpu_spinlock { | ||
| 27 | spinlock_t spinlock; | ||
| 28 | }; | ||
| 29 | struct nvgpu_raw_spinlock { | ||
| 30 | raw_spinlock_t spinlock; | ||
| 31 | }; | ||
| 32 | |||
| 33 | static inline int nvgpu_mutex_init(struct nvgpu_mutex *mutex) | ||
| 34 | { | ||
| 35 | mutex_init(&mutex->mutex); | ||
| 36 | return 0; | ||
| 37 | }; | ||
| 38 | static inline void nvgpu_mutex_acquire(struct nvgpu_mutex *mutex) | ||
| 39 | { | ||
| 40 | mutex_lock(&mutex->mutex); | ||
| 41 | }; | ||
| 42 | static inline void nvgpu_mutex_release(struct nvgpu_mutex *mutex) | ||
| 43 | { | ||
| 44 | mutex_unlock(&mutex->mutex); | ||
| 45 | }; | ||
| 46 | static inline int nvgpu_mutex_tryacquire(struct nvgpu_mutex *mutex) | ||
| 47 | { | ||
| 48 | return mutex_trylock(&mutex->mutex); | ||
| 49 | }; | ||
| 50 | static inline void nvgpu_mutex_destroy(struct nvgpu_mutex *mutex) | ||
| 51 | { | ||
| 52 | mutex_destroy(&mutex->mutex); | ||
| 53 | }; | ||
| 54 | |||
| 55 | static inline void nvgpu_spinlock_init(struct nvgpu_spinlock *spinlock) | ||
| 56 | { | ||
| 57 | spin_lock_init(&spinlock->spinlock); | ||
| 58 | }; | ||
| 59 | static inline void nvgpu_spinlock_acquire(struct nvgpu_spinlock *spinlock) | ||
| 60 | { | ||
| 61 | spin_lock(&spinlock->spinlock); | ||
| 62 | }; | ||
| 63 | static inline void nvgpu_spinlock_release(struct nvgpu_spinlock *spinlock) | ||
| 64 | { | ||
| 65 | spin_unlock(&spinlock->spinlock); | ||
| 66 | }; | ||
| 67 | |||
| 68 | static inline void nvgpu_raw_spinlock_init(struct nvgpu_raw_spinlock *spinlock) | ||
| 69 | { | ||
| 70 | raw_spin_lock_init(&spinlock->spinlock); | ||
| 71 | }; | ||
| 72 | static inline void nvgpu_raw_spinlock_acquire(struct nvgpu_raw_spinlock *spinlock) | ||
| 73 | { | ||
| 74 | raw_spin_lock(&spinlock->spinlock); | ||
| 75 | }; | ||
| 76 | static inline void nvgpu_raw_spinlock_release(struct nvgpu_raw_spinlock *spinlock) | ||
| 77 | { | ||
| 78 | raw_spin_unlock(&spinlock->spinlock); | ||
| 79 | }; | ||
| 80 | |||
| 81 | #endif /* NVGPU_LOCK_LINUX_H */ | ||
