Skip to content

Commit

Permalink
Driver core / MM: Drop offline_memory_block()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rafael J. Wysocki committed Jun 1, 2013
1 parent be54743 commit ea50be5
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 23 deletions.
21 changes: 0 additions & 21 deletions drivers/base/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 0 additions & 1 deletion include/linux/memory_hotplug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ea50be5

Please sign in to comment.