mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
irq: All irq_cpu_locked is called in the critical_section, and the parameter is the current cpu id.
so it must return false, We can safely delete. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -608,80 +608,6 @@ void leave_critical_section(irqstate_t flags)
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: irq_cpu_locked
|
||||
*
|
||||
* Description:
|
||||
* Test if the IRQ lock set OR if this CPU holds the IRQ lock
|
||||
* There is an interaction with pre-emption controls and IRQ locking:
|
||||
* Even if the pre-emption is enabled, tasks will be forced to pend if
|
||||
* the IRQ lock is also set UNLESS the CPU starting the task is the
|
||||
* holder of the IRQ lock.
|
||||
*
|
||||
* Input Parameters:
|
||||
* cpu - Points to which cpu
|
||||
*
|
||||
* Returned Value:
|
||||
* true - IRQs are locked by a different CPU.
|
||||
* false - IRQs are unlocked OR if they are locked BUT this CPU
|
||||
* is the holder of the lock.
|
||||
*
|
||||
* Warning: This values are volatile at only valid at the instance that
|
||||
* the CPU set was queried.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
bool irq_cpu_locked(int cpu)
|
||||
{
|
||||
cpu_set_t irqset;
|
||||
|
||||
/* g_cpu_irqset is not valid in early phases of initialization */
|
||||
|
||||
if (nxsched_get_initstate() < OSINIT_OSREADY)
|
||||
{
|
||||
/* We are still single threaded. In either state of g_cpu_irqlock,
|
||||
* the correct return value should always be false.
|
||||
*/
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Test if g_cpu_irqlock is locked. We don't really need to use check
|
||||
* g_cpu_irqlock to do this, we can use the g_cpu_set.
|
||||
*
|
||||
* Sample the g_cpu_irqset once. That is an atomic operation. All
|
||||
* subsequent operations will operate on the sampled cpu set.
|
||||
*/
|
||||
|
||||
irqset = (cpu_set_t)g_cpu_irqset;
|
||||
if (irqset != 0)
|
||||
{
|
||||
/* Some CPU holds the lock. So g_cpu_irqlock should be locked.
|
||||
* Return false if the 'cpu' is the holder of the lock; return
|
||||
* true if g_cpu_irqlock is locked, but this CPU is not the
|
||||
* holder of the lock.
|
||||
*/
|
||||
|
||||
return ((irqset & (1 << cpu)) == 0);
|
||||
}
|
||||
|
||||
/* No CPU holds the lock */
|
||||
|
||||
else
|
||||
{
|
||||
/* In this case g_cpu_irqlock should be unlocked. However, if
|
||||
* the lock was established in the interrupt handler AND there are
|
||||
* no bits set in g_cpu_irqset, that probably means only that
|
||||
* critical section was established from an interrupt handler.
|
||||
* Return false in either case.
|
||||
*/
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: restore_critical_section
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user