gpu: nvgpu: use posix lock implementation for qnx

- Unify posix lock unit with qnx. Also, fix nvgpu_mutex_trylock return
  value. The Linux version expects 1 for success and 0 for failure
  whereas posix implementation return 0 for success and negative value
  for failure.

Jira NVGPU-1693

Change-Id: I783fb6a82149c096bad17a03e81788bc6b6e1e8c
Signed-off-by: Shashank Singh <shashsingh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2003733
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Shashank Singh
2019-01-25 14:49:19 +05:30
committed by mobile promotions
parent 87b5cd6528
commit 1547008dac
3 changed files with 6 additions and 9 deletions

View File

@@ -44,7 +44,6 @@ srcs += os/posix/nvgpu.c \
os/posix/posix-channel.c \
os/posix/posix-tsg.c \
os/posix/posix-nvlink.c \
os/posix/lock.c \
os/posix/stubs.c \
os/posix/posix-fault-injection.c \
os/posix/posix-sim.c \
@@ -56,7 +55,8 @@ endif
# POSIX sources shared between the POSIX and QNX builds.
srcs += os/posix/bug.c \
os/posix/bsearch.c
os/posix/bsearch.c \
os/posix/lock.c
srcs += common/sim.c \
common/sim_pci.c \

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -25,10 +25,8 @@
#ifdef __KERNEL__
#include <nvgpu/linux/lock.h>
#elif defined(__NVGPU_POSIX__)
#include <nvgpu/posix/lock.h>
#else
#include <nvgpu_rmos/include/lock.h>
#include <nvgpu/posix/lock.h>
#endif
/*

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -21,7 +21,6 @@
*/
#include <nvgpu/lock.h>
#include <nvgpu/posix/lock.h>
int nvgpu_mutex_init(struct nvgpu_mutex *mutex)
{
@@ -40,7 +39,7 @@ void nvgpu_mutex_release(struct nvgpu_mutex *mutex)
int nvgpu_mutex_tryacquire(struct nvgpu_mutex *mutex)
{
return __nvgpu_posix_lock_try_acquire(&mutex->lock);
return ((__nvgpu_posix_lock_try_acquire(&mutex->lock) == 0) ? 1 : 0);
}
void nvgpu_mutex_destroy(struct nvgpu_mutex *mutex)