Skip to content

Commit

Permalink
module: reorder module pcpu related functions
Browse files Browse the repository at this point in the history
Impact: cleanup

Move percpu_modinit() upwards.  This is to ease further changes.

Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Tejun Heo committed Feb 20, 2009
1 parent 7342695 commit 6b588c1
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,21 +480,6 @@ static void percpu_modfree(void *freeme)
}
}

static unsigned int find_pcpusec(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
const char *secstrings)
{
return find_sec(hdr, sechdrs, secstrings, ".data.percpu");
}

static void percpu_modcopy(void *pcpudest, const void *from, unsigned long size)
{
int cpu;

for_each_possible_cpu(cpu)
memcpy(pcpudest + per_cpu_offset(cpu), from, size);
}

static int percpu_modinit(void)
{
pcpu_num_used = 2;
Expand All @@ -513,7 +498,24 @@ static int percpu_modinit(void)
return 0;
}
__initcall(percpu_modinit);

static unsigned int find_pcpusec(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
const char *secstrings)
{
return find_sec(hdr, sechdrs, secstrings, ".data.percpu");
}

static void percpu_modcopy(void *pcpudest, const void *from, unsigned long size)
{
int cpu;

for_each_possible_cpu(cpu)
memcpy(pcpudest + per_cpu_offset(cpu), from, size);
}

#else /* ... !CONFIG_SMP */

static inline void *percpu_modalloc(unsigned long size, unsigned long align,
const char *name)
{
Expand All @@ -535,6 +537,7 @@ static inline void percpu_modcopy(void *pcpudst, const void *src,
/* pcpusec should be 0, and size of that section should be 0. */
BUG_ON(size != 0);
}

#endif /* CONFIG_SMP */

#define MODINFO_ATTR(field) \
Expand Down

0 comments on commit 6b588c1

Please sign in to comment.