qcacmn: Introduce qdf_spin_is_locked

Add a wrapper to check if a spinlock is currently
locked without acquiring it.

Change-Id: I867cfd00a61b1632e9652cdffc896b2654e3c338
CRs-Fixed: 1100505
This commit is contained in:
Houston Hoffman
2016-12-22 13:26:37 -08:00
committed by Gerrit - the friendly Code Review server
parent 94f80a1b70
commit 7dcbb86c23
3 changed files with 30 additions and 7 deletions

View File

@@ -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)
{