Skip to content

Commit

Permalink
RISC-V: Change suspend_save_csrs and suspend_restore_csrs to public f…
Browse files Browse the repository at this point in the history
…unction

Currently suspend_save_csrs() and suspend_restore_csrs() functions are
statically defined in the suspend.c. Change the function's attribute
to public so that the functions can be used by hibernation as well.

Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
Reviewed-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
Reviewed-by: Mason Huo <mason.huo@starfivetech.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Link: https://lore.kernel.org/r/20230330064321.1008373-2-jeeheng.sia@starfivetech.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
  • Loading branch information
Sia Jee Heng authored and Palmer Dabbelt committed Apr 29, 2023
1 parent fe15c26 commit 0def12f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions arch/riscv/include/asm/suspend.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ int cpu_suspend(unsigned long arg,
/* Low-level CPU resume entry function */
int __cpu_resume_enter(unsigned long hartid, unsigned long context);

/* Used to save and restore the CSRs */
void suspend_save_csrs(struct suspend_context *context);
void suspend_restore_csrs(struct suspend_context *context);
#endif
4 changes: 2 additions & 2 deletions arch/riscv/kernel/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <asm/csr.h>
#include <asm/suspend.h>

static void suspend_save_csrs(struct suspend_context *context)
void suspend_save_csrs(struct suspend_context *context)
{
context->scratch = csr_read(CSR_SCRATCH);
context->tvec = csr_read(CSR_TVEC);
Expand All @@ -29,7 +29,7 @@ static void suspend_save_csrs(struct suspend_context *context)
#endif
}

static void suspend_restore_csrs(struct suspend_context *context)
void suspend_restore_csrs(struct suspend_context *context)
{
csr_write(CSR_SCRATCH, context->scratch);
csr_write(CSR_TVEC, context->tvec);
Expand Down

0 comments on commit 0def12f

Please sign in to comment.