diff options
author | Tejun Heo <tj@kernel.org> | 2009-02-20 02:29:07 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-02-20 02:29:07 -0500 |
commit | 6b588c18f8dacfa6d7957c33c5ff832096e752d3 (patch) | |
tree | c59c2f1719ce9d4bc23e85b4f205772a61944530 /kernel/module.c | |
parent | 734269521e320ad14ed39ae9b64d482b9028dcd2 (diff) |
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>
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/kernel/module.c b/kernel/module.c index ba22484a987e..52b3497b8748 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -480,21 +480,6 @@ static void percpu_modfree(void *freeme) | |||
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 | static int percpu_modinit(void) | 483 | static int percpu_modinit(void) |
499 | { | 484 | { |
500 | pcpu_num_used = 2; | 485 | pcpu_num_used = 2; |
@@ -513,7 +498,24 @@ static int percpu_modinit(void) | |||
513 | return 0; | 498 | return 0; |
514 | } | 499 | } |
515 | __initcall(percpu_modinit); | 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 | #else /* ... !CONFIG_SMP */ | 517 | #else /* ... !CONFIG_SMP */ |
518 | |||
517 | static inline void *percpu_modalloc(unsigned long size, unsigned long align, | 519 | static inline void *percpu_modalloc(unsigned long size, unsigned long align, |
518 | const char *name) | 520 | const char *name) |
519 | { | 521 | { |
@@ -535,6 +537,7 @@ static inline void percpu_modcopy(void *pcpudst, const void *src, | |||
535 | /* pcpusec should be 0, and size of that section should be 0. */ | 537 | /* pcpusec should be 0, and size of that section should be 0. */ |
536 | BUG_ON(size != 0); | 538 | BUG_ON(size != 0); |
537 | } | 539 | } |
540 | |||
538 | #endif /* CONFIG_SMP */ | 541 | #endif /* CONFIG_SMP */ |
539 | 542 | ||
540 | #define MODINFO_ATTR(field) \ | 543 | #define MODINFO_ATTR(field) \ |