target/riscv/csr.c: use riscv_cpu_cfg() to avoid env_cpu() pointers
commita9a4e39fd2bbf09bf10cb30700f4792a10cd2392
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>
Fri, 24 Feb 2023 17:45:19 +0000 (24 14:45 -0300)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 2 Mar 2023 01:40:14 +0000 (1 17:40 -0800)
tree5e6b41b6a463e6558232ce88ec302a9e39de7fb3
parent96b1b00058fc95de6c76c441a8b941003de3a54d
target/riscv/csr.c: use riscv_cpu_cfg() to avoid env_cpu() pointers

A common trend in this file is to retrieve a RISCVCPU pointer by first
retrieving a CPUState pointer via env_cpu(). The CPU pointer is used
only to access the RISCVCPUConfig object and nothing else.

Let's use riscv_cpu_cfg() to access what we need directly without these
2 pointers.

Suggested-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20230224174520.92490-4-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
target/riscv/csr.c