qcacmn: Add a new qdf API for spin_trylock

This change adds a qdf wrapper api qdf_spin_trylock for spin_trylock.

Change-Id: I3406ed96f7f40df24949bd4e21ceb144d919d58d
This commit is contained in:
Pavankumar Nandeshwar
2017-10-11 19:08:05 +05:30
committed by nshrivas
parent 13699a1bd8
commit 205aeca91d
2 changed files with 31 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -298,6 +298,24 @@ static inline int qdf_spin_trylock_bh(qdf_spinlock_t *lock, const char *func)
int qdf_spin_trylock_bh_outline(qdf_spinlock_t *lock);
/**
* qdf_spin_trylock() - spin trylock
* @lock: spinlock object
* Return: int
*/
static inline int qdf_spin_trylock(qdf_spinlock_t *lock, const char *func)
{
int result = 0;
BEFORE_LOCK(lock, qdf_spin_is_locked(lock));
result = __qdf_spin_trylock(&lock->lock);
AFTER_LOCK(lock, func);
return result;
}
#define qdf_spin_trylock(lock) qdf_spin_trylock(lock, __func__)
/**
* qdf_spin_lock_bh() - locks the spinlock mutex in soft irq context
* @lock: spinlock object pointer