jasonbu commented on code in PR #16486:
URL: https://github.com/apache/nuttx/pull/16486#discussion_r2128789186


##########
include/nuttx/spinlock.h:
##########
@@ -532,6 +570,47 @@ irqstate_t spin_lock_irqsave_nopreempt(FAR volatile 
spinlock_t *lock)
   return flags;
 }
 
+/****************************************************************************
+ * Name: rspin_lock_irqsave_noprempt
+ *
+ * Description:
+ *   Nest supported spinlock, can support UINT8_MAX max depth.
+ *   As we should not disable irq for long time, sched also locked.
+ *   Similar feature with enter_critical_section, but isolate by instance.
+ *
+ *   If SPINLOCK is enabled:
+ *     Will take spinlock each cpu fisrt call.
+ *
+ *   If SPINLOCK is not enabled:
+ *     Equivalent to up_irq_save() + sched_lock().
+ *     Will only sched_lock once when frist called.
+ *
+ * Input Parameters:
+ *   lock - Caller specific rspinlock_s. not NULL.
+ *
+ * Returned Value:
+ *   An opaque, architecture-specific value that represents the state of
+ *   the interrupts prior to the call to spin_lock_irqsave(lock);
+ *
+ ****************************************************************************/
+
+static inline_function
+irqstate_t rspin_lock_irqsave_noprempt(FAR struct rspinlock_s *lock)
+{
+  int cpu = this_cpu();
+  irqstate_t flags = 0;

Review Comment:
   Yes, duplicate up_irq_restore is not required, add comment in 
rspin_unlock_irqrestore_nopreempt



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to