diff --git a/qdf/inc/qdf_lock.h b/qdf/inc/qdf_lock.h index 9a3865d42d..1638ea8180 100644 --- a/qdf/inc/qdf_lock.h +++ b/qdf/inc/qdf_lock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -75,7 +75,7 @@ QDF_STATUS qdf_mutex_destroy(qdf_mutex_t *lock); /** * qdf_spinlock_create - Initialize a spinlock * @lock: spinlock object pointer - * Retrun: none + * Return: none */ static inline void qdf_spinlock_create(qdf_spinlock_t *lock) { @@ -92,10 +92,22 @@ static inline void qdf_spinlock_destroy(qdf_spinlock_t *lock) __qdf_spinlock_destroy(lock); } +/** + * qdf_spin_is_locked() - check if the spinlock is locked + * @lock: spinlock object + * + * Return: nonzero if lock is held. + */ +static inline int qdf_spin_is_locked(qdf_spinlock_t *lock) +{ + return __qdf_spin_is_locked(&lock->lock); +} + /** * qdf_spin_trylock_bh() - spin trylock bottomhalf * @lock: spinlock object - * Return: int + * + * Return: nonzero if lock is acquired */ static inline int qdf_spin_trylock_bh(qdf_spinlock_t *lock) { diff --git a/qdf/linux/src/i_qdf_lock.h b/qdf/linux/src/i_qdf_lock.h index 4e8c91ade0..7e795d21d2 100644 --- a/qdf/linux/src/i_qdf_lock.h +++ b/qdf/linux/src/i_qdf_lock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -237,11 +237,22 @@ static inline void __qdf_spin_unlock_irqrestore(__qdf_spinlock_t *lock) #define __qdf_spin_unlock_irq(_p_lock, _flags) \ spin_unlock_irqrestore(_p_lock, _flags) +/** + * __qdf_spin_is_locked(__qdf_spinlock_t *lock) + * @lock: spinlock object + * + * Return: nonzero if lock is held. + */ +static inline int __qdf_spin_is_locked(__qdf_spinlock_t *lock) +{ + return spin_is_locked(&lock->spinlock); +} + /** * __qdf_spin_trylock_bh() - spin trylock bottomhalf * @lock: spinlock object * - * Retrun: int + * Return: nonzero if lock is acquired */ static inline int __qdf_spin_trylock_bh(__qdf_spinlock_t *lock) { diff --git a/qdf/linux/src/qdf_lock.c b/qdf/linux/src/qdf_lock.c index 16a846cd3e..944ab300f3 100644 --- a/qdf/linux/src/qdf_lock.c +++ b/qdf/linux/src/qdf_lock.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -636,7 +636,7 @@ EXPORT_SYMBOL(qdf_mutex_destroy); /** * qdf_spin_trylock_bh_outline() - spin trylock bottomhalf * @lock: spinlock object - * Retrun: int + * Return: nonzero if lock is acquired */ int qdf_spin_trylock_bh_outline(qdf_spinlock_t *lock) {