]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/base/cpu.c
Merge branches 'x86-boot-for-linus' and 'x86-cleanups-for-linus' of git://git.kernel...
[karo-tx-linux.git] / drivers / base / cpu.c
index 4c358bc44c72b1082d5576ed2ba6a93415b00563..848ebbd25717269fa0ef34e1632e502eb29f4aeb 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/slab.h>
 #include <linux/percpu.h>
 #include <linux/acpi.h>
+#include <linux/of.h>
 
 #include "base.h"
 
@@ -43,11 +44,14 @@ static int __ref cpu_subsys_online(struct device *dev)
        struct cpu *cpu = container_of(dev, struct cpu, dev);
        int cpuid = dev->id;
        int from_nid, to_nid;
-       int ret;
+       int ret = -ENODEV;
 
        cpu_hotplug_driver_lock();
 
        from_nid = cpu_to_node(cpuid);
+       if (from_nid == NUMA_NO_NODE)
+               goto out;
+
        ret = cpu_up(cpuid);
        /*
         * When hot adding memory to memoryless node and enabling a cpu
@@ -57,6 +61,7 @@ static int __ref cpu_subsys_online(struct device *dev)
        if (from_nid != to_nid)
                change_cpu_under_node(cpu, from_nid, to_nid);
 
+ out:
        cpu_hotplug_driver_unlock();
        return ret;
 }
@@ -289,6 +294,7 @@ int register_cpu(struct cpu *cpu, int num)
        cpu->dev.release = cpu_device_release;
        cpu->dev.offline_disabled = !cpu->hotpluggable;
        cpu->dev.offline = !cpu_online(num);
+       cpu->dev.of_node = of_get_cpu_node(num, NULL);
 #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
        cpu->dev.bus->uevent = arch_cpu_uevent;
 #endif