arm/sam34: Replace spinlock/sched_lock with spin_lock_irqsave_nopreempt

Replace the spinlock/sched_lock pair in arm/sam34 with
    spin_lock_irqsave_nopreempt() to improve code clarity and consistency.

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
This commit is contained in:
wangchengdong 2025-11-04 13:26:14 +08:00 committed by Xiang Xiao
parent 3b77128e65
commit 028f4cd952

View file

@ -657,8 +657,8 @@ int sam_rtc_setalarm(const struct timespec *tp, alarmcb_t callback)
/* Is there already something waiting on the ALARM? */
flags = spin_lock_irqsave(&g_rtc_lock);
sched_lock();
flags = spin_lock_irqsave_nopreempt(&g_rtc_lock);
if (g_alarmcb == NULL)
{
/* No.. Save the callback function pointer */
@ -736,8 +736,7 @@ int sam_rtc_setalarm(const struct timespec *tp, alarmcb_t callback)
ret = OK;
}
spin_unlock_irqrestore(&g_rtc_lock, flags);
sched_unlock();
spin_unlock_irqrestore_nopreempt(&g_rtc_lock, flags);
return ret;
}
#endif