diff options
author | Anup Patel <anup.patel@wdc.com> | 2021-02-02 10:36:14 +0530 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2021-03-03 10:18:23 +0530 |
commit | 638c948ab90e8630be5c43c17abb63cb3154919f (patch) | |
tree | 2aa5e9d4c77b160e775052b93b776dc6f056cd86 | |
parent | 7c867fd19f92ac36aa2cd329f1eb687c6e630a26 (diff) |
lib: sbi: Remove redundant sbi_hsm_hart_started() function
The sbi_hsm_hart_started() function is only used by sbi_hsm_hart_stop()
for checking state of calling HART and current domain assignment.
The atomic_cmpxchg() called by sbi_hsm_hart_stop() will check state of
calling hart anyway and domain assignment can be checked by other domain
function such as sbi_domain_is_assigned_hart().
This means sbi_hsm_hart_started() is redundant and can be removed.
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
-rw-r--r-- | lib/sbi/sbi_hsm.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index a81b821..10099c2 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -54,14 +54,6 @@ int sbi_hsm_hart_get_state(const struct sbi_domain *dom, u32 hartid) return __sbi_hsm_hart_get_state(hartid); } -static bool sbi_hsm_hart_started(const struct sbi_domain *dom, u32 hartid) -{ - if (sbi_hsm_hart_get_state(dom, hartid) == SBI_HSM_STATE_STARTED) - return TRUE; - else - return FALSE; -} - /** * Get ulong HART mask for given HART base ID * @param dom the domain to be used for output HART mask @@ -247,12 +239,12 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch, int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow) { int oldstate; - u32 hartid = current_hartid(); + const struct sbi_domain *dom = sbi_domain_thishart_ptr(); struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch, hart_data_offset); - if (!sbi_hsm_hart_started(sbi_domain_thishart_ptr(), hartid)) - return SBI_EINVAL; + if (!dom) + return SBI_EFAIL; oldstate = atomic_cmpxchg(&hdata->state, SBI_HSM_STATE_STARTED, SBI_HSM_STATE_STOP_PENDING); |