mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 01:50:07 +03:00
gpu: nvgpu: fix MISRA violations in lock unit
MISRA Rule-17.7 requires the return value of all functions to be used. Fix the violations of MISRA rule 17.7 in posix lock unit. MISRA rule 21.2 forbids the usage of identifier names which start with an underscore. Fix the violations of MISRA rule 21.2 in posix lock unit. Jira NVGPU-3139 Change-Id: Ia7867071760708d4283cfa8430a2b95b81532356 Signed-off-by: ajesh <akv@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2107237 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
@@ -38,20 +38,20 @@ struct __nvgpu_posix_lock {
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
static inline void __nvgpu_posix_lock_acquire(struct __nvgpu_posix_lock *lock)
|
||||
static inline void nvgpu_posix_lock_acquire(struct __nvgpu_posix_lock *lock)
|
||||
{
|
||||
pthread_mutex_lock(&lock->mutex);
|
||||
(void) pthread_mutex_lock(&lock->mutex);
|
||||
}
|
||||
|
||||
static inline int __nvgpu_posix_lock_try_acquire(
|
||||
static inline int nvgpu_posix_lock_try_acquire(
|
||||
struct __nvgpu_posix_lock *lock)
|
||||
{
|
||||
return pthread_mutex_trylock(&lock->mutex);
|
||||
}
|
||||
|
||||
static inline void __nvgpu_posix_lock_release(struct __nvgpu_posix_lock *lock)
|
||||
static inline void nvgpu_posix_lock_release(struct __nvgpu_posix_lock *lock)
|
||||
{
|
||||
pthread_mutex_unlock(&lock->mutex);
|
||||
(void) pthread_mutex_unlock(&lock->mutex);
|
||||
}
|
||||
|
||||
struct nvgpu_mutex {
|
||||
|
||||
@@ -29,50 +29,50 @@ int nvgpu_mutex_init(struct nvgpu_mutex *mutex)
|
||||
|
||||
void nvgpu_mutex_acquire(struct nvgpu_mutex *mutex)
|
||||
{
|
||||
__nvgpu_posix_lock_acquire(&mutex->lock);
|
||||
nvgpu_posix_lock_acquire(&mutex->lock);
|
||||
}
|
||||
|
||||
void nvgpu_mutex_release(struct nvgpu_mutex *mutex)
|
||||
{
|
||||
__nvgpu_posix_lock_release(&mutex->lock);
|
||||
nvgpu_posix_lock_release(&mutex->lock);
|
||||
}
|
||||
|
||||
int nvgpu_mutex_tryacquire(struct nvgpu_mutex *mutex)
|
||||
{
|
||||
return ((__nvgpu_posix_lock_try_acquire(&mutex->lock) == 0) ? 1 : 0);
|
||||
return ((nvgpu_posix_lock_try_acquire(&mutex->lock) == 0) ? 1 : 0);
|
||||
}
|
||||
|
||||
void nvgpu_mutex_destroy(struct nvgpu_mutex *mutex)
|
||||
{
|
||||
pthread_mutex_destroy(&mutex->lock.mutex);
|
||||
(void) pthread_mutex_destroy(&mutex->lock.mutex);
|
||||
}
|
||||
|
||||
void nvgpu_spinlock_init(struct nvgpu_spinlock *spinlock)
|
||||
{
|
||||
pthread_mutex_init(&spinlock->lock.mutex, NULL);
|
||||
(void) pthread_mutex_init(&spinlock->lock.mutex, NULL);
|
||||
}
|
||||
|
||||
void nvgpu_spinlock_acquire(struct nvgpu_spinlock *spinlock)
|
||||
{
|
||||
__nvgpu_posix_lock_acquire(&spinlock->lock);
|
||||
nvgpu_posix_lock_acquire(&spinlock->lock);
|
||||
}
|
||||
|
||||
void nvgpu_spinlock_release(struct nvgpu_spinlock *spinlock)
|
||||
{
|
||||
__nvgpu_posix_lock_release(&spinlock->lock);
|
||||
nvgpu_posix_lock_release(&spinlock->lock);
|
||||
}
|
||||
|
||||
void nvgpu_raw_spinlock_init(struct nvgpu_raw_spinlock *spinlock)
|
||||
{
|
||||
pthread_mutex_init(&spinlock->lock.mutex, NULL);
|
||||
(void) pthread_mutex_init(&spinlock->lock.mutex, NULL);
|
||||
}
|
||||
|
||||
void nvgpu_raw_spinlock_acquire(struct nvgpu_raw_spinlock *spinlock)
|
||||
{
|
||||
__nvgpu_posix_lock_acquire(&spinlock->lock);
|
||||
nvgpu_posix_lock_acquire(&spinlock->lock);
|
||||
}
|
||||
|
||||
void nvgpu_raw_spinlock_release(struct nvgpu_raw_spinlock *spinlock)
|
||||
{
|
||||
__nvgpu_posix_lock_release(&spinlock->lock);
|
||||
nvgpu_posix_lock_release(&spinlock->lock);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user