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 /kernel | |
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 'kernel')
-rw-r--r-- | kernel/perf_event.c | 13 | ||||
-rw-r--r-- | kernel/sched.c | 4 |
2 files changed, 14 insertions, 3 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 8e352c756ba..f40560b8654 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -5481,13 +5481,16 @@ void __init perf_event_init(void) | |||
5481 | register_cpu_notifier(&perf_cpu_nb); | 5481 | register_cpu_notifier(&perf_cpu_nb); |
5482 | } | 5482 | } |
5483 | 5483 | ||
5484 | static ssize_t perf_show_reserve_percpu(struct sysdev_class *class, char *buf) | 5484 | static ssize_t perf_show_reserve_percpu(struct sysdev_class *class, |
5485 | struct sysdev_class_attribute *attr, | ||
5486 | char *buf) | ||
5485 | { | 5487 | { |
5486 | return sprintf(buf, "%d\n", perf_reserved_percpu); | 5488 | return sprintf(buf, "%d\n", perf_reserved_percpu); |
5487 | } | 5489 | } |
5488 | 5490 | ||
5489 | static ssize_t | 5491 | static ssize_t |
5490 | perf_set_reserve_percpu(struct sysdev_class *class, | 5492 | perf_set_reserve_percpu(struct sysdev_class *class, |
5493 | struct sysdev_class_attribute *attr, | ||
5491 | const char *buf, | 5494 | const char *buf, |
5492 | size_t count) | 5495 | size_t count) |
5493 | { | 5496 | { |
@@ -5516,13 +5519,17 @@ perf_set_reserve_percpu(struct sysdev_class *class, | |||
5516 | return count; | 5519 | return count; |
5517 | } | 5520 | } |
5518 | 5521 | ||
5519 | static ssize_t perf_show_overcommit(struct sysdev_class *class, char *buf) | 5522 | static ssize_t perf_show_overcommit(struct sysdev_class *class, |
5523 | struct sysdev_class_attribute *attr, | ||
5524 | char *buf) | ||
5520 | { | 5525 | { |
5521 | return sprintf(buf, "%d\n", perf_overcommit); | 5526 | return sprintf(buf, "%d\n", perf_overcommit); |
5522 | } | 5527 | } |
5523 | 5528 | ||
5524 | static ssize_t | 5529 | static ssize_t |
5525 | perf_set_overcommit(struct sysdev_class *class, const char *buf, size_t count) | 5530 | perf_set_overcommit(struct sysdev_class *class, |
5531 | struct sysdev_class_attribute *attr, | ||
5532 | const char *buf, size_t count) | ||
5526 | { | 5533 | { |
5527 | unsigned long val; | 5534 | unsigned long val; |
5528 | int err; | 5535 | int err; |
diff --git a/kernel/sched.c b/kernel/sched.c index b47ceeec1a9..150b6988de4 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -7406,11 +7406,13 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt) | |||
7406 | 7406 | ||
7407 | #ifdef CONFIG_SCHED_MC | 7407 | #ifdef CONFIG_SCHED_MC |
7408 | static ssize_t sched_mc_power_savings_show(struct sysdev_class *class, | 7408 | static ssize_t sched_mc_power_savings_show(struct sysdev_class *class, |
7409 | struct sysdev_class_attribute *attr, | ||
7409 | char *page) | 7410 | char *page) |
7410 | { | 7411 | { |
7411 | return sprintf(page, "%u\n", sched_mc_power_savings); | 7412 | return sprintf(page, "%u\n", sched_mc_power_savings); |
7412 | } | 7413 | } |
7413 | static ssize_t sched_mc_power_savings_store(struct sysdev_class *class, | 7414 | static ssize_t sched_mc_power_savings_store(struct sysdev_class *class, |
7415 | struct sysdev_class_attribute *attr, | ||
7414 | const char *buf, size_t count) | 7416 | const char *buf, size_t count) |
7415 | { | 7417 | { |
7416 | return sched_power_savings_store(buf, count, 0); | 7418 | return sched_power_savings_store(buf, count, 0); |
@@ -7422,11 +7424,13 @@ static SYSDEV_CLASS_ATTR(sched_mc_power_savings, 0644, | |||
7422 | 7424 | ||
7423 | #ifdef CONFIG_SCHED_SMT | 7425 | #ifdef CONFIG_SCHED_SMT |
7424 | static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev, | 7426 | static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev, |
7427 | struct sysdev_class_attribute *attr, | ||
7425 | char *page) | 7428 | char *page) |
7426 | { | 7429 | { |
7427 | return sprintf(page, "%u\n", sched_smt_power_savings); | 7430 | return sprintf(page, "%u\n", sched_smt_power_savings); |
7428 | } | 7431 | } |
7429 | static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev, | 7432 | static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev, |
7433 | struct sysdev_class_attribute *attr, | ||
7430 | const char *buf, size_t count) | 7434 | const char *buf, size_t count) |
7431 | { | 7435 | { |
7432 | return sched_power_savings_store(buf, count, 1); | 7436 | return sched_power_savings_store(buf, count, 1); |