You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/04/02 11:08:52 UTC

[incubator-nuttx] 06/06: arch/riscv: Rename g_scratch to g_percpu

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

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

commit 27c80f2586096d56b3b5407f464dc1aa762fd2b8
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Apr 2 05:39:06 2022 +0800

    arch/riscv: Rename g_scratch to g_percpu
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/risc-v/src/common/riscv_percpu.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/risc-v/src/common/riscv_percpu.c b/arch/risc-v/src/common/riscv_percpu.c
index 5e45c89..a10164b 100644
--- a/arch/risc-v/src/common/riscv_percpu.c
+++ b/arch/risc-v/src/common/riscv_percpu.c
@@ -44,7 +44,7 @@
  * Private Data
  ****************************************************************************/
 
-static struct riscv_percpu_s g_scratch[HART_CNT];
+static struct riscv_percpu_s g_percpu[HART_CNT];
 
 /****************************************************************************
  * Public Functions
@@ -61,11 +61,11 @@ static struct riscv_percpu_s g_scratch[HART_CNT];
 
 void riscv_percpu_init(void)
 {
-  int i;
+  uintptr_t i;
 
   for (i = 0; i < HART_CNT; i++)
     {
-      g_scratch[i].hartid = i;
+      g_percpu[i].hartid = i;
     }
 }
 
@@ -88,7 +88,7 @@ void riscv_percpu_add_hart(uintptr_t hartid)
 
   /* Set the scratch register value to point to the scratch area */
 
-  WRITE_CSR(CSR_SCRATCH, &g_scratch[hartid]);
+  WRITE_CSR(CSR_SCRATCH, &g_percpu[hartid]);
 
   /* Make sure it sticks */
 
@@ -111,8 +111,8 @@ uintptr_t riscv_percpu_get_hartid(void)
 {
   uintptr_t scratch = READ_CSR(CSR_SCRATCH);
 
-  DEBUGASSERT(scratch >= (uintptr_t) &g_scratch &&
-              scratch <= (uintptr_t) &g_scratch + sizeof(g_scratch));
+  DEBUGASSERT(scratch >= (uintptr_t) &g_percpu &&
+              scratch < (uintptr_t) &g_percpu + sizeof(g_percpu));
 
   return ((struct riscv_percpu_s *)scratch)->hartid;
 }