From 7685f60d9dd6ed062f3037d4e72ea124c103d211 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Thu, 28 Sep 2017 12:32:18 -0700 Subject: gpu: nvgpu: Abstract rw_semaphore implementation Abstract implementation of rw_semaphore. In Linux it's implemented in terms of rw_semaphore. Change deterministic_busy to use the new implementation. JIRA NVGPU-259 Change-Id: Ia9c1b6e397581bff7711c5ab6fb76ef6d23cff87 Signed-off-by: Terje Bergstrom Reviewed-on: https://git-master.nvidia.com/r/1570405 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/rwsem.c | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 drivers/gpu/nvgpu/common/linux/rwsem.c (limited to 'drivers/gpu/nvgpu/common/linux/rwsem.c') diff --git a/drivers/gpu/nvgpu/common/linux/rwsem.c b/drivers/gpu/nvgpu/common/linux/rwsem.c new file mode 100644 index 00000000..297ddf11 --- /dev/null +++ b/drivers/gpu/nvgpu/common/linux/rwsem.c @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include + +void nvgpu_rwsem_init(struct nvgpu_rwsem *rwsem) +{ + init_rwsem(&rwsem->rwsem); +} + +void nvgpu_rwsem_up_read(struct nvgpu_rwsem *rwsem) +{ + up_read(&rwsem->rwsem); +} + +void nvgpu_rwsem_down_read(struct nvgpu_rwsem *rwsem) +{ + down_read(&rwsem->rwsem); +} + +void nvgpu_rwsem_up_write(struct nvgpu_rwsem *rwsem) +{ + up_write(&rwsem->rwsem); +} + +void nvgpu_rwsem_down_write(struct nvgpu_rwsem *rwsem) +{ + down_write(&rwsem->rwsem); +} -- cgit v1.2.2