Commit 6b588c18f8dacfa6d7957c33c5ff832096e752d3
1 parent
734269521e
Exists in
master
and in
20 other branches
module: reorder module pcpu related functions
Impact: cleanup Move percpu_modinit() upwards. This is to ease further changes. Signed-off-by: Tejun Heo <tj@kernel.org>
Showing 1 changed file with 18 additions and 15 deletions Side-by-side Diff
kernel/module.c
... | ... | @@ -480,21 +480,6 @@ |
480 | 480 | } |
481 | 481 | } |
482 | 482 | |
483 | -static unsigned int find_pcpusec(Elf_Ehdr *hdr, | |
484 | - Elf_Shdr *sechdrs, | |
485 | - const char *secstrings) | |
486 | -{ | |
487 | - return find_sec(hdr, sechdrs, secstrings, ".data.percpu"); | |
488 | -} | |
489 | - | |
490 | -static void percpu_modcopy(void *pcpudest, const void *from, unsigned long size) | |
491 | -{ | |
492 | - int cpu; | |
493 | - | |
494 | - for_each_possible_cpu(cpu) | |
495 | - memcpy(pcpudest + per_cpu_offset(cpu), from, size); | |
496 | -} | |
497 | - | |
498 | 483 | static int percpu_modinit(void) |
499 | 484 | { |
500 | 485 | pcpu_num_used = 2; |
501 | 486 | |
... | ... | @@ -513,7 +498,24 @@ |
513 | 498 | return 0; |
514 | 499 | } |
515 | 500 | __initcall(percpu_modinit); |
501 | + | |
502 | +static unsigned int find_pcpusec(Elf_Ehdr *hdr, | |
503 | + Elf_Shdr *sechdrs, | |
504 | + const char *secstrings) | |
505 | +{ | |
506 | + return find_sec(hdr, sechdrs, secstrings, ".data.percpu"); | |
507 | +} | |
508 | + | |
509 | +static void percpu_modcopy(void *pcpudest, const void *from, unsigned long size) | |
510 | +{ | |
511 | + int cpu; | |
512 | + | |
513 | + for_each_possible_cpu(cpu) | |
514 | + memcpy(pcpudest + per_cpu_offset(cpu), from, size); | |
515 | +} | |
516 | + | |
516 | 517 | #else /* ... !CONFIG_SMP */ |
518 | + | |
517 | 519 | static inline void *percpu_modalloc(unsigned long size, unsigned long align, |
518 | 520 | const char *name) |
519 | 521 | { |
... | ... | @@ -535,6 +537,7 @@ |
535 | 537 | /* pcpusec should be 0, and size of that section should be 0. */ |
536 | 538 | BUG_ON(size != 0); |
537 | 539 | } |
540 | + | |
538 | 541 | #endif /* CONFIG_SMP */ |
539 | 542 | |
540 | 543 | #define MODINFO_ATTR(field) \ |