mm/memory_hotplug: make add_memory() take the device_hotplug_lock
[linux-2.6-block.git] / drivers / base / memory.c
index 817320c7c4c1b72cf248b73a184bc8dee6ef28ac..40cac122ec73cae0a5ebc3006f446a442c39365e 100644 (file)
@@ -519,15 +519,20 @@ memory_probe_store(struct device *dev, struct device_attribute *attr,
        if (phys_addr & ((pages_per_block << PAGE_SHIFT) - 1))
                return -EINVAL;
 
+       ret = lock_device_hotplug_sysfs();
+       if (ret)
+               goto out;
+
        nid = memory_add_physaddr_to_nid(phys_addr);
-       ret = add_memory(nid, phys_addr,
-                        MIN_MEMORY_BLOCK_SIZE * sections_per_block);
+       ret = __add_memory(nid, phys_addr,
+                          MIN_MEMORY_BLOCK_SIZE * sections_per_block);
 
        if (ret)
                goto out;
 
        ret = count;
 out:
+       unlock_device_hotplug();
        return ret;
 }