summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/memory.c21
-rw-r--r--include/linux/memory_hotplug.h1
-rw-r--r--mm/memory_hotplug.c2
3 files changed, 1 insertions, 23 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index c7092bc3c01e..4ebf97f99fae 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -728,27 +728,6 @@ int unregister_memory_section(struct mem_section *section)
}
#endif /* CONFIG_MEMORY_HOTREMOVE */
-/*
- * offline one memory block. If the memory block has been offlined, do nothing.
- *
- * Call under device_hotplug_lock.
- */
-int offline_memory_block(struct memory_block *mem)
-{
- int ret = 0;
-
- mutex_lock(&mem->state_mutex);
- if (mem->state != MEM_OFFLINE) {
- ret = __memory_block_change_state_uevent(mem, MEM_OFFLINE,
- MEM_ONLINE, -1);
- if (!ret)
- mem->dev.offline = true;
- }
- mutex_unlock(&mem->state_mutex);
-
- return ret;
-}
-
/* return true if the memory block is offlined, otherwise, return false */
bool is_memblock_offlined(struct memory_block *mem)
{
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 2975b7b2a9d8..ae5480a00963 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -251,7 +251,6 @@ extern int mem_online_node(int nid);
extern int add_memory(int nid, u64 start, u64 size);
extern int arch_add_memory(int nid, u64 start, u64 size);
extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
-extern int offline_memory_block(struct memory_block *mem);
extern bool is_memblock_offlined(struct memory_block *mem);
extern int remove_memory(int nid, u64 start, u64 size);
extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 5ea1287ee91f..a39841d240e8 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1680,7 +1680,7 @@ int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
static int offline_memory_block_cb(struct memory_block *mem, void *arg)
{
int *ret = arg;
- int error = offline_memory_block(mem);
+ int error = device_offline(&mem->dev);
if (error != 0 && *ret == 0)
*ret = error;