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>
This commit is contained in:
Anup Patel
2020-03-11 19:34:39 +05:30
committed by Anup Patel
parent eeae3d9582
commit 16e7071f6d

View File

@@ -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) int sbi_hsm_hart_get_state(struct sbi_scratch *scratch, u32 hartid)
{ {
struct sbi_hsm_data *hdata; 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); 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) bool sbi_hsm_hart_started(struct sbi_scratch *scratch, u32 hartid)