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 c330e31fa99b3b040e3ffb522cbafcf3afc8b6b6
Author: buxiasen <[email protected]>
AuthorDate: Thu Oct 16 16:56:28 2025 +0800

    include/percpu: move up_this_cpu from arch.h to percpu.h
    
    Fix the dependency issue of up_this_cpu
    Causing link issue: undefined reference to `up_this_cpu'
    
    arch.h now includes percpu.h, so existing users of up_cpu_index() and
    up_this_cpu() keep the same definitions.
    
    Signed-off-by: buxiasen <[email protected]>
---
 include/nuttx/arch.h   | 26 +-------------------------
 include/nuttx/percpu.h | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h
index 6c64748b785..5f5f5abc756 100644
--- a/include/nuttx/arch.h
+++ b/include/nuttx/arch.h
@@ -85,6 +85,7 @@
 #include <arch/types.h>
 
 #include <nuttx/compiler.h>
+#include <nuttx/percpu.h>
 #include <nuttx/cache.h>
 #include <nuttx/sched.h>
 
@@ -149,31 +150,6 @@
 #  define SMP_WMB() memory_barrier()
 #endif
 
-/****************************************************************************
- * Name: up_cpu_index
- *
- * Description:
- *   Return the real core number regardless CONFIG_SMP setting
- *
- ****************************************************************************/
-
-#ifndef CONFIG_ARCH_HAVE_MULTICPU
-#  define up_cpu_index() 0
-#endif /* CONFIG_ARCH_HAVE_MULTICPU */
-
-/****************************************************************************
- * Name: up_this_cpu
- *
- * Description:
- *   Return the logical core number. Default implementation is 1:1 mapping,
- *   i.e. physical=logical.
- *
- ****************************************************************************/
-
-#ifndef CONFIG_ARCH_HAVE_CPUID_MAPPING
-#  define up_this_cpu() up_cpu_index()
-#endif
-
 /****************************************************************************
  * Public Types
  ****************************************************************************/
diff --git a/include/nuttx/percpu.h b/include/nuttx/percpu.h
index 528761cbbd6..9920a329bca 100644
--- a/include/nuttx/percpu.h
+++ b/include/nuttx/percpu.h
@@ -34,6 +34,31 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
+/****************************************************************************
+ * Name: up_cpu_index
+ *
+ * Description:
+ *   Return the real core number regardless CONFIG_SMP setting
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_HAVE_MULTICPU
+#  define up_cpu_index() 0
+#endif /* CONFIG_ARCH_HAVE_MULTICPU */
+
+/****************************************************************************
+ * Name: up_this_cpu
+ *
+ * Description:
+ *   Return the logical core number. Default implementation is 1:1 mapping,
+ *   i.e. physical=logical.
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_ARCH_HAVE_CPUID_MAPPING
+#  define up_this_cpu() up_cpu_index()
+#endif
+
 /* These are macros to access the current CPU and the current task on a CPU.
  * These macros are intended to support a future SMP implementation.
  */

Reply via email to