From 16e7071f6ddd5ba69d416b5a68e4aa191fc19d3b Mon Sep 17 00:00:00 2001 From: Anup Patel <anup.patel@wdc.com> Date: Wed, 11 Mar 2020 19:34:39 +0530 Subject: lib: sbi_hsm: Optimize sbi_hsm_hart_get_state() implementation Now that sbi_hart_id_to_scratch() is optimized, we don't need the "if ()" statement. Also, the hstate local variable is redundant so we remove that as well. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com> --- lib/sbi/sbi_hsm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index 713dbaf..5fd7855 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -58,15 +58,11 @@ int sbi_hsm_hart_state_to_status(int state) int sbi_hsm_hart_get_state(struct sbi_scratch *scratch, u32 hartid) { struct sbi_hsm_data *hdata; - u32 hstate; - - if (hartid != sbi_current_hartid()) - scratch = sbi_hart_id_to_scratch(scratch, hartid); + scratch = sbi_hart_id_to_scratch(scratch, hartid); hdata = sbi_scratch_offset_ptr(scratch, hart_data_offset); - hstate = atomic_read(&hdata->state); - return hstate; + return atomic_read(&hdata->state); } bool sbi_hsm_hart_started(struct sbi_scratch *scratch, u32 hartid) -- cgit v1.2.3