lib: sbi: Use sbi_hart_count() and sbi_for_each_hartindex()

Simplify the code and improve consistency by using the new macros where
possible. sbi_hart_count() obsoletes sbi_scratch_last_hartindex().

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Samuel Holland
2025-02-20 10:42:30 -08:00
committed by Anup Patel
parent 757f7acafd
commit 949c83a799
9 changed files with 11 additions and 24 deletions

View File

@@ -238,7 +238,6 @@ static void hsm_device_hart_resume(void)
int sbi_hsm_init(struct sbi_scratch *scratch, bool cold_boot)
{
u32 i;
struct sbi_scratch *rscratch;
struct sbi_hsm_data *hdata;
@@ -248,7 +247,7 @@ int sbi_hsm_init(struct sbi_scratch *scratch, bool cold_boot)
return SBI_ENOMEM;
/* Initialize hart state data for every hart */
for (i = 0; i <= sbi_scratch_last_hartindex(); i++) {
sbi_for_each_hartindex(i) {
rscratch = sbi_hartindex_to_scratch(i);
if (!rscratch)
continue;