zhujiale 8 місяців тому
батько
коміт
d8956e415e
2 змінених файлів з 11 додано та 10 видалено
  1. 4 3
      components/drivers/smp/smp.c
  2. 7 7
      examples/utest/testcases/smp/smp.c

+ 4 - 3
components/drivers/smp/smp.c

@@ -14,9 +14,10 @@
 #define DBG_LVL DBG_INFO
 #include <rtdbg.h>
 
-struct rt_smp_call rt_smp_work[RT_CPUS_NR];
-rt_atomic_t        rt_smp_wait;
-rt_err_t           smp_call_handler(struct rt_smp_event *event)
+static struct rt_smp_call rt_smp_work[RT_CPUS_NR];
+static rt_atomic_t        rt_smp_wait;
+
+static rt_err_t smp_call_handler(struct rt_smp_event *event)
 {
     switch (event->event_id)
     {

+ 7 - 7
examples/utest/testcases/smp/smp.c

@@ -2,11 +2,11 @@
 #include "utest.h"
 #include "utest_assert.h"
 #include "smp.h"
-int                pass_count = 0;
-int                pass       = 1000;
-struct rt_spinlock lock;
+static int                pass_count = 0;
+static int                pass       = 1000;
+static struct rt_spinlock lock;
 
-void test_call(void *data)
+static void test_call(void *data)
 {
     rt_spin_lock(&lock);
     int *i   = (int *)data;
@@ -18,7 +18,7 @@ void test_call(void *data)
 }
 
 
-void test1()
+static void test1()
 {
     int cpu_mask = 0xf;
     for (int i = 0; i < 1000; i++)
@@ -34,7 +34,7 @@ void test1()
     uassert_true(pass_count == pass);
 }
 
-void test_call2(void *data)
+static void test_call2(void *data)
 {
     rt_spin_lock(&lock);
     int a = 100000;
@@ -43,7 +43,7 @@ void test_call2(void *data)
     (*i)++;
     rt_spin_unlock(&lock);
 }
-void test2(void)
+static void test2(void)
 {
     int data = 0;
     rt_smp_call_each_cpu(test_call2, &data, SMP_CALL_WAIT_ALL);