diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-05-23 04:41:50 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-01 15:37:10 -0400 |
commit | ea50be59345a2b714fd3ed43e1bba89906c177c3 (patch) | |
tree | c0c4b5def84b9b03143cdd2bd28e15b7632038b9 | |
parent | be547436c22c3b7d934d9afd841cfd7a6807f7ab (diff) |
Driver core / MM: Drop offline_memory_block()
Since offline_memory_block(mem) is functionally equivalent to
device_offline(&mem->dev), make the only caller of the former use
the latter instead and drop offline_memory_block() entirely.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Toshi Kani <toshi.kani@hp.com>
-rw-r--r-- | drivers/base/memory.c | 21 | ||||
-rw-r--r-- | include/linux/memory_hotplug.h | 1 | ||||
-rw-r--r-- | mm/memory_hotplug.c | 2 |
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) | |||
728 | } | 728 | } |
729 | #endif /* CONFIG_MEMORY_HOTREMOVE */ | 729 | #endif /* CONFIG_MEMORY_HOTREMOVE */ |
730 | 730 | ||
731 | /* | ||
732 | * offline one memory block. If the memory block has been offlined, do nothing. | ||
733 | * | ||
734 | * Call under device_hotplug_lock. | ||
735 | */ | ||
736 | int offline_memory_block(struct memory_block *mem) | ||
737 | { | ||
738 | int ret = 0; | ||
739 | |||
740 | mutex_lock(&mem->state_mutex); | ||
741 | if (mem->state != MEM_OFFLINE) { | ||
742 | ret = __memory_block_change_state_uevent(mem, MEM_OFFLINE, | ||
743 | MEM_ONLINE, -1); | ||
744 | if (!ret) | ||
745 | mem->dev.offline = true; | ||
746 | } | ||
747 | mutex_unlock(&mem->state_mutex); | ||
748 | |||
749 | return ret; | ||
750 | } | ||
751 | |||
752 | /* return true if the memory block is offlined, otherwise, return false */ | 731 | /* return true if the memory block is offlined, otherwise, return false */ |
753 | bool is_memblock_offlined(struct memory_block *mem) | 732 | bool is_memblock_offlined(struct memory_block *mem) |
754 | { | 733 | { |
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); | |||
251 | extern int add_memory(int nid, u64 start, u64 size); | 251 | extern int add_memory(int nid, u64 start, u64 size); |
252 | extern int arch_add_memory(int nid, u64 start, u64 size); | 252 | extern int arch_add_memory(int nid, u64 start, u64 size); |
253 | extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); | 253 | extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); |
254 | extern int offline_memory_block(struct memory_block *mem); | ||
255 | extern bool is_memblock_offlined(struct memory_block *mem); | 254 | extern bool is_memblock_offlined(struct memory_block *mem); |
256 | extern int remove_memory(int nid, u64 start, u64 size); | 255 | extern int remove_memory(int nid, u64 start, u64 size); |
257 | extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, | 256 | 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, | |||
1680 | static int offline_memory_block_cb(struct memory_block *mem, void *arg) | 1680 | static int offline_memory_block_cb(struct memory_block *mem, void *arg) |
1681 | { | 1681 | { |
1682 | int *ret = arg; | 1682 | int *ret = arg; |
1683 | int error = offline_memory_block(mem); | 1683 | int error = device_offline(&mem->dev); |
1684 | 1684 | ||
1685 | if (error != 0 && *ret == 0) | 1685 | if (error != 0 && *ret == 0) |
1686 | *ret = error; | 1686 | *ret = error; |