diff options
author | Seth Jennings <sjenning@linux.vnet.ibm.com> | 2013-08-20 17:05:05 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-21 14:52:20 -0400 |
commit | fa2be40fe7c0aa3b7accbf6dfa9ef0976e191d4c (patch) | |
tree | a51ae32d86315a68029a65fe028a2ade240050df /include/linux/memory.h | |
parent | cb5e39b8038be913030a7b01d4396cfa5f9ded7b (diff) |
drivers: base: use standard device online/offline for state change
There are two ways to set the online/offline state for a memory block:
echo 0|1 > online and echo online|online_kernel|online_movable|offline >
state.
The state attribute can online a memory block with extra data, the
"online type", where the online attribute uses a default online type of
ONLINE_KEEP, same as echo online > state.
Currently there is a state_mutex that provides consistency between the
memory block state and the underlying memory.
The problem is that this code does a lot of things that the common
device layer can do for us, such as the serialization of the
online/offline handlers using the device lock, setting the dev->offline
field, and calling kobject_uevent().
This patch refactors the online/offline code to allow the common
device_[online|offline] functions to be used. The result is a simpler
and more common code path for the two state setting mechanisms. It also
removes the state_mutex from the struct memory_block as the memory block
device lock provides the state consistency.
No functional change is intended by this patch.
Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/memory.h')
-rw-r--r-- | include/linux/memory.h | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/include/linux/memory.h b/include/linux/memory.h index 4c89fb0c8f4c..9a6bbf76452d 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
@@ -25,16 +25,9 @@ | |||
25 | struct memory_block { | 25 | struct memory_block { |
26 | unsigned long start_section_nr; | 26 | unsigned long start_section_nr; |
27 | unsigned long end_section_nr; | 27 | unsigned long end_section_nr; |
28 | unsigned long state; | 28 | unsigned long state; /* serialized by the dev->lock */ |
29 | int section_count; | 29 | int section_count; /* serialized by mem_sysfs_mutex */ |
30 | 30 | int online_type; /* for passing data to online routine */ | |
31 | /* | ||
32 | * This serializes all state change requests. It isn't | ||
33 | * held during creation because the control files are | ||
34 | * created long after the critical areas during | ||
35 | * initialization. | ||
36 | */ | ||
37 | struct mutex state_mutex; | ||
38 | int phys_device; /* to which fru does this belong? */ | 31 | int phys_device; /* to which fru does this belong? */ |
39 | void *hw; /* optional pointer to fw/hw data */ | 32 | void *hw; /* optional pointer to fw/hw data */ |
40 | int (*phys_callback)(struct memory_block *); | 33 | int (*phys_callback)(struct memory_block *); |