From bf48c6d4a897fbf225ff3374abe55ede8ffa2c57 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sat, 2 Apr 2022 05:37:00 +0800 Subject: [PATCH] arch/riscv: Rename SCRATCH_HARTID_OFFSET to RISCV_PERCPU_HARTID_OFFSET and fix the typo error Signed-off-by: Xiang Xiao --- arch/risc-v/src/common/riscv_percpu.c | 5 ++++- arch/risc-v/src/common/riscv_percpu.h | 9 ++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/risc-v/src/common/riscv_percpu.c b/arch/risc-v/src/common/riscv_percpu.c index a10164b1f1..21cc316246 100644 --- a/arch/risc-v/src/common/riscv_percpu.c +++ b/arch/risc-v/src/common/riscv_percpu.c @@ -40,6 +40,9 @@ #define HART_CNT (CONFIG_ARCH_CPU_COUNT) +static_assert(RISCV_PERCPU_HARTID_OFFSET == offsetof(riscv_percpu_s, hartid), + "RISCV_PERCPU_HARTID_OFFSET with a wrong value"); + /**************************************************************************** * Private Data ****************************************************************************/ @@ -70,7 +73,7 @@ void riscv_percpu_init(void) } /**************************************************************************** - * Name: riscv_percpu_get_addr + * Name: riscv_percpu_add_hart * * Description: * Get add a hart to the per CPU area diff --git a/arch/risc-v/src/common/riscv_percpu.h b/arch/risc-v/src/common/riscv_percpu.h index ddb35a5145..76edfe6941 100644 --- a/arch/risc-v/src/common/riscv_percpu.h +++ b/arch/risc-v/src/common/riscv_percpu.h @@ -38,10 +38,9 @@ * Pre-processor Definitions ****************************************************************************/ -#ifdef __ASSEMBLY__ -#define SCRATCH_HARTID_OFFSET (0 * INT_REG_SIZE) -#else -#define SCRATCH_HARTID_OFFSET offsetof(riscv_percpu_s, hartid) +#define RISCV_PERCPU_HARTID_OFFSET (0 * INT_REG_SIZE) + +#ifndef __ASSEMBLY__ /**************************************************************************** * Public Types @@ -74,7 +73,7 @@ struct riscv_percpu_s void riscv_percpu_init(void); /**************************************************************************** - * Name: riscv_percpu_get_addr + * Name: riscv_percpu_add_hart * * Description: * Get add a hart to the per CPU area