Commit f5d6c63a67a8f124ddae88511427249d1dd87880

Authored by Ralf Baechle
1 parent 1275361c40

[MIPS] Do topology_init even on uniprocessor kernels.

Otherwise CPU 0 doesn't show up in sysfs which breaks some software.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

Showing 3 changed files with 30 additions and 24 deletions Side-by-side Diff

arch/mips/kernel/Makefile
... ... @@ -6,7 +6,7 @@
6 6  
7 7 obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
8 8 ptrace.o reset.o semaphore.o setup.o signal.o syscall.o \
9   - time.o traps.o unaligned.o
  9 + time.o topology.o traps.o unaligned.o
10 10  
11 11 binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \
12 12 irix5sys.o sysirix.o
arch/mips/kernel/smp.c
... ... @@ -463,29 +463,6 @@
463 463 smp_on_each_tlb(flush_tlb_one_ipi, (void *) vaddr);
464 464 }
465 465  
466   -static DEFINE_PER_CPU(struct cpu, cpu_devices);
467   -
468   -static int __init topology_init(void)
469   -{
470   - int i, ret;
471   -
472   -#ifdef CONFIG_NUMA
473   - for_each_online_node(i)
474   - register_one_node(i);
475   -#endif /* CONFIG_NUMA */
476   -
477   - for_each_present_cpu(i) {
478   - ret = register_cpu(&per_cpu(cpu_devices, i), i);
479   - if (ret)
480   - printk(KERN_WARNING "topology_init: register_cpu %d "
481   - "failed (%d)\n", i, ret);
482   - }
483   -
484   - return 0;
485   -}
486   -
487   -subsys_initcall(topology_init);
488   -
489 466 EXPORT_SYMBOL(flush_tlb_page);
490 467 EXPORT_SYMBOL(flush_tlb_one);
arch/mips/kernel/topology.c
  1 +#include <linux/cpu.h>
  2 +#include <linux/cpumask.h>
  3 +#include <linux/init.h>
  4 +#include <linux/node.h>
  5 +#include <linux/nodemask.h>
  6 +#include <linux/percpu.h>
  7 +
  8 +static DEFINE_PER_CPU(struct cpu, cpu_devices);
  9 +
  10 +static int __init topology_init(void)
  11 +{
  12 + int i, ret;
  13 +
  14 +#ifdef CONFIG_NUMA
  15 + for_each_online_node(i)
  16 + register_one_node(i);
  17 +#endif /* CONFIG_NUMA */
  18 +
  19 + for_each_present_cpu(i) {
  20 + ret = register_cpu(&per_cpu(cpu_devices, i), i);
  21 + if (ret)
  22 + printk(KERN_WARNING "topology_init: register_cpu %d "
  23 + "failed (%d)\n", i, ret);
  24 + }
  25 +
  26 + return 0;
  27 +}
  28 +
  29 +subsys_initcall(topology_init);