summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2020-03-09 06:52:41 +0300
committerAnup Patel <anup@brainfault.org>2020-03-10 07:57:28 +0300
commit650c0e525ce60e80b6756aa8cc4eeae5b20ccbd8 (patch)
tree579e92ff39fa780818fe483337850d28df5ddb15
parent6e87507db6ce7be39ccccb33d6283814f0283c09 (diff)
downloadopensbi-650c0e525ce60e80b6756aa8cc4eeae5b20ccbd8.tar.xz
lib: sbi: Fix coding style issues
This fixes various coding style issues found in the SBI codes. No functional changes. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
-rw-r--r--include/sbi/riscv_asm.h6
-rw-r--r--include/sbi/sbi_bitops.h14
-rw-r--r--include/sbi/sbi_const.h7
-rw-r--r--include/sbi/sbi_ecall_interface.h22
-rw-r--r--include/sbi/sbi_error.h32
-rw-r--r--include/sbi/sbi_hsm.h2
-rw-r--r--include/sbi/sbi_ipi.h21
-rw-r--r--include/sbi/sbi_platform.h17
-rw-r--r--include/sbi/sbi_scratch.h3
-rw-r--r--include/sbi/sbi_types.h3
-rw-r--r--include/sbi/sbi_version.h6
-rw-r--r--lib/sbi/riscv_asm.c2
-rw-r--r--lib/sbi/riscv_atomic.c42
-rw-r--r--lib/sbi/sbi_bitops.c12
-rw-r--r--lib/sbi/sbi_ecall.c3
-rw-r--r--lib/sbi/sbi_hart.c4
-rw-r--r--lib/sbi/sbi_hsm.c14
-rw-r--r--lib/sbi/sbi_tlb.c4
-rw-r--r--lib/sbi/sbi_trap.c2
19 files changed, 113 insertions, 103 deletions
diff --git a/include/sbi/riscv_asm.h b/include/sbi/riscv_asm.h
index 63df3fc..4445fa1 100644
--- a/include/sbi/riscv_asm.h
+++ b/include/sbi/riscv_asm.h
@@ -28,9 +28,9 @@
#error "Unexpected __riscv_xlen"
#endif
-#define PAGE_SHIFT (12)
-#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
-#define PAGE_MASK (~(PAGE_SIZE - 1))
+#define PAGE_SHIFT (12)
+#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
+#define PAGE_MASK (~(PAGE_SIZE - 1))
#define REG_L __REG_SEL(ld, lw)
#define REG_S __REG_SEL(sd, sw)
diff --git a/include/sbi/sbi_bitops.h b/include/sbi/sbi_bitops.h
index c55ced0..d920086 100644
--- a/include/sbi/sbi_bitops.h
+++ b/include/sbi/sbi_bitops.h
@@ -215,20 +215,20 @@ static inline unsigned long __fls(unsigned long word)
(bit) = find_next_zero_bit((addr), (size), (bit) + 1))
unsigned long find_first_bit(const unsigned long *addr,
- unsigned long size);
+ unsigned long size);
unsigned long find_first_zero_bit(const unsigned long *addr,
- unsigned long size);
+ unsigned long size);
unsigned long find_last_bit(const unsigned long *addr,
- unsigned long size);
+ unsigned long size);
unsigned long find_next_bit(const unsigned long *addr,
- unsigned long size, unsigned long offset);
+ unsigned long size, unsigned long offset);
unsigned long find_next_zero_bit(const unsigned long *addr,
- unsigned long size,
- unsigned long offset);
+ unsigned long size,
+ unsigned long offset);
/**
* __set_bit - Set a bit in memory
@@ -242,7 +242,7 @@ static inline void __set_bit(int nr, volatile unsigned long *addr)
unsigned long mask = BIT_MASK(nr);
unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
- *p |= mask;
+ *p |= mask;
}
/**
diff --git a/include/sbi/sbi_const.h b/include/sbi/sbi_const.h
index 423d2cf..3786654 100644
--- a/include/sbi/sbi_const.h
+++ b/include/sbi/sbi_const.h
@@ -10,7 +10,8 @@
#ifndef __SBI_CONST_H__
#define __SBI_CONST_H__
-/* Some constant macros are used in both assembler and
+/*
+ * Some constant macros are used in both assembler and
* C code. Therefore we cannot annotate them always with
* 'UL' and other type specifiers unilaterally. We
* use the following macros to deal with this.
@@ -39,8 +40,8 @@
#define UL(x) (_UL(x))
#define ULL(x) (_ULL(x))
-#define __STR(s) #s
-#define STRINGIFY(s) __STR(s)
+#define __STR(s) #s
+#define STRINGIFY(s) __STR(s)
/* clang-format on */
diff --git a/include/sbi/sbi_ecall_interface.h b/include/sbi/sbi_ecall_interface.h
index 727a545..225dcd4 100644
--- a/include/sbi/sbi_ecall_interface.h
+++ b/include/sbi/sbi_ecall_interface.h
@@ -31,11 +31,11 @@
/* SBI function IDs for BASE extension*/
#define SBI_EXT_BASE_GET_SPEC_VERSION 0x0
#define SBI_EXT_BASE_GET_IMP_ID 0x1
-#define SBI_EXT_BASE_GET_IMP_VERSION 0x2
-#define SBI_EXT_BASE_PROBE_EXT 0x3
-#define SBI_EXT_BASE_GET_MVENDORID 0x4
-#define SBI_EXT_BASE_GET_MARCHID 0x5
-#define SBI_EXT_BASE_GET_MIMPID 0x6
+#define SBI_EXT_BASE_GET_IMP_VERSION 0x2
+#define SBI_EXT_BASE_PROBE_EXT 0x3
+#define SBI_EXT_BASE_GET_MVENDORID 0x4
+#define SBI_EXT_BASE_GET_MARCHID 0x5
+#define SBI_EXT_BASE_GET_MIMPID 0x6
/* SBI function IDs for TIME extension*/
#define SBI_EXT_TIME_SET_TIMER 0x0
@@ -44,7 +44,7 @@
#define SBI_EXT_IPI_SEND_IPI 0x0
/* SBI function IDs for RFENCE extension*/
-#define SBI_EXT_RFENCE_REMOTE_FENCE_I 0x0
+#define SBI_EXT_RFENCE_REMOTE_FENCE_I 0x0
#define SBI_EXT_RFENCE_REMOTE_SFENCE_VMA 0x1
#define SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID 0x2
#define SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA 0x3
@@ -62,11 +62,11 @@
#define SBI_HSM_HART_STATUS_START_PENDING 0x2
#define SBI_HSM_HART_STATUS_STOP_PENDING 0x3
-#define SBI_SPEC_VERSION_MAJOR_OFFSET 24
-#define SBI_SPEC_VERSION_MAJOR_MASK 0x7f
-#define SBI_SPEC_VERSION_MINOR_MASK 0xffffff
-#define SBI_EXT_VENDOR_START 0x09000000
-#define SBI_EXT_VENDOR_END 0x09FFFFFF
+#define SBI_SPEC_VERSION_MAJOR_OFFSET 24
+#define SBI_SPEC_VERSION_MAJOR_MASK 0x7f
+#define SBI_SPEC_VERSION_MINOR_MASK 0xffffff
+#define SBI_EXT_VENDOR_START 0x09000000
+#define SBI_EXT_VENDOR_END 0x09FFFFFF
/* clang-format on */
#endif
diff --git a/include/sbi/sbi_error.h b/include/sbi/sbi_error.h
index 91ba2ee..574a84d 100644
--- a/include/sbi/sbi_error.h
+++ b/include/sbi/sbi_error.h
@@ -12,22 +12,22 @@
/* clang-format off */
-#define SBI_OK 0
-#define SBI_EFAIL -1
-#define SBI_ENOTSUPP -2
-#define SBI_EINVAL -3
-#define SBI_DENIED -4
-#define SBI_INVALID_ADDR -5
-#define SBI_ENODEV -6
-#define SBI_ENOSYS -7
-#define SBI_ETIMEDOUT -8
-#define SBI_EIO -9
-#define SBI_EILL -10
-#define SBI_ENOSPC -11
-#define SBI_ENOMEM -12
-#define SBI_ETRAP -13
-#define SBI_EUNKNOWN -14
-#define SBI_ENOENT -15
+#define SBI_OK 0
+#define SBI_EFAIL -1
+#define SBI_ENOTSUPP -2
+#define SBI_EINVAL -3
+#define SBI_DENIED -4
+#define SBI_INVALID_ADDR -5
+#define SBI_ENODEV -6
+#define SBI_ENOSYS -7
+#define SBI_ETIMEDOUT -8
+#define SBI_EIO -9
+#define SBI_EILL -10
+#define SBI_ENOSPC -11
+#define SBI_ENOMEM -12
+#define SBI_ETRAP -13
+#define SBI_EUNKNOWN -14
+#define SBI_ENOENT -15
#define SBI_EALREADY_STARTED -16
/* clang-format on */
diff --git a/include/sbi/sbi_hsm.h b/include/sbi/sbi_hsm.h
index 11ea7cf..a68eafb 100644
--- a/include/sbi/sbi_hsm.h
+++ b/include/sbi/sbi_hsm.h
@@ -22,7 +22,7 @@ int sbi_hsm_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot);
void __noreturn sbi_hsm_exit(struct sbi_scratch *scratch);
int sbi_hsm_hart_start(struct sbi_scratch *scratch, u32 hartid,
- ulong saddr, ulong priv);
+ ulong saddr, ulong priv);
int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow);
int sbi_hsm_hart_get_state(struct sbi_scratch *scratch, u32 hartid);
int sbi_hsm_hart_state_to_status(int state);
diff --git a/include/sbi/sbi_ipi.h b/include/sbi/sbi_ipi.h
index d680148..bf91142 100644
--- a/include/sbi/sbi_ipi.h
+++ b/include/sbi/sbi_ipi.h
@@ -25,23 +25,26 @@ struct sbi_ipi_event_ops {
/** Name of the IPI event operations */
char name[32];
- /** Update callback to save/enqueue data for remote HART
- * Note: This is an optional callback and it is called just before
- * triggering IPI to remote HART.
+ /**
+ * Update callback to save/enqueue data for remote HART
+ * Note: This is an optional callback and it is called just before
+ * triggering IPI to remote HART.
*/
int (* update)(struct sbi_scratch *scratch,
struct sbi_scratch *remote_scratch,
u32 remote_hartid, void *data);
- /** Sync callback to wait for remote HART
- * Note: This is an optional callback and it is called just after
- * triggering IPI to remote HART.
+ /**
+ * Sync callback to wait for remote HART
+ * Note: This is an optional callback and it is called just after
+ * triggering IPI to remote HART.
*/
void (* sync)(struct sbi_scratch *scratch);
- /** Process callback to handle IPI event
- * Note: This is a mandatory callback and it is called on the
- * remote HART after IPI is triggered.
+ /**
+ * Process callback to handle IPI event
+ * Note: This is a mandatory callback and it is called on the
+ * remote HART after IPI is triggered.
*/
void (* process)(struct sbi_scratch *scratch);
};
diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h
index 462006e..a28bc50 100644
--- a/include/sbi/sbi_platform.h
+++ b/include/sbi/sbi_platform.h
@@ -10,9 +10,10 @@
#ifndef __SBI_PLATFORM_H__
#define __SBI_PLATFORM_H__
-/** OpenSBI 32-bit platform version with:
- * 1. upper 16-bits as major number
- * 2. lower 16-bits as minor number
+/**
+ * OpenSBI 32-bit platform version with:
+ * 1. upper 16-bits as major number
+ * 2. lower 16-bits as minor number
*/
#define SBI_PLATFORM_VERSION(Major, Minor) ((Major << 16) | Minor)
@@ -81,12 +82,14 @@ struct sbi_platform_operations {
/** Platform final exit */
void (*final_exit)(void);
- /** For platforms that do not implement misa, non-standard
+ /**
+ * For platforms that do not implement misa, non-standard
* methods are needed to determine cpu extension.
*/
int (*misa_check_extension)(char ext);
- /** For platforms that do not implement misa, non-standard
+ /**
+ * For platforms that do not implement misa, non-standard
* methods are needed to get MXL field of misa.
*/
int (*misa_get_xlen)(void);
@@ -138,8 +141,8 @@ struct sbi_platform_operations {
/** Bringup the given hart from previous stage **/
int (*hart_start)(u32 hartid, ulong saddr, ulong priv);
/**
- * Stop the current hart from running. This call doesn't expect to
- * return if success.
+ * Stop the current hart from running. This call doesn't expect to
+ * return if success.
*/
int (*hart_stop)(void);
diff --git a/include/sbi/sbi_scratch.h b/include/sbi/sbi_scratch.h
index 0309349..1c85562 100644
--- a/include/sbi/sbi_scratch.h
+++ b/include/sbi/sbi_scratch.h
@@ -85,7 +85,8 @@ enum sbi_scratch_options {
#define sbi_scratch_thishart_arg1_ptr() \
((void *)(sbi_scratch_thishart_ptr()->next_arg1))
-/** Allocate from extra space in sbi_scratch
+/**
+ * Allocate from extra space in sbi_scratch
*
* @return zero on failure and non-zero (>= SBI_SCRATCH_EXTRA_SPACE_OFFSET)
* on success
diff --git a/include/sbi/sbi_types.h b/include/sbi/sbi_types.h
index b1686bf..b59a6ff 100644
--- a/include/sbi/sbi_types.h
+++ b/include/sbi/sbi_types.h
@@ -89,7 +89,8 @@ typedef unsigned long physical_size_t;
/* clang-format on */
#else
-/* OPENSBI_EXTERNAL_SBI_TYPES could be defined in CFLAGS for using the
+/*
+ * OPENSBI_EXTERNAL_SBI_TYPES could be defined in CFLAGS for using the
* external definitions of data types and common macros.
* OPENSBI_EXTERNAL_SBI_TYPES is the file name to external header file,
* the external build system should address the additional include
diff --git a/include/sbi/sbi_version.h b/include/sbi/sbi_version.h
index 62615a8..a71de3c 100644
--- a/include/sbi/sbi_version.h
+++ b/include/sbi/sbi_version.h
@@ -14,9 +14,9 @@
#define OPENSBI_VERSION_MINOR 6
/**
- * OpenSBI 32-bit version with:
- * 1. upper 16-bits as major number
- * 2. lower 16-bits as minor number
+ * OpenSBI 32-bit version with:
+ * 1. upper 16-bits as major number
+ * 2. lower 16-bits as minor number
*/
#define OPENSBI_VERSION ((OPENSBI_VERSION_MAJOR << 16) | \
(OPENSBI_VERSION_MINOR))
diff --git a/lib/sbi/riscv_asm.c b/lib/sbi/riscv_asm.c
index 7b612d4..79c45f5 100644
--- a/lib/sbi/riscv_asm.c
+++ b/lib/sbi/riscv_asm.c
@@ -207,7 +207,7 @@ int pmp_set(unsigned int n, unsigned long prot, unsigned long addr,
if (n >= PMP_COUNT || log2len > __riscv_xlen || log2len < PMP_SHIFT)
return SBI_EINVAL;
- /* calculate PMP register and offset */
+ /* calculate PMP register and offset */
#if __riscv_xlen == 32
pmpcfg_csr = CSR_PMPCFG0 + (n >> 2);
pmpcfg_shift = (n & 3) << 3;
diff --git a/lib/sbi/riscv_atomic.c b/lib/sbi/riscv_atomic.c
index 9d8199e..fcf3ed1 100644
--- a/lib/sbi/riscv_atomic.c
+++ b/lib/sbi/riscv_atomic.c
@@ -49,7 +49,7 @@ long atomic_sub_return(atomic_t *atom, long value)
return ret - value;
}
-#define __axchg(ptr, new, size) \
+#define __axchg(ptr, new, size) \
({ \
__typeof__(ptr) __ptr = (ptr); \
__typeof__(new) __new = (new); \
@@ -70,12 +70,12 @@ long atomic_sub_return(atomic_t *atom, long value)
: "memory"); \
break; \
default: \
- break; \
+ break; \
} \
__ret; \
})
-#define axchg(ptr, x) \
+#define axchg(ptr, x) \
({ \
__typeof__(*(ptr)) _x_ = (x); \
(__typeof__(*(ptr))) __axchg((ptr), _x_, sizeof(*(ptr))); \
@@ -90,20 +90,20 @@ long atomic_sub_return(atomic_t *atom, long value)
register unsigned int __rc; \
switch (size) { \
case 4: \
- __asm__ __volatile__("0: lr.w %0, %2\n" \
- " sc.w.rl %1, %z3, %2\n" \
- " bnez %1, 0b\n" \
- " fence rw, rw\n" \
+ __asm__ __volatile__("0: lr.w %0, %2\n" \
+ " sc.w.rl %1, %z3, %2\n" \
+ " bnez %1, 0b\n" \
+ " fence rw, rw\n" \
: "=&r"(__ret), "=&r"(__rc), \
"+A"(*__ptr) \
: "rJ"(__new) \
: "memory"); \
break; \
case 8: \
- __asm__ __volatile__("0: lr.d %0, %2\n" \
- " sc.d.rl %1, %z3, %2\n" \
- " bnez %1, 0b\n" \
- " fence rw, rw\n" \
+ __asm__ __volatile__("0: lr.d %0, %2\n" \
+ " sc.d.rl %1, %z3, %2\n" \
+ " bnez %1, 0b\n" \
+ " fence rw, rw\n" \
: "=&r"(__ret), "=&r"(__rc), \
"+A"(*__ptr) \
: "rJ"(__new) \
@@ -130,11 +130,11 @@ long atomic_sub_return(atomic_t *atom, long value)
register unsigned int __rc; \
switch (size) { \
case 4: \
- __asm__ __volatile__("0: lr.w %0, %2\n" \
- " bne %0, %z3, 1f\n" \
- " sc.w.rl %1, %z4, %2\n" \
- " bnez %1, 0b\n" \
- " fence rw, rw\n" \
+ __asm__ __volatile__("0: lr.w %0, %2\n" \
+ " bne %0, %z3, 1f\n" \
+ " sc.w.rl %1, %z4, %2\n" \
+ " bnez %1, 0b\n" \
+ " fence rw, rw\n" \
"1:\n" \
: "=&r"(__ret), "=&r"(__rc), \
"+A"(*__ptr) \
@@ -142,11 +142,11 @@ long atomic_sub_return(atomic_t *atom, long value)
: "memory"); \
break; \
case 8: \
- __asm__ __volatile__("0: lr.d %0, %2\n" \
- " bne %0, %z3, 1f\n" \
- " sc.d.rl %1, %z4, %2\n" \
- " bnez %1, 0b\n" \
- " fence rw, rw\n" \
+ __asm__ __volatile__("0: lr.d %0, %2\n" \
+ " bne %0, %z3, 1f\n" \
+ " sc.d.rl %1, %z4, %2\n" \
+ " bnez %1, 0b\n" \
+ " fence rw, rw\n" \
"1:\n" \
: "=&r"(__ret), "=&r"(__rc), \
"+A"(*__ptr) \
diff --git a/lib/sbi/sbi_bitops.c b/lib/sbi/sbi_bitops.c
index 1355243..de9d045 100644
--- a/lib/sbi/sbi_bitops.c
+++ b/lib/sbi/sbi_bitops.c
@@ -20,7 +20,7 @@
* Returns the bit number of the first set bit.
*/
unsigned long find_first_bit(const unsigned long *addr,
- unsigned long size)
+ unsigned long size)
{
const unsigned long *p = addr;
unsigned long result = 0;
@@ -50,7 +50,7 @@ found:
* Returns the bit number of the first cleared bit.
*/
unsigned long find_first_zero_bit(const unsigned long *addr,
- unsigned long size)
+ unsigned long size)
{
const unsigned long *p = addr;
unsigned long result = 0;
@@ -80,7 +80,7 @@ found:
* Returns the bit number of the first set bit, or size.
*/
unsigned long find_last_bit(const unsigned long *addr,
- unsigned long size)
+ unsigned long size)
{
unsigned long words;
unsigned long tmp;
@@ -115,7 +115,7 @@ found:
* @size: The bitmap size in bits
*/
unsigned long find_next_bit(const unsigned long *addr,
- unsigned long size, unsigned long offset)
+ unsigned long size, unsigned long offset)
{
const unsigned long *p = addr + BITOP_WORD(offset);
unsigned long result = offset & ~(BITS_PER_LONG-1);
@@ -160,8 +160,8 @@ found_middle:
* @size: The bitmap size in bits
*/
unsigned long find_next_zero_bit(const unsigned long *addr,
- unsigned long size,
- unsigned long offset)
+ unsigned long size,
+ unsigned long offset)
{
const unsigned long *p = addr + BITOP_WORD(offset);
unsigned long result = offset & ~(BITS_PER_LONG-1);
diff --git a/lib/sbi/sbi_ecall.c b/lib/sbi/sbi_ecall.c
index 2383e4f..6d7b152 100644
--- a/lib/sbi/sbi_ecall.c
+++ b/lib/sbi/sbi_ecall.c
@@ -105,7 +105,8 @@ int sbi_ecall_handler(u32 hartid, ulong mcause, struct sbi_trap_regs *regs,
trap.epc = regs->mepc;
sbi_trap_redirect(regs, &trap, scratch);
} else {
- /* This function should return non-zero value only in case of
+ /*
+ * This function should return non-zero value only in case of
* fatal error. However, there is no good way to distinguish
* between a fatal and non-fatal errors yet. That's why we treat
* every return value except ETRAP as non-fatal and just return
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index bce2fb5..c00e16a 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -75,7 +75,7 @@ static int delegate_traps(struct sbi_scratch *scratch, u32 hartid)
unsigned long interrupts, exceptions;
if (!misa_extension('S'))
- /* No delegation possible as mideleg does not exist*/
+ /* No delegation possible as mideleg does not exist */
return 0;
/* Send M-mode interrupts and most exceptions to S-mode */
@@ -342,7 +342,7 @@ sbi_hart_switch_mode(unsigned long arg0, unsigned long arg1,
__builtin_unreachable();
}
-static spinlock_t avail_hart_mask_lock = SPIN_LOCK_INITIALIZER;
+static spinlock_t avail_hart_mask_lock = SPIN_LOCK_INITIALIZER;
static volatile unsigned long avail_hart_mask = 0;
void sbi_hart_mark_available(u32 hartid)
diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c
index c1fd950..14a2d84 100644
--- a/lib/sbi/sbi_hsm.c
+++ b/lib/sbi/sbi_hsm.c
@@ -81,7 +81,7 @@ void sbi_hsm_prepare_next_jump(struct sbi_scratch *scratch, u32 hartid)
{
u32 oldstate;
struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch,
- hart_data_offset);
+ hart_data_offset);
oldstate = arch_atomic_cmpxchg(&hdata->state, SBI_HART_STARTING,
SBI_HART_STARTED);
@@ -94,7 +94,7 @@ static void sbi_hsm_hart_wait(struct sbi_scratch *scratch, u32 hartid)
unsigned long saved_mie;
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch,
- hart_data_offset);
+ hart_data_offset);
/* Save MIE CSR */
saved_mie = csr_read(CSR_MIE);
@@ -122,7 +122,7 @@ int sbi_hsm_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot)
if (cold_boot) {
hart_data_offset = sbi_scratch_alloc_offset(sizeof(*hdata),
- "HART_DATA");
+ "HART_DATA");
if (!hart_data_offset)
return SBI_ENOMEM;
hart_count = sbi_platform_hart_count(plat);
@@ -147,7 +147,7 @@ void __noreturn sbi_hsm_exit(struct sbi_scratch *scratch)
u32 hstate;
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch,
- hart_data_offset);
+ hart_data_offset);
void (*jump_warmboot)(void) = (void (*)(void))scratch->warmboot_addr;
hstate = arch_atomic_cmpxchg(&hdata->state, SBI_HART_STOPPING,
@@ -183,7 +183,7 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch, u32 hartid,
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
struct sbi_scratch *rscratch = sbi_hart_id_to_scratch(scratch, hartid);
struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(rscratch,
- hart_data_offset);
+ hart_data_offset);
if (sbi_platform_hart_disabled(plat, hartid))
return SBI_EINVAL;
@@ -225,14 +225,14 @@ int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow)
u32 hartid = sbi_current_hartid();
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch,
- hart_data_offset);
+ hart_data_offset);
if (sbi_platform_hart_disabled(plat, hartid) ||
!sbi_hsm_hart_started(scratch, hartid))
return SBI_EINVAL;
oldstate = arch_atomic_cmpxchg(&hdata->state, SBI_HART_STARTED,
- SBI_HART_STOPPING);
+ SBI_HART_STOPPING);
if (oldstate != SBI_HART_STARTED) {
sbi_printf("%s: ERR: The hart is in invalid state [%u]\n",
__func__, oldstate);
diff --git a/lib/sbi/sbi_tlb.c b/lib/sbi/sbi_tlb.c
index 072915f..21e2436 100644
--- a/lib/sbi/sbi_tlb.c
+++ b/lib/sbi/sbi_tlb.c
@@ -392,11 +392,11 @@ int sbi_tlb_init(struct sbi_scratch *scratch, bool cold_boot)
if (cold_boot) {
tlb_sync_off = sbi_scratch_alloc_offset(sizeof(*tlb_sync),
- "IPI_TLB_SYNC");
+ "IPI_TLB_SYNC");
if (!tlb_sync_off)
return SBI_ENOMEM;
tlb_fifo_off = sbi_scratch_alloc_offset(sizeof(*tlb_q),
- "IPI_TLB_FIFO");
+ "IPI_TLB_FIFO");
if (!tlb_fifo_off) {
sbi_scratch_free_offset(tlb_sync_off);
return SBI_ENOMEM;
diff --git a/lib/sbi/sbi_trap.c b/lib/sbi/sbi_trap.c
index d5ab24b..b5fbc5e 100644
--- a/lib/sbi/sbi_trap.c
+++ b/lib/sbi/sbi_trap.c
@@ -178,7 +178,7 @@ int sbi_trap_redirect(struct sbi_trap_regs *regs,
regs->mstatus &= ~MSTATUS_MPP;
regs->mstatus |= (PRV_S << MSTATUS_MPP_SHIFT);
- /* Set SPP for S-mode*/
+ /* Set SPP for S-mode */
regs->mstatus &= ~MSTATUS_SPP;
if (prev_mode == PRV_S)
regs->mstatus |= (1UL << MSTATUS_SPP_SHIFT);