From b6574f028a8b85f703e8a25bf76e57fc739012cd Mon Sep 17 00:00:00 2001 From: ajesh Date: Tue, 17 Sep 2019 15:17:30 +0530 Subject: [PATCH] gpu: nvgpu: add Doxygen documentation for rwsem Add Doxygen documentation details for rwsem unit. Jira NVGPU-2596 Change-Id: I9b385531d2524f6fc58d3e6ecccedf97258aed6d Signed-off-by: ajesh Reviewed-on: https://git-master.nvidia.com/r/2199573 GVS: Gerrit_Virtual_Submit Reviewed-by: Philip Elcan Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/posix/rwsem.h | 3 ++ drivers/gpu/nvgpu/include/nvgpu/rwsem.h | 43 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/rwsem.h b/drivers/gpu/nvgpu/include/nvgpu/posix/rwsem.h index 872e78a48..f7308c9da 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/rwsem.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/rwsem.h @@ -26,6 +26,9 @@ #include struct nvgpu_rwsem { + /** + * pthread_rwlock_t used internally to implement nvgpu rwsem. + */ pthread_rwlock_t rw_sem; }; diff --git a/drivers/gpu/nvgpu/include/nvgpu/rwsem.h b/drivers/gpu/nvgpu/include/nvgpu/rwsem.h index d16a4c0a7..3e9ad955d 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/rwsem.h +++ b/drivers/gpu/nvgpu/include/nvgpu/rwsem.h @@ -37,10 +37,53 @@ */ struct nvgpu_rwsem; +/** + * @brief Initialize read write lock. + * + * @param rwsem [in] Read,write lock to initalize. + * + * Initializes the read,write lock referenced by \a rwsem. + */ void nvgpu_rwsem_init(struct nvgpu_rwsem *rwsem); + +/** + * @brief Acquire read lock. + * + * @param rwsem [in] Read,write lock to be locked for read. + * + * Acquires a read lock on the read,write lock object referenced by \a rwsem. + * The calling thread acquires a read lock if no writer is holding the lock + * on \a rwsem. + */ void nvgpu_rwsem_up_read(struct nvgpu_rwsem *rwsem); + +/** + * @brief Release read lock. + * + * @param rwsem [in] Read,write lock to be released. + * + * Releases the lock held on \a rwsem. To be used to release a read lock. + */ void nvgpu_rwsem_down_read(struct nvgpu_rwsem *rwsem); + +/** + * @brief Acquire write lock. + * + * @param rwsem [in] Read,write lock to be locked for write. + * + * Acquires the write lock on \a rwsem. The calling thread acquires write lock + * if no other thread is holding a lock on rwsem. + */ void nvgpu_rwsem_up_write(struct nvgpu_rwsem *rwsem); + +/** + * @brief Release the write lock. + * + * @param rwsem [in] Read,write lock to be released. + * + * Releases the write lock held on \a rwsem. To be used to release a write + * lock. + */ void nvgpu_rwsem_down_write(struct nvgpu_rwsem *rwsem); #endif /* NVGPU_RWSEM_H */