[PATCH v3 3/6] lib: sbi: change prototype of sbi_trap_redirect

Anup Patel anup at brainfault.org
Sat Mar 2 04:56:21 PST 2024


On Sat, Mar 2, 2024 at 4:55 PM Bo Gan <ganboing at gmail.com> wrote:
>
> sbi_trap_redirect now uses const pointer to `trap`.
> This ensures the caller that we never change `trap` in sbi_trap_redirect.
>
> Signed-off-by: Bo Gan <ganboing at gmail.com>

LGTM.

Reviewed-by: Anup Patel <anup at brainfault.org>

Regards,
Anup

> ---
>  include/sbi/sbi_trap.h | 2 +-
>  lib/sbi/sbi_trap.c     | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/sbi/sbi_trap.h b/include/sbi/sbi_trap.h
> index a562b95..2727bdb 100644
> --- a/include/sbi/sbi_trap.h
> +++ b/include/sbi/sbi_trap.h
> @@ -225,7 +225,7 @@ static inline unsigned long sbi_regs_gva(const struct sbi_trap_regs *regs)
>  }
>
>  int sbi_trap_redirect(struct sbi_trap_regs *regs,
> -                     struct sbi_trap_info *trap);
> +                     const struct sbi_trap_info *trap);
>
>  struct sbi_trap_regs *sbi_trap_handler(struct sbi_trap_regs *regs);
>
> diff --git a/lib/sbi/sbi_trap.c b/lib/sbi/sbi_trap.c
> index 145db4b..1024981 100644
> --- a/lib/sbi/sbi_trap.c
> +++ b/lib/sbi/sbi_trap.c
> @@ -84,7 +84,7 @@ static void __noreturn sbi_trap_error(const char *msg, int rc,
>   * @return 0 on success and negative error code on failure
>   */
>  int sbi_trap_redirect(struct sbi_trap_regs *regs,
> -                     struct sbi_trap_info *trap)
> +                     const struct sbi_trap_info *trap)
>  {
>         ulong hstatus, vsstatus, prev_mode;
>  #if __riscv_xlen == 32
> --
> 2.7.4
>



More information about the opensbi mailing list