Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/rtas: Add for_each_rtas_function() iterator

Add a convenience macro for iterating over every element of the
internal function table and convert the one site that can use it. An
additional user of the macro is anticipated in changes to follow.

Reviewed-by: "Aneesh Kumar K.V (IBM)" <aneesh.kumar@kernel.org>
Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231212-papr-sys_rtas-vs-lockdown-v6-2-e9eafd0c8c6c@linux.ibm.com

authored by

Nathan Lynch and committed by
Michael Ellerman
c500c6e7 01e346ff

+7 -2
+7 -2
arch/powerpc/kernel/rtas.c
··· 454 454 }, 455 455 }; 456 456 457 + #define for_each_rtas_function(funcp) \ 458 + for (funcp = &rtas_function_table[0]; \ 459 + funcp < &rtas_function_table[ARRAY_SIZE(rtas_function_table)]; \ 460 + ++funcp) 461 + 457 462 /* 458 463 * Nearly all RTAS calls need to be serialized. All uses of the 459 464 * default rtas_args block must hold rtas_lock. ··· 530 525 531 526 static int __init rtas_token_to_function_xarray_init(void) 532 527 { 528 + const struct rtas_function *func; 533 529 int err = 0; 534 530 535 - for (size_t i = 0; i < ARRAY_SIZE(rtas_function_table); ++i) { 536 - const struct rtas_function *func = &rtas_function_table[i]; 531 + for_each_rtas_function(func) { 537 532 const s32 token = func->token; 538 533 539 534 if (token == RTAS_UNKNOWN_SERVICE)