#ifndef LOCKING_H #define LOCKING_H #include #include "built_in.h" struct spinlock { pthread_spinlock_t lock; }; struct mutexlock { pthread_mutex_t lock; }; struct rwlock { pthread_rwlock_t lock; }; static inline int spinlock_init(struct spinlock *l) { return -pthread_spin_init(&l->lock, 0); } static inline void spinlock_destroy(struct spinlock *l) { pthread_spin_destroy(&l->lock); } static inline void spinlock_lock(struct spinlock *l) { pthread_spin_lock(&l->lock); } static inline void spinlock_unlock(struct spinlock *l) { pthread_spin_unlock(&l->lock); } static inline int mutexlock_init(struct mutexlock *l) { return -pthread_mutex_init(&l->lock, 0); } static inline void mutexlock_destroy(struct mutexlock *l) { pthread_mutex_destroy(&l->lock); } static inline void mutexlock_lock(struct mutexlock *l) { pthread_mutex_lock(&l->lock); } static inline void mutexlock_unlock(struct mutexlock *l) { pthread_mutex_unlock(&l->lock); } static inline int rwlock_init(struct rwlock *l) { return -pthread_rwlock_init(&l->lock, 0); } static inline int rwlock_init2(struct rwlock *l, pthread_rwlockattr_t *attr) { return -pthread_rwlock_init(&l->lock, attr); } static inline void rwlock_destroy(struct rwlock *l) { pthread_rwlock_destroy(&l->lock); } static inline void rwlock_rd_lock(struct rwlock *l) { pthread_rwlock_rdlock(&l->lock); } static inline void rwlock_wr_lock(struct rwlock *l) { pthread_rwlock_wrlock(&l->lock); } static inline void rwlock_unlock(struct rwlock *l) { pthread_rwlock_unlock(&l->lock); } #endif /* LOCKING_H */ > summaryrefslogtreecommitdiff
path: root/Documentation/i2c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2016-11-22 22:49:48 +0100
committerMark Brown <broonie@kernel.org>2016-11-23 12:41:58 +0000
commit0a69516cd8b9878c4040c35294443ac18338febd (patch)
treebfa64739b7a3da8d16475cdfaa2fdd5f8c50d6b7 /Documentation/i2c
parent1001354ca34179f3db924eb66672442a173147dc (diff)
ASoC: ab8500: Remove explicit initialization of driver callbacks to NULL
Fields of structs with global storage are implicitly initialized to 0/NULL, there is usually no need to do this explicitly. Removing the initialization of the legacy suspend/resume callback fields also gets the driver ready for the day when they are eventually removed. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'Documentation/i2c')