each_symbol_in_section just contains a trivial loop over its arguments. Just open code the loop in the two callers.
Unified · Split
| @@ -428,30 +428,13 @@ extern const s32 __start___kcrctab_unused_gpl[]; · 427 unmodified lines | |||
| 428 | #define symversion(base, idx) ((base != NULL) ? ((base) + (idx)) : NULL) | 428 | #define symversion(base, idx) ((base != NULL) ? ((base) + (idx)) : NULL) |
| 429 | #endif | 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 | /* Returns true as soon as fn returns true, otherwise false. */ | 431 | /* Returns true as soon as fn returns true, otherwise false. */ |
| 450 | static bool each_symbol_section(bool (*fn)(const struct symsearch *arr, | 432 | static bool each_symbol_section(bool (*fn)(const struct symsearch *arr, |
| 451 | struct module *owner, | 433 | struct module *owner, |
| 452 | void *data), | 434 | void *data), |
| 453 | void *data) | 435 | void *data) |
| 454 | { | 436 | { |
| 437 | unsigned int i; | ||
| 455 | struct module *mod; | 438 | struct module *mod; |
| 456 | static const struct symsearch arr[] = { | 439 | static const struct symsearch arr[] = { |
| 457 | { __start___ksymtab, __stop___ksymtab, __start___kcrctab, | 440 | { __start___ksymtab, __stop___ksymtab, __start___kcrctab, |
| @@ -474,8 +457,9 @@ static bool each_symbol_section(bool (*fn)(const struct symsearch *arr, · 16 unmodified lines | |||
| 474 | 457 | ||
| 475 | module_assert_mutex_or_preempt(); | 458 | module_assert_mutex_or_preempt(); |
| 476 | 459 | ||
| 477 | if (each_symbol_in_section(arr, ARRAY_SIZE(arr), NULL, fn, data)) | 460 | for (i = 0; i < ARRAY_SIZE(arr); i++) |
| 478 | return true; | 461 | if (fn(&arr[i], NULL, data)) |
| 462 | return true; | ||
| 479 | 463 | ||
| 480 | list_for_each_entry_rcu(mod, &modules, list, | 464 | list_for_each_entry_rcu(mod, &modules, list, |
| 481 | lockdep_is_held(&module_mutex)) { | 465 | lockdep_is_held(&module_mutex)) { |
| @@ -504,8 +488,9 @@ static bool each_symbol_section(bool (*fn)(const struct symsearch *arr, · 22 unmodified lines | |||
| 504 | if (mod->state == MODULE_STATE_UNFORMED) | 488 | if (mod->state == MODULE_STATE_UNFORMED) |
| 505 | continue; | 489 | continue; |
| 506 | 490 | ||
| 507 | if (each_symbol_in_section(arr, ARRAY_SIZE(arr), mod, fn, data)) | 491 | for (i = 0; i < ARRAY_SIZE(arr); i++) |
| 508 | return true; | 492 | if (fn(&arr[i], mod, data)) |
| 493 | return true; | ||
| 509 | } | 494 | } |
| 510 | return false; | 495 | return false; |
| 511 | } | 496 | } |