Skip to content

Commit 813d39b

Browse files
jones-drewAlexandre Ghiti
authored andcommitted
riscv: Change check_unaligned_access_speed_all_cpus to void
The return value of check_unaligned_access_speed_all_cpus() is always zero, so make the function void so we don't need to concern ourselves with it. The change also allows us to tidy up check_unaligned_access_all_cpus() a bit. Reviewed-by: Clément Léger <cleger@rivosinc.com> Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Link: https://lore.kernel.org/r/20250304120014.143628-14-ajones@ventanamicro.com Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
1 parent e6d0adf commit 813d39b

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

arch/riscv/kernel/unaligned_access_speed.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,15 @@ static int riscv_offline_cpu(unsigned int cpu)
218218
}
219219

220220
/* Measure unaligned access speed on all CPUs present at boot in parallel. */
221-
static int __init check_unaligned_access_speed_all_cpus(void)
221+
static void __init check_unaligned_access_speed_all_cpus(void)
222222
{
223223
unsigned int cpu;
224224
unsigned int cpu_count = num_possible_cpus();
225225
struct page **bufs = kcalloc(cpu_count, sizeof(*bufs), GFP_KERNEL);
226226

227227
if (!bufs) {
228228
pr_warn("Allocation failure, not measuring misaligned performance\n");
229-
return 0;
229+
return;
230230
}
231231

232232
/*
@@ -261,12 +261,10 @@ static int __init check_unaligned_access_speed_all_cpus(void)
261261
}
262262

263263
kfree(bufs);
264-
return 0;
265264
}
266265
#else /* CONFIG_RISCV_PROBE_UNALIGNED_ACCESS */
267-
static int __init check_unaligned_access_speed_all_cpus(void)
266+
static void __init check_unaligned_access_speed_all_cpus(void)
268267
{
269-
return 0;
270268
}
271269
#endif
272270

@@ -403,10 +401,10 @@ static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __alway
403401

404402
static int __init check_unaligned_access_all_cpus(void)
405403
{
406-
bool all_cpus_emulated;
407404
int cpu;
408405

409-
all_cpus_emulated = check_unaligned_access_emulated_all_cpus();
406+
if (!check_unaligned_access_emulated_all_cpus())
407+
check_unaligned_access_speed_all_cpus();
410408

411409
if (!has_vector()) {
412410
for_each_online_cpu(cpu)
@@ -417,9 +415,6 @@ static int __init check_unaligned_access_all_cpus(void)
417415
NULL, "vec_check_unaligned_access_speed_all_cpus");
418416
}
419417

420-
if (!all_cpus_emulated)
421-
return check_unaligned_access_speed_all_cpus();
422-
423418
return 0;
424419
}
425420

0 commit comments

Comments
 (0)