From f8b3bb826d488847009f74409b1898d88b5a6cc7 Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Sat, 22 Feb 2020 11:50:55 +0530 Subject: [PATCH] lib: Simplify the for-loop in sbi_ipi_send_many() We don't need to separately call sbi_ipi_send() for current HART in sbi_ipi_send_many(). Instead, we can simplify the for-loop in sbi_ipi_send_many() and call sbi_ipi_send() for all HARTs in the for-loop itself. Signed-off-by: Anup Patel Reviewed-by: Bin Meng --- lib/sbi/sbi_ipi.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c index 62eba876..d3b48fea 100644 --- a/lib/sbi/sbi_ipi.c +++ b/lib/sbi/sbi_ipi.c @@ -76,7 +76,6 @@ int sbi_ipi_send_many(struct sbi_scratch *scratch, ulong hmask, ulong hbase, ulong i, m; ulong mask = sbi_hart_available_mask(); ulong tempmask; - u32 hartid = sbi_current_hartid(); unsigned long last_bit = __fls(mask); if (hbase != -1UL) { @@ -98,16 +97,9 @@ int sbi_ipi_send_many(struct sbi_scratch *scratch, ulong hmask, ulong hbase, /* Send IPIs to every other hart on the set */ for (i = 0, m = mask; m; i++, m >>= 1) - if ((m & 1UL) && (i != hartid)) + if (m & 1UL) sbi_ipi_send(scratch, i, event, data); - /* - * If the current hart is on the set, send an IPI - * to it as well - */ - if (mask & (1UL << hartid)) - sbi_ipi_send(scratch, hartid, event, data); - return 0; }