spinlock: Rename spin_islocked to spin_is_locked

align with Linux naming style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-10-06 13:58:58 +08:00 committed by Alan Carvalho de Assis
parent aa0b3fcdf9
commit dfa0283d83
17 changed files with 60 additions and 60 deletions

View File

@ -81,7 +81,7 @@ static volatile spinlock_t g_cpu_resumed[CONFIG_SMP_NCPUS];
bool up_cpu_pausereq(int cpu)
{
return spin_islocked(&g_cpu_paused[cpu]);
return spin_is_locked(&g_cpu_paused[cpu]);
}
/****************************************************************************
@ -264,7 +264,7 @@ int up_cpu_pause(int cpu)
* request.
*/
DEBUGASSERT(!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(!spin_is_locked(&g_cpu_paused[cpu]));
spin_lock(&g_cpu_wait[cpu]);
spin_lock(&g_cpu_paused[cpu]);
@ -322,8 +322,8 @@ int up_cpu_resume(int cpu)
* established thread.
*/
DEBUGASSERT(spin_islocked(&g_cpu_wait[cpu]) &&
!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(spin_is_locked(&g_cpu_wait[cpu]) &&
!spin_is_locked(&g_cpu_paused[cpu]));
spin_unlock(&g_cpu_wait[cpu]);

View File

@ -81,7 +81,7 @@ static volatile spinlock_t g_cpu_resumed[CONFIG_SMP_NCPUS];
bool up_cpu_pausereq(int cpu)
{
return spin_islocked(&g_cpu_paused[cpu]);
return spin_is_locked(&g_cpu_paused[cpu]);
}
/****************************************************************************
@ -264,7 +264,7 @@ int up_cpu_pause(int cpu)
* request.
*/
DEBUGASSERT(!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(!spin_is_locked(&g_cpu_paused[cpu]));
spin_lock(&g_cpu_wait[cpu]);
spin_lock(&g_cpu_paused[cpu]);
@ -322,8 +322,8 @@ int up_cpu_resume(int cpu)
* established thread.
*/
DEBUGASSERT(spin_islocked(&g_cpu_wait[cpu]) &&
!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(spin_is_locked(&g_cpu_wait[cpu]) &&
!spin_is_locked(&g_cpu_paused[cpu]));
spin_unlock(&g_cpu_wait[cpu]);

View File

@ -163,7 +163,7 @@ static bool handle_irqreq(int cpu)
bool up_cpu_pausereq(int cpu)
{
return spin_islocked(&g_cpu_paused[cpu]);
return spin_is_locked(&g_cpu_paused[cpu]);
}
/****************************************************************************
@ -361,7 +361,7 @@ int up_cpu_pause(int cpu)
* request.
*/
DEBUGASSERT(!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(!spin_is_locked(&g_cpu_paused[cpu]));
spin_lock(&g_cpu_wait[cpu]);
spin_lock(&g_cpu_paused[cpu]);
@ -421,8 +421,8 @@ int up_cpu_resume(int cpu)
* established thread.
*/
DEBUGASSERT(spin_islocked(&g_cpu_wait[cpu]) &&
!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(spin_is_locked(&g_cpu_wait[cpu]) &&
!spin_is_locked(&g_cpu_paused[cpu]));
spin_unlock(&g_cpu_wait[cpu]);

View File

@ -91,7 +91,7 @@ volatile spinlock_t g_cpu_resumed[CONFIG_SMP_NCPUS];
bool up_cpu_pausereq(int cpu)
{
return spin_islocked(&g_cpu_paused[cpu]);
return spin_is_locked(&g_cpu_paused[cpu]);
}
/****************************************************************************
@ -278,7 +278,7 @@ int up_cpu_pause(int cpu)
* request.
*/
DEBUGASSERT(!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(!spin_is_locked(&g_cpu_paused[cpu]));
spin_lock(&g_cpu_wait[cpu]);
spin_lock(&g_cpu_paused[cpu]);
@ -346,8 +346,8 @@ int up_cpu_resume(int cpu)
* established thread.
*/
DEBUGASSERT(spin_islocked(&g_cpu_wait[cpu]) &&
!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(spin_is_locked(&g_cpu_wait[cpu]) &&
!spin_is_locked(&g_cpu_paused[cpu]));
spin_unlock(&g_cpu_wait[cpu]);

View File

@ -131,7 +131,7 @@ static void rp2040_handle_irqreq(int irqreq)
bool up_cpu_pausereq(int cpu)
{
return spin_islocked(&g_cpu_paused[cpu]);
return spin_is_locked(&g_cpu_paused[cpu]);
}
/****************************************************************************
@ -332,7 +332,7 @@ int up_cpu_pause(int cpu)
* request.
*/
DEBUGASSERT(!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(!spin_is_locked(&g_cpu_paused[cpu]));
spin_lock(&g_cpu_wait[cpu]);
spin_lock(&g_cpu_paused[cpu]);
@ -396,8 +396,8 @@ int up_cpu_resume(int cpu)
* established thread.
*/
DEBUGASSERT(spin_islocked(&g_cpu_wait[cpu]) &&
!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(spin_is_locked(&g_cpu_wait[cpu]) &&
!spin_is_locked(&g_cpu_paused[cpu]));
spin_unlock(&g_cpu_wait[cpu]);

View File

@ -93,7 +93,7 @@ static volatile spinlock_t g_cpu_resumed[CONFIG_SMP_NCPUS];
bool up_cpu_pausereq(int cpu)
{
return spin_islocked(&g_cpu_paused[cpu]);
return spin_is_locked(&g_cpu_paused[cpu]);
}
/****************************************************************************
@ -218,7 +218,7 @@ int arm_pause_handler(int irq, void *c, void *arg)
* interrupt by calling up_cpu_paused.
*/
if (spin_islocked(&g_cpu_paused[cpu]))
if (spin_is_locked(&g_cpu_paused[cpu]))
{
return up_cpu_paused(cpu);
}
@ -267,7 +267,7 @@ int up_cpu_pause(int cpu)
* request.
*/
DEBUGASSERT(!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(!spin_is_locked(&g_cpu_paused[cpu]));
spin_lock(&g_cpu_wait[cpu]);
spin_lock(&g_cpu_paused[cpu]);
@ -336,8 +336,8 @@ int up_cpu_resume(int cpu)
* established thread.
*/
DEBUGASSERT(spin_islocked(&g_cpu_wait[cpu]) &&
!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(spin_is_locked(&g_cpu_wait[cpu]) &&
!spin_is_locked(&g_cpu_paused[cpu]));
spin_unlock(&g_cpu_wait[cpu]);

View File

@ -80,7 +80,7 @@ static volatile spinlock_t g_cpu_resumed[CONFIG_SMP_NCPUS];
bool up_cpu_pausereq(int cpu)
{
return spin_islocked(&g_cpu_paused[cpu]);
return spin_is_locked(&g_cpu_paused[cpu]);
}
/****************************************************************************
@ -265,7 +265,7 @@ int up_cpu_pause(int cpu)
* request.
*/
DEBUGASSERT(!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(!spin_is_locked(&g_cpu_paused[cpu]));
spin_lock(&g_cpu_wait[cpu]);
spin_lock(&g_cpu_paused[cpu]);
@ -332,8 +332,8 @@ int up_cpu_resume(int cpu)
* established thread.
*/
DEBUGASSERT(spin_islocked(&g_cpu_wait[cpu]) &&
!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(spin_is_locked(&g_cpu_wait[cpu]) &&
!spin_is_locked(&g_cpu_paused[cpu]));
spin_unlock(&g_cpu_wait[cpu]);

View File

@ -81,7 +81,7 @@ volatile spinlock_t g_cpu_resumed[CONFIG_SMP_NCPUS];
bool up_cpu_pausereq(int cpu)
{
return spin_islocked(&g_cpu_paused[cpu]);
return spin_is_locked(&g_cpu_paused[cpu]);
}
/****************************************************************************
@ -258,7 +258,7 @@ int up_cpu_pause(int cpu)
* request.
*/
DEBUGASSERT(!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(!spin_is_locked(&g_cpu_paused[cpu]));
spin_lock(&g_cpu_wait[cpu]);
spin_lock(&g_cpu_paused[cpu]);
@ -319,8 +319,8 @@ int up_cpu_resume(int cpu)
* established thread.
*/
DEBUGASSERT(spin_islocked(&g_cpu_wait[cpu]) &&
!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(spin_is_locked(&g_cpu_wait[cpu]) &&
!spin_is_locked(&g_cpu_paused[cpu]));
spin_unlock(&g_cpu_wait[cpu]);

View File

@ -124,7 +124,7 @@ static int sim_cpupause_handler(int irq, void *context, void *arg)
bool up_cpu_pausereq(int cpu)
{
return spin_islocked(&g_cpu_paused[cpu]);
return spin_is_locked(&g_cpu_paused[cpu]);
}
/****************************************************************************
@ -338,8 +338,8 @@ int up_cpu_pause(int cpu)
* the CPU is actually paused.
*/
DEBUGASSERT(!spin_islocked(&g_cpu_wait[cpu]) &&
!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(!spin_is_locked(&g_cpu_wait[cpu]) &&
!spin_is_locked(&g_cpu_paused[cpu]));
spin_lock(&g_cpu_wait[cpu]);
spin_lock(&g_cpu_paused[cpu]);
@ -397,8 +397,8 @@ int up_cpu_resume(int cpu)
* established thread.
*/
DEBUGASSERT(spin_islocked(&g_cpu_wait[cpu]) &&
!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(spin_is_locked(&g_cpu_wait[cpu]) &&
!spin_is_locked(&g_cpu_paused[cpu]));
spin_unlock(&g_cpu_wait[cpu]);

View File

@ -81,7 +81,7 @@ volatile spinlock_t g_cpu_resumed[CONFIG_SMP_NCPUS];
bool up_cpu_pausereq(int cpu)
{
return spin_islocked(&g_cpu_paused[cpu]);
return spin_is_locked(&g_cpu_paused[cpu]);
}
/****************************************************************************
@ -260,7 +260,7 @@ int up_cpu_pause(int cpu)
* request.
*/
DEBUGASSERT(!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(!spin_is_locked(&g_cpu_paused[cpu]));
spin_lock(&g_cpu_wait[cpu]);
spin_lock(&g_cpu_paused[cpu]);
@ -322,8 +322,8 @@ int up_cpu_resume(int cpu)
* established thread.
*/
DEBUGASSERT(spin_islocked(&g_cpu_wait[cpu]) &&
!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(spin_is_locked(&g_cpu_wait[cpu]) &&
!spin_is_locked(&g_cpu_paused[cpu]));
spin_unlock(&g_cpu_wait[cpu]);

View File

@ -66,7 +66,7 @@ static spinlock_t g_cpu_resumed[CONFIG_SMP_NCPUS];
bool up_cpu_pausereq(int cpu)
{
return spin_islocked(&g_cpu_paused[cpu]);
return spin_is_locked(&g_cpu_paused[cpu]);
}
/****************************************************************************
@ -244,7 +244,7 @@ int up_cpu_pause(int cpu)
* request.
*/
DEBUGASSERT(!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(!spin_is_locked(&g_cpu_paused[cpu]));
spin_lock(&g_cpu_wait[cpu]);
spin_lock(&g_cpu_paused[cpu]);
@ -311,8 +311,8 @@ int up_cpu_resume(int cpu)
* established thread.
*/
DEBUGASSERT(spin_islocked(&g_cpu_wait[cpu]) &&
!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(spin_is_locked(&g_cpu_wait[cpu]) &&
!spin_is_locked(&g_cpu_paused[cpu]));
spin_unlock(&g_cpu_wait[cpu]);

View File

@ -292,7 +292,7 @@ void spin_unlock(FAR volatile spinlock_t *lock);
void spin_unlock_wo_note(FAR volatile spinlock_t *lock);
/****************************************************************************
* Name: spin_islocked
* Name: spin_is_locked
*
* Description:
* Release one count on a non-reentrant spinlock.
@ -307,9 +307,9 @@ void spin_unlock_wo_note(FAR volatile spinlock_t *lock);
/* bool spin_islocked(FAR spinlock_t lock); */
#ifdef CONFIG_TICKET_SPINLOCK
# define spin_islocked(l) ((*l).tickets.owner != (*l).tickets.next)
# define spin_is_locked(l) ((*l).tickets.owner != (*l).tickets.next)
#else
# define spin_islocked(l) (*(l) == SP_LOCKED)
# define spin_is_locked(l) (*(l) == SP_LOCKED)
#endif
/****************************************************************************

View File

@ -304,14 +304,14 @@ int pthread_spin_unlock(pthread_spinlock_t *lock)
pthread_t me = pthread_self();
DEBUGASSERT(lock != NULL &&
spin_islocked(&lock->sp_lock) &&
spin_is_locked(&lock->sp_lock) &&
lock->sp_holder == me);
if (lock == NULL)
{
return EINVAL;
}
else if (!spin_islocked(&lock->sp_lock) || lock->sp_holder != me)
else if (!spin_is_locked(&lock->sp_lock) || lock->sp_holder != me)
{
return EPERM;
}

View File

@ -241,7 +241,7 @@ try_again:
cpu = this_cpu();
if (g_cpu_nestcount[cpu] > 0)
{
DEBUGASSERT(spin_islocked(&g_cpu_irqlock) &&
DEBUGASSERT(spin_is_locked(&g_cpu_irqlock) &&
g_cpu_nestcount[cpu] < UINT8_MAX);
g_cpu_nestcount[cpu]++;
}
@ -330,7 +330,7 @@ try_again_in_irq:
* and (2) this CPU should hold the lock.
*/
DEBUGASSERT(spin_islocked(&g_cpu_irqlock) &&
DEBUGASSERT(spin_is_locked(&g_cpu_irqlock) &&
(g_cpu_irqset & (1 << this_cpu())) != 0 &&
rtcb->irqcount < INT16_MAX);
rtcb->irqcount++;
@ -471,7 +471,7 @@ void leave_critical_section(irqstate_t flags)
{
/* Yes.. then just decrement the nesting count */
DEBUGASSERT(spin_islocked(&g_cpu_irqlock));
DEBUGASSERT(spin_is_locked(&g_cpu_irqlock));
g_cpu_nestcount[cpu]--;
}
else
@ -480,7 +480,7 @@ void leave_critical_section(irqstate_t flags)
* and release the spinlock (if necessary).
*/
DEBUGASSERT(spin_islocked(&g_cpu_irqlock) &&
DEBUGASSERT(spin_is_locked(&g_cpu_irqlock) &&
g_cpu_nestcount[cpu] == 1);
FAR struct tcb_s *rtcb = current_task(cpu);
@ -518,7 +518,7 @@ void leave_critical_section(irqstate_t flags)
{
/* Yes... the spinlock should remain set */
DEBUGASSERT(spin_islocked(&g_cpu_irqlock));
DEBUGASSERT(spin_is_locked(&g_cpu_irqlock));
rtcb->irqcount--;
}
else
@ -535,7 +535,7 @@ void leave_critical_section(irqstate_t flags)
* released, then unlock the spinlock.
*/
DEBUGASSERT(spin_islocked(&g_cpu_irqlock) &&
DEBUGASSERT(spin_is_locked(&g_cpu_irqlock) &&
(g_cpu_irqset & (1 << cpu)) != 0);
/* Check if releasing the lock held by this CPU will unlock the

View File

@ -386,7 +386,7 @@ FAR struct tcb_s *this_task(void);
int nxsched_select_cpu(cpu_set_t affinity);
int nxsched_pause_cpu(FAR struct tcb_s *tcb);
# define nxsched_islocked_global() spin_islocked(&g_cpu_schedlock)
# define nxsched_islocked_global() spin_is_locked(&g_cpu_schedlock)
# define nxsched_islocked_tcb(tcb) nxsched_islocked_global()
#else

View File

@ -181,7 +181,7 @@ int sched_lock(void)
* and g_cpu_lockset should include the bit setting for this CPU.
*/
DEBUGASSERT(spin_islocked(&g_cpu_schedlock) &&
DEBUGASSERT(spin_is_locked(&g_cpu_schedlock) &&
(g_cpu_lockset & (1 << this_cpu())) != 0);
}

View File

@ -105,7 +105,7 @@ int sched_unlock(void)
* release our hold on the lock.
*/
DEBUGASSERT(spin_islocked(&g_cpu_schedlock) &&
DEBUGASSERT(spin_is_locked(&g_cpu_schedlock) &&
(g_cpu_lockset & (1 << cpu)) != 0);
spin_clrbit(&g_cpu_lockset, cpu, &g_cpu_locksetlock,