#ifndef LOCKING_H #define LOCKING_H #include struct spinlock { pthread_spinlock_t lock; }; struct mutexlock { pthread_mutex_t lock; }; #define MUTEXLOCK_INITIALIZER { .lock = PTHREAD_MUTEX_INITIALIZER } 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 */ 8772072'>refslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-11-08 02:01:38 -0800
committerLinus Walleij <linus.walleij@linaro.org>2013-11-25 09:08:18 +0100
commit38d321c899457be111f1a1bcd8c8d1ca18772072 (patch)
tree41c47ed30c41fd7e65984df0179b12a0b58c6f19 /kernel
parent6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff)
pinctrl: rockchip: testing the wrong variable
There is a copy and paste bug so we test "info->reg_base" instead of "info->reg_pull". Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'kernel')