History

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.

Christoph Hellwig committed 5 years ago

Commit a7c38f21 parent 922f2a71 file · +7 −22Browse files

Unified · Split

kernel/module.c+7−22
@@ -428,30 +428,13 @@ extern const s32 __start___kcrctab_unused_gpl[]; · 427 unmodified lines
428428 #define symversion(base, idx) ((base != NULL) ? ((base) + (idx)) : NULL)
429429 #endif
430430
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−
449431 /* Returns true as soon as fn returns true, otherwise false. */
450432 static bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
451433 struct module *owner,
452434 void *data),
453435 void *data)
454436 {
437+ unsigned int i;
455438 struct module *mod;
456439 static const struct symsearch arr[] = {
457440 { __start___ksymtab, __stop___ksymtab, __start___kcrctab,
@@ -474,8 +457,9 @@ static bool each_symbol_section(bool (*fn)(const struct symsearch *arr, · 16 unmodified lines
474457
475458 module_assert_mutex_or_preempt();
476459
477− if (each_symbol_in_section(arr, ARRAY_SIZE(arr), NULL, fn, data))
478− return true;
460+ for (i = 0; i < ARRAY_SIZE(arr); i++)
461+ if (fn(&arr[i], NULL, data))
462+ return true;
479463
480464 list_for_each_entry_rcu(mod, &modules, list,
481465 lockdep_is_held(&module_mutex)) {
@@ -504,8 +488,9 @@ static bool each_symbol_section(bool (*fn)(const struct symsearch *arr, · 22 unmodified lines
504488 if (mod->state == MODULE_STATE_UNFORMED)
505489 continue;
506490
507− if (each_symbol_in_section(arr, ARRAY_SIZE(arr), mod, fn, data))
508− return true;
491+ for (i = 0; i < ARRAY_SIZE(arr); i++)
492+ if (fn(&arr[i], mod, data))
493+ return true;
509494 }
510495 return false;
511496 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t