This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 0d5f4ca4ba035b913b3a0bb7b2facc41c9c5625b
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Mon Nov 16 11:47:40 2026 +0800

    seqlock: align seqlock.h with the downstream seqlock terminal form
    
    This is a series-original fix: it completes the seqlock ripple outside
    the original patches' file set; the individual deltas have no single
    original patch (they are master-side form divergences plus already
    covered rewrites of the seqlock line).
    
    The seqcount_t sequence member is now atomic_t on SMP (picked from
    f369edc9d70), so drop the (FAR atomic_t *) casts, use ~1 for the
    parity mask, and adopt the downstream header organization (EXTERN
    block, single <nuttx/arch.h> include, param form) so seqlock.h matches
    the downstream end state exactly.
    
    Assisted-By: mimo-v2.6-pro
    Signed-off-by: ouyangxiangzhen <[email protected]>
---
 include/nuttx/seqlock.h | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/include/nuttx/seqlock.h b/include/nuttx/seqlock.h
index 633bc4671f3..93e823d1caf 100644
--- a/include/nuttx/seqlock.h
+++ b/include/nuttx/seqlock.h
@@ -30,13 +30,8 @@
 #include <nuttx/arch.h>
 #include <nuttx/atomic.h>
 #include <nuttx/irq.h>
-#include <nuttx/arch.h>
 #include <nuttx/spinlock_type.h>
 
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -89,7 +84,7 @@ uint32_t read_seqbegin(FAR const seqcount_t *s)
   uint32_t seq;
 
 #ifdef CONFIG_SMP
-  seq = atomic_read_acquire((FAR atomic_t *)&s->sequence) & (~1u);
+  seq = atomic_read_acquire(&s->sequence) & ~1;
 #else
   seq = s->sequence;
   SMP_RMB();
@@ -123,7 +118,7 @@ uint32_t read_seqretry(FAR const seqcount_t *s, uint32_t 
start)
   SMP_RMB();
 
 #ifdef CONFIG_SMP
-  seq = atomic_read((FAR atomic_t *)&s->sequence);
+  seq = atomic_read(&s->sequence);
 #else
   seq = s->sequence;
 #endif
@@ -154,15 +149,13 @@ irqstate_t write_seqlock_irqsave(FAR seqcount_t *s)
 #ifdef CONFIG_SMP
   for (; ; )
     {
-      uint32_t sequence = atomic_read((FAR atomic_t *)&s->sequence);
+      uint32_t sequence = atomic_read(&s->sequence);
 
       if (predict_true((sequence & 1u) == 0u))
         {
           /* Try to acquire the lock ownership. */
 
-          if (atomic_cmpxchg_acquire((FAR atomic_t *)&s->sequence,
-                                     (FAR atomic_t *)&sequence,
-                                     sequence + 1u))
+          if (atomic_cmpxchg_acquire(&s->sequence, &sequence, sequence + 1u))
             {
               break;
             }
@@ -194,10 +187,10 @@ irqstate_t write_seqlock_irqsave(FAR seqcount_t *s)
  ****************************************************************************/
 
 static inline_function
-void write_sequnlock_irqrestore(FAR seqcount_t *s, irqstate_t flags)
+void write_sequnlock_irqrestore(seqcount_t *s, irqstate_t flags)
 {
 #ifdef CONFIG_SMP
-  atomic_set_release((FAR atomic_t *)&s->sequence, s->sequence + 1u);
+  atomic_set_release(&s->sequence, s->sequence + 1u);
 #endif
   irq_restore(flags);
 }

Reply via email to