diff options
author | Andi Kleen <andi@firstfloor.org> | 2010-01-05 06:47:58 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-07 20:04:47 -0500 |
commit | c9be0a36f9bf392a7984473124a67a12964df11f (patch) | |
tree | 23fcf49f277d9a093b2b29831811219410ad7b05 /drivers/base/cpu.c | |
parent | 3d03ba4d1dd2246adff5a9ff1194a539b3bc05a7 (diff) |
sysdev: Pass attribute in sysdev_class attributes show/store
Passing the attribute to the low level IO functions allows all kinds
of cleanups, by sharing low level IO code without requiring
an own function for every piece of data.
Also drivers can extend the attributes with own data fields
and use that in the low level function.
Similar to sysdev_attributes and normal attributes.
This is a tree-wide sweep, converting everything in one go.
No functional changes in this patch other than passing the new
argument everywhere.
Tested on x86, the non x86 parts are uncompiled.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/cpu.c')
-rw-r--r-- | drivers/base/cpu.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 958bd1540c30..fd1b2f9b7b8f 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -151,7 +151,8 @@ static ssize_t print_cpus_map(char *buf, const struct cpumask *map) | |||
151 | } | 151 | } |
152 | 152 | ||
153 | #define print_cpus_func(type) \ | 153 | #define print_cpus_func(type) \ |
154 | static ssize_t print_cpus_##type(struct sysdev_class *class, char *buf) \ | 154 | static ssize_t print_cpus_##type(struct sysdev_class *class, \ |
155 | struct sysdev_class_attribute *attr, char *buf) \ | ||
155 | { \ | 156 | { \ |
156 | return print_cpus_map(buf, cpu_##type##_mask); \ | 157 | return print_cpus_map(buf, cpu_##type##_mask); \ |
157 | } \ | 158 | } \ |
@@ -165,7 +166,8 @@ print_cpus_func(present); | |||
165 | /* | 166 | /* |
166 | * Print values for NR_CPUS and offlined cpus | 167 | * Print values for NR_CPUS and offlined cpus |
167 | */ | 168 | */ |
168 | static ssize_t print_cpus_kernel_max(struct sysdev_class *class, char *buf) | 169 | static ssize_t print_cpus_kernel_max(struct sysdev_class *class, |
170 | struct sysdev_class_attribute *attr, char *buf) | ||
169 | { | 171 | { |
170 | int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1); | 172 | int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1); |
171 | return n; | 173 | return n; |
@@ -175,7 +177,8 @@ static SYSDEV_CLASS_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL); | |||
175 | /* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */ | 177 | /* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */ |
176 | unsigned int total_cpus; | 178 | unsigned int total_cpus; |
177 | 179 | ||
178 | static ssize_t print_cpus_offline(struct sysdev_class *class, char *buf) | 180 | static ssize_t print_cpus_offline(struct sysdev_class *class, |
181 | struct sysdev_class_attribute *attr, char *buf) | ||
179 | { | 182 | { |
180 | int n = 0, len = PAGE_SIZE-2; | 183 | int n = 0, len = PAGE_SIZE-2; |
181 | cpumask_var_t offline; | 184 | cpumask_var_t offline; |