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.

module: remove each_symbol_in_section

each_symbol_in_section just contains a trivial loop over its arguments.
Just open code the loop in the two callers.

Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>

authored by

Christoph Hellwig and committed by
Jessica Yu
a7c38f2c 922f2a7c

+7 -22
+7 -22
kernel/module.c
··· 428 428 #define symversion(base, idx) ((base != NULL) ? ((base) + (idx)) : NULL) 429 429 #endif 430 430 431 - static bool each_symbol_in_section(const struct symsearch *arr, 432 - unsigned int arrsize, 433 - struct module *owner, 434 - bool (*fn)(const struct symsearch *syms, 435 - struct module *owner, 436 - void *data), 437 - void *data) 438 - { 439 - unsigned int j; 440 - 441 - for (j = 0; j < arrsize; j++) { 442 - if (fn(&arr[j], owner, data)) 443 - return true; 444 - } 445 - 446 - return false; 447 - } 448 - 449 431 /* Returns true as soon as fn returns true, otherwise false. */ 450 432 static bool each_symbol_section(bool (*fn)(const struct symsearch *arr, 451 433 struct module *owner, 452 434 void *data), 453 435 void *data) 454 436 { 437 + unsigned int i; 455 438 struct module *mod; 456 439 static const struct symsearch arr[] = { 457 440 { __start___ksymtab, __stop___ksymtab, __start___kcrctab, ··· 457 474 458 475 module_assert_mutex_or_preempt(); 459 476 460 - if (each_symbol_in_section(arr, ARRAY_SIZE(arr), NULL, fn, data)) 461 - return true; 477 + for (i = 0; i < ARRAY_SIZE(arr); i++) 478 + if (fn(&arr[i], NULL, data)) 479 + return true; 462 480 463 481 list_for_each_entry_rcu(mod, &modules, list, 464 482 lockdep_is_held(&module_mutex)) { ··· 488 504 if (mod->state == MODULE_STATE_UNFORMED) 489 505 continue; 490 506 491 - if (each_symbol_in_section(arr, ARRAY_SIZE(arr), mod, fn, data)) 492 - return true; 507 + for (i = 0; i < ARRAY_SIZE(arr); i++) 508 + if (fn(&arr[i], mod, data)) 509 + return true; 493 510 } 494 511 return false; 495 512 }