diff options
author | Andi Kleen <andi@firstfloor.org> | 2008-07-01 12:48:41 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-22 00:55:02 -0400 |
commit | 4a0b2b4dbe1335b8b9886ba3dc85a145d5d938ed (patch) | |
tree | c2d3a0f86ade5061a1bb9a14aa702323d729fd54 /drivers/base/memory.c | |
parent | 36ce6dad6e3cb3f050ed41e0beac0070d2062b25 (diff) |
sysdev: Pass the attribute to the low level sysdev show/store function
This allow to dynamically generate attributes and share show/store
functions between attributes. Right now most attributes are generated
by special macros and lots of duplicated code. With the attribute
passed it's instead possible to attach some data to the attribute
and then use that in shared low level functions to do different things.
I need this for the dynamically generated bank attributes in the x86
machine check code, but it'll allow some further cleanups.
I converted all users in tree to the new show/store prototype. It's a single
huge patch to avoid unbisectable sections.
Runtime tested: x86-32, x86-64
Compiled only: ia64, powerpc
Not compile tested/only grep converted: sh, arm, avr32
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/memory.c')
-rw-r--r-- | drivers/base/memory.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 937e8258981d..4d4e0e7b6e92 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -92,7 +92,8 @@ unregister_memory(struct memory_block *memory, struct mem_section *section) | |||
92 | * uses. | 92 | * uses. |
93 | */ | 93 | */ |
94 | 94 | ||
95 | static ssize_t show_mem_phys_index(struct sys_device *dev, char *buf) | 95 | static ssize_t show_mem_phys_index(struct sys_device *dev, |
96 | struct sysdev_attribute *attr, char *buf) | ||
96 | { | 97 | { |
97 | struct memory_block *mem = | 98 | struct memory_block *mem = |
98 | container_of(dev, struct memory_block, sysdev); | 99 | container_of(dev, struct memory_block, sysdev); |
@@ -102,7 +103,8 @@ static ssize_t show_mem_phys_index(struct sys_device *dev, char *buf) | |||
102 | /* | 103 | /* |
103 | * online, offline, going offline, etc. | 104 | * online, offline, going offline, etc. |
104 | */ | 105 | */ |
105 | static ssize_t show_mem_state(struct sys_device *dev, char *buf) | 106 | static ssize_t show_mem_state(struct sys_device *dev, |
107 | struct sysdev_attribute *attr, char *buf) | ||
106 | { | 108 | { |
107 | struct memory_block *mem = | 109 | struct memory_block *mem = |
108 | container_of(dev, struct memory_block, sysdev); | 110 | container_of(dev, struct memory_block, sysdev); |
@@ -217,7 +219,8 @@ out: | |||
217 | } | 219 | } |
218 | 220 | ||
219 | static ssize_t | 221 | static ssize_t |
220 | store_mem_state(struct sys_device *dev, const char *buf, size_t count) | 222 | store_mem_state(struct sys_device *dev, |
223 | struct sysdev_attribute *attr, const char *buf, size_t count) | ||
221 | { | 224 | { |
222 | struct memory_block *mem; | 225 | struct memory_block *mem; |
223 | unsigned int phys_section_nr; | 226 | unsigned int phys_section_nr; |
@@ -248,7 +251,8 @@ out: | |||
248 | * s.t. if I offline all of these sections I can then | 251 | * s.t. if I offline all of these sections I can then |
249 | * remove the physical device? | 252 | * remove the physical device? |
250 | */ | 253 | */ |
251 | static ssize_t show_phys_device(struct sys_device *dev, char *buf) | 254 | static ssize_t show_phys_device(struct sys_device *dev, |
255 | struct sysdev_attribute *attr, char *buf) | ||
252 | { | 256 | { |
253 | struct memory_block *mem = | 257 | struct memory_block *mem = |
254 | container_of(dev, struct memory_block, sysdev); | 258 | container_of(dev, struct memory_block, sysdev); |