diff options
author | Anup Patel <anup.patel@wdc.com> | 2020-03-11 19:34:39 +0530 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2020-03-13 12:19:36 +0530 |
commit | 16e7071f6ddd5ba69d416b5a68e4aa191fc19d3b (patch) | |
tree | d18ef3d001cfd7b933b3c07c9319f654c8241533 /lib/sbi/sbi_hsm.c | |
parent | eeae3d95827ec33e74d853596b89ee49d83ff751 (diff) |
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>
Diffstat (limited to 'lib/sbi/sbi_hsm.c')
-rw-r--r-- | lib/sbi/sbi_hsm.c | 8 |
1 files 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) |