gpu: nvgpu: add Doxygen documentation for rwsem

Add Doxygen documentation details for rwsem unit.

Jira NVGPU-2596

Change-Id: I9b385531d2524f6fc58d3e6ecccedf97258aed6d
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2199573
GVS: Gerrit_Virtual_Submit
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
ajesh
2019-09-17 15:17:30 +05:30
committed by Alex Waterman
parent 06fd513e1e
commit b6574f028a
2 changed files with 46 additions and 0 deletions

View File

@@ -26,6 +26,9 @@
#include <pthread.h> #include <pthread.h>
struct nvgpu_rwsem { struct nvgpu_rwsem {
/**
* pthread_rwlock_t used internally to implement nvgpu rwsem.
*/
pthread_rwlock_t rw_sem; pthread_rwlock_t rw_sem;
}; };

View File

@@ -37,10 +37,53 @@
*/ */
struct nvgpu_rwsem; 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); 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); 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); 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); 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); void nvgpu_rwsem_down_write(struct nvgpu_rwsem *rwsem);
#endif /* NVGPU_RWSEM_H */ #endif /* NVGPU_RWSEM_H */