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 | |
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>
-rw-r--r-- | arch/arm/kernel/time.c | 4 | ||||
-rw-r--r-- | arch/avr32/kernel/cpu.c | 38 | ||||
-rw-r--r-- | arch/ia64/kernel/err_inject.c | 22 | ||||
-rw-r--r-- | arch/powerpc/kernel/sysfs.c | 15 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/cbe_thermal.c | 45 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spu_base.c | 3 | ||||
-rw-r--r-- | arch/s390/kernel/smp.c | 36 | ||||
-rw-r--r-- | arch/s390/kernel/time.c | 35 | ||||
-rw-r--r-- | arch/sh/drivers/dma/dma-sysfs.c | 15 | ||||
-rw-r--r-- | arch/sparc64/kernel/sysfs.c | 16 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce_64.c | 14 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/therm_throt.c | 1 | ||||
-rw-r--r-- | arch/x86/kernel/microcode.c | 10 | ||||
-rw-r--r-- | drivers/base/cpu.c | 10 | ||||
-rw-r--r-- | drivers/base/memory.c | 12 | ||||
-rw-r--r-- | drivers/base/node.c | 15 | ||||
-rw-r--r-- | drivers/base/sys.c | 4 | ||||
-rw-r--r-- | drivers/base/topology.c | 17 | ||||
-rw-r--r-- | drivers/cpuidle/sysfs.c | 10 | ||||
-rw-r--r-- | drivers/xen/balloon.c | 1 | ||||
-rw-r--r-- | include/linux/sysdev.h | 5 | ||||
-rw-r--r-- | kernel/rtmutex-tester.c | 7 | ||||
-rw-r--r-- | kernel/sched.c | 8 | ||||
-rw-r--r-- | kernel/time/clocksource.c | 8 |
24 files changed, 239 insertions, 112 deletions
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index cc5145b28e7f..368d171754cf 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c | |||
@@ -130,7 +130,9 @@ static const struct leds_evt_name evt_names[] = { | |||
130 | { "red", led_red_on, led_red_off }, | 130 | { "red", led_red_on, led_red_off }, |
131 | }; | 131 | }; |
132 | 132 | ||
133 | static ssize_t leds_store(struct sys_device *dev, const char *buf, size_t size) | 133 | static ssize_t leds_store(struct sys_device *dev, |
134 | struct sysdev_attribute *attr, | ||
135 | const char *buf, size_t size) | ||
134 | { | 136 | { |
135 | int ret = -EINVAL, len = strcspn(buf, " "); | 137 | int ret = -EINVAL, len = strcspn(buf, " "); |
136 | 138 | ||
diff --git a/arch/avr32/kernel/cpu.c b/arch/avr32/kernel/cpu.c index b8409caeb23d..e84faffbbeca 100644 --- a/arch/avr32/kernel/cpu.c +++ b/arch/avr32/kernel/cpu.c | |||
@@ -26,14 +26,16 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices); | |||
26 | * XXX: If/when a SMP-capable implementation of AVR32 will ever be | 26 | * XXX: If/when a SMP-capable implementation of AVR32 will ever be |
27 | * made, we must make sure that the code executes on the correct CPU. | 27 | * made, we must make sure that the code executes on the correct CPU. |
28 | */ | 28 | */ |
29 | static ssize_t show_pc0event(struct sys_device *dev, char *buf) | 29 | static ssize_t show_pc0event(struct sys_device *dev, |
30 | struct sysdev_attribute *attr, char *buf) | ||
30 | { | 31 | { |
31 | unsigned long pccr; | 32 | unsigned long pccr; |
32 | 33 | ||
33 | pccr = sysreg_read(PCCR); | 34 | pccr = sysreg_read(PCCR); |
34 | return sprintf(buf, "0x%lx\n", (pccr >> 12) & 0x3f); | 35 | return sprintf(buf, "0x%lx\n", (pccr >> 12) & 0x3f); |
35 | } | 36 | } |
36 | static ssize_t store_pc0event(struct sys_device *dev, const char *buf, | 37 | static ssize_t store_pc0event(struct sys_device *dev, |
38 | struct sysdev_attribute *attr, const char *buf, | ||
37 | size_t count) | 39 | size_t count) |
38 | { | 40 | { |
39 | unsigned long val; | 41 | unsigned long val; |
@@ -46,15 +48,17 @@ static ssize_t store_pc0event(struct sys_device *dev, const char *buf, | |||
46 | sysreg_write(PCCR, val); | 48 | sysreg_write(PCCR, val); |
47 | return count; | 49 | return count; |
48 | } | 50 | } |
49 | static ssize_t show_pc0count(struct sys_device *dev, char *buf) | 51 | static ssize_t show_pc0count(struct sys_device *dev, |
52 | struct sysdev_attribute *attr, char *buf) | ||
50 | { | 53 | { |
51 | unsigned long pcnt0; | 54 | unsigned long pcnt0; |
52 | 55 | ||
53 | pcnt0 = sysreg_read(PCNT0); | 56 | pcnt0 = sysreg_read(PCNT0); |
54 | return sprintf(buf, "%lu\n", pcnt0); | 57 | return sprintf(buf, "%lu\n", pcnt0); |
55 | } | 58 | } |
56 | static ssize_t store_pc0count(struct sys_device *dev, const char *buf, | 59 | static ssize_t store_pc0count(struct sys_device *dev, |
57 | size_t count) | 60 | struct sysdev_attribute *attr, |
61 | const char *buf, size_t count) | ||
58 | { | 62 | { |
59 | unsigned long val; | 63 | unsigned long val; |
60 | char *endp; | 64 | char *endp; |
@@ -67,14 +71,16 @@ static ssize_t store_pc0count(struct sys_device *dev, const char *buf, | |||
67 | return count; | 71 | return count; |
68 | } | 72 | } |
69 | 73 | ||
70 | static ssize_t show_pc1event(struct sys_device *dev, char *buf) | 74 | static ssize_t show_pc1event(struct sys_device *dev, |
75 | struct sysdev_attribute *attr, char *buf) | ||
71 | { | 76 | { |
72 | unsigned long pccr; | 77 | unsigned long pccr; |
73 | 78 | ||
74 | pccr = sysreg_read(PCCR); | 79 | pccr = sysreg_read(PCCR); |
75 | return sprintf(buf, "0x%lx\n", (pccr >> 18) & 0x3f); | 80 | return sprintf(buf, "0x%lx\n", (pccr >> 18) & 0x3f); |
76 | } | 81 | } |
77 | static ssize_t store_pc1event(struct sys_device *dev, const char *buf, | 82 | static ssize_t store_pc1event(struct sys_device *dev, |
83 | struct sysdev_attribute *attr, const char *buf, | ||
78 | size_t count) | 84 | size_t count) |
79 | { | 85 | { |
80 | unsigned long val; | 86 | unsigned long val; |
@@ -87,14 +93,16 @@ static ssize_t store_pc1event(struct sys_device *dev, const char *buf, | |||
87 | sysreg_write(PCCR, val); | 93 | sysreg_write(PCCR, val); |
88 | return count; | 94 | return count; |
89 | } | 95 | } |
90 | static ssize_t show_pc1count(struct sys_device *dev, char *buf) | 96 | static ssize_t show_pc1count(struct sys_device *dev, |
97 | struct sysdev_attribute *attr, char *buf) | ||
91 | { | 98 | { |
92 | unsigned long pcnt1; | 99 | unsigned long pcnt1; |
93 | 100 | ||
94 | pcnt1 = sysreg_read(PCNT1); | 101 | pcnt1 = sysreg_read(PCNT1); |
95 | return sprintf(buf, "%lu\n", pcnt1); | 102 | return sprintf(buf, "%lu\n", pcnt1); |
96 | } | 103 | } |
97 | static ssize_t store_pc1count(struct sys_device *dev, const char *buf, | 104 | static ssize_t store_pc1count(struct sys_device *dev, |
105 | struct sysdev_attribute *attr, const char *buf, | ||
98 | size_t count) | 106 | size_t count) |
99 | { | 107 | { |
100 | unsigned long val; | 108 | unsigned long val; |
@@ -108,14 +116,16 @@ static ssize_t store_pc1count(struct sys_device *dev, const char *buf, | |||
108 | return count; | 116 | return count; |
109 | } | 117 | } |
110 | 118 | ||
111 | static ssize_t show_pccycles(struct sys_device *dev, char *buf) | 119 | static ssize_t show_pccycles(struct sys_device *dev, |
120 | struct sysdev_attribute *attr, char *buf) | ||
112 | { | 121 | { |
113 | unsigned long pccnt; | 122 | unsigned long pccnt; |
114 | 123 | ||
115 | pccnt = sysreg_read(PCCNT); | 124 | pccnt = sysreg_read(PCCNT); |
116 | return sprintf(buf, "%lu\n", pccnt); | 125 | return sprintf(buf, "%lu\n", pccnt); |
117 | } | 126 | } |
118 | static ssize_t store_pccycles(struct sys_device *dev, const char *buf, | 127 | static ssize_t store_pccycles(struct sys_device *dev, |
128 | struct sysdev_attribute *attr, const char *buf, | ||
119 | size_t count) | 129 | size_t count) |
120 | { | 130 | { |
121 | unsigned long val; | 131 | unsigned long val; |
@@ -129,14 +139,16 @@ static ssize_t store_pccycles(struct sys_device *dev, const char *buf, | |||
129 | return count; | 139 | return count; |
130 | } | 140 | } |
131 | 141 | ||
132 | static ssize_t show_pcenable(struct sys_device *dev, char *buf) | 142 | static ssize_t show_pcenable(struct sys_device *dev, |
143 | struct sysdev_attribute *attr, char *buf) | ||
133 | { | 144 | { |
134 | unsigned long pccr; | 145 | unsigned long pccr; |
135 | 146 | ||
136 | pccr = sysreg_read(PCCR); | 147 | pccr = sysreg_read(PCCR); |
137 | return sprintf(buf, "%c\n", (pccr & 1)?'1':'0'); | 148 | return sprintf(buf, "%c\n", (pccr & 1)?'1':'0'); |
138 | } | 149 | } |
139 | static ssize_t store_pcenable(struct sys_device *dev, const char *buf, | 150 | static ssize_t store_pcenable(struct sys_device *dev, |
151 | struct sysdev_attribute *attr, const char *buf, | ||
140 | size_t count) | 152 | size_t count) |
141 | { | 153 | { |
142 | unsigned long pccr, val; | 154 | unsigned long pccr, val; |
diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c index b642648cc2ac..c539c689493b 100644 --- a/arch/ia64/kernel/err_inject.c +++ b/arch/ia64/kernel/err_inject.c | |||
@@ -55,7 +55,8 @@ static u64 resources[NR_CPUS]; | |||
55 | 55 | ||
56 | #define show(name) \ | 56 | #define show(name) \ |
57 | static ssize_t \ | 57 | static ssize_t \ |
58 | show_##name(struct sys_device *dev, char *buf) \ | 58 | show_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ |
59 | char *buf) \ | ||
59 | { \ | 60 | { \ |
60 | u32 cpu=dev->id; \ | 61 | u32 cpu=dev->id; \ |
61 | return sprintf(buf, "%lx\n", name[cpu]); \ | 62 | return sprintf(buf, "%lx\n", name[cpu]); \ |
@@ -63,7 +64,8 @@ show_##name(struct sys_device *dev, char *buf) \ | |||
63 | 64 | ||
64 | #define store(name) \ | 65 | #define store(name) \ |
65 | static ssize_t \ | 66 | static ssize_t \ |
66 | store_##name(struct sys_device *dev, const char *buf, size_t size) \ | 67 | store_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ |
68 | const char *buf, size_t size) \ | ||
67 | { \ | 69 | { \ |
68 | unsigned int cpu=dev->id; \ | 70 | unsigned int cpu=dev->id; \ |
69 | name[cpu] = simple_strtoull(buf, NULL, 16); \ | 71 | name[cpu] = simple_strtoull(buf, NULL, 16); \ |
@@ -76,7 +78,8 @@ show(call_start) | |||
76 | * processor. The cpu number in driver is only used for storing data. | 78 | * processor. The cpu number in driver is only used for storing data. |
77 | */ | 79 | */ |
78 | static ssize_t | 80 | static ssize_t |
79 | store_call_start(struct sys_device *dev, const char *buf, size_t size) | 81 | store_call_start(struct sys_device *dev, struct sysdev_attribute *attr, |
82 | const char *buf, size_t size) | ||
80 | { | 83 | { |
81 | unsigned int cpu=dev->id; | 84 | unsigned int cpu=dev->id; |
82 | unsigned long call_start = simple_strtoull(buf, NULL, 16); | 85 | unsigned long call_start = simple_strtoull(buf, NULL, 16); |
@@ -124,14 +127,16 @@ show(err_type_info) | |||
124 | store(err_type_info) | 127 | store(err_type_info) |
125 | 128 | ||
126 | static ssize_t | 129 | static ssize_t |
127 | show_virtual_to_phys(struct sys_device *dev, char *buf) | 130 | show_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, |
131 | char *buf) | ||
128 | { | 132 | { |
129 | unsigned int cpu=dev->id; | 133 | unsigned int cpu=dev->id; |
130 | return sprintf(buf, "%lx\n", phys_addr[cpu]); | 134 | return sprintf(buf, "%lx\n", phys_addr[cpu]); |
131 | } | 135 | } |
132 | 136 | ||
133 | static ssize_t | 137 | static ssize_t |
134 | store_virtual_to_phys(struct sys_device *dev, const char *buf, size_t size) | 138 | store_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, |
139 | const char *buf, size_t size) | ||
135 | { | 140 | { |
136 | unsigned int cpu=dev->id; | 141 | unsigned int cpu=dev->id; |
137 | u64 virt_addr=simple_strtoull(buf, NULL, 16); | 142 | u64 virt_addr=simple_strtoull(buf, NULL, 16); |
@@ -154,7 +159,8 @@ show(err_struct_info) | |||
154 | store(err_struct_info) | 159 | store(err_struct_info) |
155 | 160 | ||
156 | static ssize_t | 161 | static ssize_t |
157 | show_err_data_buffer(struct sys_device *dev, char *buf) | 162 | show_err_data_buffer(struct sys_device *dev, |
163 | struct sysdev_attribute *attr, char *buf) | ||
158 | { | 164 | { |
159 | unsigned int cpu=dev->id; | 165 | unsigned int cpu=dev->id; |
160 | 166 | ||
@@ -165,7 +171,9 @@ show_err_data_buffer(struct sys_device *dev, char *buf) | |||
165 | } | 171 | } |
166 | 172 | ||
167 | static ssize_t | 173 | static ssize_t |
168 | store_err_data_buffer(struct sys_device *dev, const char *buf, size_t size) | 174 | store_err_data_buffer(struct sys_device *dev, |
175 | struct sysdev_attribute *attr, | ||
176 | const char *buf, size_t size) | ||
169 | { | 177 | { |
170 | unsigned int cpu=dev->id; | 178 | unsigned int cpu=dev->id; |
171 | int ret; | 179 | int ret; |
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index c8127f832df0..aba0ba95f062 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c | |||
@@ -28,7 +28,9 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices); | |||
28 | /* Time in microseconds we delay before sleeping in the idle loop */ | 28 | /* Time in microseconds we delay before sleeping in the idle loop */ |
29 | DEFINE_PER_CPU(unsigned long, smt_snooze_delay) = { 100 }; | 29 | DEFINE_PER_CPU(unsigned long, smt_snooze_delay) = { 100 }; |
30 | 30 | ||
31 | static ssize_t store_smt_snooze_delay(struct sys_device *dev, const char *buf, | 31 | static ssize_t store_smt_snooze_delay(struct sys_device *dev, |
32 | struct sysdev_attribute *attr, | ||
33 | const char *buf, | ||
32 | size_t count) | 34 | size_t count) |
33 | { | 35 | { |
34 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 36 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); |
@@ -44,7 +46,9 @@ static ssize_t store_smt_snooze_delay(struct sys_device *dev, const char *buf, | |||
44 | return count; | 46 | return count; |
45 | } | 47 | } |
46 | 48 | ||
47 | static ssize_t show_smt_snooze_delay(struct sys_device *dev, char *buf) | 49 | static ssize_t show_smt_snooze_delay(struct sys_device *dev, |
50 | struct sysdev_attribute *attr, | ||
51 | char *buf) | ||
48 | { | 52 | { |
49 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 53 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); |
50 | 54 | ||
@@ -152,14 +156,17 @@ static unsigned long write_##NAME(unsigned long val) \ | |||
152 | mtspr(ADDRESS, val); \ | 156 | mtspr(ADDRESS, val); \ |
153 | return 0; \ | 157 | return 0; \ |
154 | } \ | 158 | } \ |
155 | static ssize_t show_##NAME(struct sys_device *dev, char *buf) \ | 159 | static ssize_t show_##NAME(struct sys_device *dev, \ |
160 | struct sysdev_attribute *attr, \ | ||
161 | char *buf) \ | ||
156 | { \ | 162 | { \ |
157 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ | 163 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ |
158 | unsigned long val = run_on_cpu(cpu->sysdev.id, read_##NAME, 0); \ | 164 | unsigned long val = run_on_cpu(cpu->sysdev.id, read_##NAME, 0); \ |
159 | return sprintf(buf, "%lx\n", val); \ | 165 | return sprintf(buf, "%lx\n", val); \ |
160 | } \ | 166 | } \ |
161 | static ssize_t __used \ | 167 | static ssize_t __used \ |
162 | store_##NAME(struct sys_device *dev, const char *buf, size_t count) \ | 168 | store_##NAME(struct sys_device *dev, struct sysdev_attribute *attr, \ |
169 | const char *buf, size_t count) \ | ||
163 | { \ | 170 | { \ |
164 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ | 171 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ |
165 | unsigned long val; \ | 172 | unsigned long val; \ |
diff --git a/arch/powerpc/platforms/cell/cbe_thermal.c b/arch/powerpc/platforms/cell/cbe_thermal.c index 4852bf312d83..4d4c8c169124 100644 --- a/arch/powerpc/platforms/cell/cbe_thermal.c +++ b/arch/powerpc/platforms/cell/cbe_thermal.c | |||
@@ -97,7 +97,8 @@ static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iom | |||
97 | return value.spe[spu->spe_id]; | 97 | return value.spe[spu->spe_id]; |
98 | } | 98 | } |
99 | 99 | ||
100 | static ssize_t spu_show_temp(struct sys_device *sysdev, char *buf) | 100 | static ssize_t spu_show_temp(struct sys_device *sysdev, struct sysdev_attribute *attr, |
101 | char *buf) | ||
101 | { | 102 | { |
102 | u8 value; | 103 | u8 value; |
103 | struct cbe_pmd_regs __iomem *pmd_regs; | 104 | struct cbe_pmd_regs __iomem *pmd_regs; |
@@ -146,32 +147,38 @@ static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char | |||
146 | return size; | 147 | return size; |
147 | } | 148 | } |
148 | 149 | ||
149 | static ssize_t spu_show_throttle_end(struct sys_device *sysdev, char *buf) | 150 | static ssize_t spu_show_throttle_end(struct sys_device *sysdev, |
151 | struct sysdev_attribute *attr, char *buf) | ||
150 | { | 152 | { |
151 | return show_throttle(get_pmd_regs(sysdev), buf, 0); | 153 | return show_throttle(get_pmd_regs(sysdev), buf, 0); |
152 | } | 154 | } |
153 | 155 | ||
154 | static ssize_t spu_show_throttle_begin(struct sys_device *sysdev, char *buf) | 156 | static ssize_t spu_show_throttle_begin(struct sys_device *sysdev, |
157 | struct sysdev_attribute *attr, char *buf) | ||
155 | { | 158 | { |
156 | return show_throttle(get_pmd_regs(sysdev), buf, 8); | 159 | return show_throttle(get_pmd_regs(sysdev), buf, 8); |
157 | } | 160 | } |
158 | 161 | ||
159 | static ssize_t spu_show_throttle_full_stop(struct sys_device *sysdev, char *buf) | 162 | static ssize_t spu_show_throttle_full_stop(struct sys_device *sysdev, |
163 | struct sysdev_attribute *attr, char *buf) | ||
160 | { | 164 | { |
161 | return show_throttle(get_pmd_regs(sysdev), buf, 16); | 165 | return show_throttle(get_pmd_regs(sysdev), buf, 16); |
162 | } | 166 | } |
163 | 167 | ||
164 | static ssize_t spu_store_throttle_end(struct sys_device *sysdev, const char *buf, size_t size) | 168 | static ssize_t spu_store_throttle_end(struct sys_device *sysdev, |
169 | struct sysdev_attribute *attr, const char *buf, size_t size) | ||
165 | { | 170 | { |
166 | return store_throttle(get_pmd_regs(sysdev), buf, size, 0); | 171 | return store_throttle(get_pmd_regs(sysdev), buf, size, 0); |
167 | } | 172 | } |
168 | 173 | ||
169 | static ssize_t spu_store_throttle_begin(struct sys_device *sysdev, const char *buf, size_t size) | 174 | static ssize_t spu_store_throttle_begin(struct sys_device *sysdev, |
175 | struct sysdev_attribute *attr, const char *buf, size_t size) | ||
170 | { | 176 | { |
171 | return store_throttle(get_pmd_regs(sysdev), buf, size, 8); | 177 | return store_throttle(get_pmd_regs(sysdev), buf, size, 8); |
172 | } | 178 | } |
173 | 179 | ||
174 | static ssize_t spu_store_throttle_full_stop(struct sys_device *sysdev, const char *buf, size_t size) | 180 | static ssize_t spu_store_throttle_full_stop(struct sys_device *sysdev, |
181 | struct sysdev_attribute *attr, const char *buf, size_t size) | ||
175 | { | 182 | { |
176 | return store_throttle(get_pmd_regs(sysdev), buf, size, 16); | 183 | return store_throttle(get_pmd_regs(sysdev), buf, size, 16); |
177 | } | 184 | } |
@@ -192,43 +199,51 @@ static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos) | |||
192 | 199 | ||
193 | /* shows the temperature of the DTS on the PPE, | 200 | /* shows the temperature of the DTS on the PPE, |
194 | * located near the linear thermal sensor */ | 201 | * located near the linear thermal sensor */ |
195 | static ssize_t ppe_show_temp0(struct sys_device *sysdev, char *buf) | 202 | static ssize_t ppe_show_temp0(struct sys_device *sysdev, |
203 | struct sysdev_attribute *attr, char *buf) | ||
196 | { | 204 | { |
197 | return ppe_show_temp(sysdev, buf, 32); | 205 | return ppe_show_temp(sysdev, buf, 32); |
198 | } | 206 | } |
199 | 207 | ||
200 | /* shows the temperature of the second DTS on the PPE */ | 208 | /* shows the temperature of the second DTS on the PPE */ |
201 | static ssize_t ppe_show_temp1(struct sys_device *sysdev, char *buf) | 209 | static ssize_t ppe_show_temp1(struct sys_device *sysdev, |
210 | struct sysdev_attribute *attr, char *buf) | ||
202 | { | 211 | { |
203 | return ppe_show_temp(sysdev, buf, 0); | 212 | return ppe_show_temp(sysdev, buf, 0); |
204 | } | 213 | } |
205 | 214 | ||
206 | static ssize_t ppe_show_throttle_end(struct sys_device *sysdev, char *buf) | 215 | static ssize_t ppe_show_throttle_end(struct sys_device *sysdev, |
216 | struct sysdev_attribute *attr, char *buf) | ||
207 | { | 217 | { |
208 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 32); | 218 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 32); |
209 | } | 219 | } |
210 | 220 | ||
211 | static ssize_t ppe_show_throttle_begin(struct sys_device *sysdev, char *buf) | 221 | static ssize_t ppe_show_throttle_begin(struct sys_device *sysdev, |
222 | struct sysdev_attribute *attr, char *buf) | ||
212 | { | 223 | { |
213 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 40); | 224 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 40); |
214 | } | 225 | } |
215 | 226 | ||
216 | static ssize_t ppe_show_throttle_full_stop(struct sys_device *sysdev, char *buf) | 227 | static ssize_t ppe_show_throttle_full_stop(struct sys_device *sysdev, |
228 | struct sysdev_attribute *attr, char *buf) | ||
217 | { | 229 | { |
218 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 48); | 230 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 48); |
219 | } | 231 | } |
220 | 232 | ||
221 | static ssize_t ppe_store_throttle_end(struct sys_device *sysdev, const char *buf, size_t size) | 233 | static ssize_t ppe_store_throttle_end(struct sys_device *sysdev, |
234 | struct sysdev_attribute *attr, const char *buf, size_t size) | ||
222 | { | 235 | { |
223 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 32); | 236 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 32); |
224 | } | 237 | } |
225 | 238 | ||
226 | static ssize_t ppe_store_throttle_begin(struct sys_device *sysdev, const char *buf, size_t size) | 239 | static ssize_t ppe_store_throttle_begin(struct sys_device *sysdev, |
240 | struct sysdev_attribute *attr, const char *buf, size_t size) | ||
227 | { | 241 | { |
228 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 40); | 242 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 40); |
229 | } | 243 | } |
230 | 244 | ||
231 | static ssize_t ppe_store_throttle_full_stop(struct sys_device *sysdev, const char *buf, size_t size) | 245 | static ssize_t ppe_store_throttle_full_stop(struct sys_device *sysdev, |
246 | struct sysdev_attribute *attr, const char *buf, size_t size) | ||
232 | { | 247 | { |
233 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 48); | 248 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 48); |
234 | } | 249 | } |
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c index 78f905bc6a42..a5bdb89a17c3 100644 --- a/arch/powerpc/platforms/cell/spu_base.c +++ b/arch/powerpc/platforms/cell/spu_base.c | |||
@@ -703,7 +703,8 @@ static unsigned long long spu_acct_time(struct spu *spu, | |||
703 | } | 703 | } |
704 | 704 | ||
705 | 705 | ||
706 | static ssize_t spu_stat_show(struct sys_device *sysdev, char *buf) | 706 | static ssize_t spu_stat_show(struct sys_device *sysdev, |
707 | struct sysdev_attribute *attr, char *buf) | ||
707 | { | 708 | { |
708 | struct spu *spu = container_of(sysdev, struct spu, sysdev); | 709 | struct spu *spu = container_of(sysdev, struct spu, sysdev); |
709 | 710 | ||
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index b6781030cfbd..b795b3e24afd 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -864,7 +864,8 @@ int setup_profiling_timer(unsigned int multiplier) | |||
864 | } | 864 | } |
865 | 865 | ||
866 | #ifdef CONFIG_HOTPLUG_CPU | 866 | #ifdef CONFIG_HOTPLUG_CPU |
867 | static ssize_t cpu_configure_show(struct sys_device *dev, char *buf) | 867 | static ssize_t cpu_configure_show(struct sys_device *dev, |
868 | struct sysdev_attribute *attr, char *buf) | ||
868 | { | 869 | { |
869 | ssize_t count; | 870 | ssize_t count; |
870 | 871 | ||
@@ -874,8 +875,9 @@ static ssize_t cpu_configure_show(struct sys_device *dev, char *buf) | |||
874 | return count; | 875 | return count; |
875 | } | 876 | } |
876 | 877 | ||
877 | static ssize_t cpu_configure_store(struct sys_device *dev, const char *buf, | 878 | static ssize_t cpu_configure_store(struct sys_device *dev, |
878 | size_t count) | 879 | struct sysdev_attribute *attr, |
880 | const char *buf, size_t count) | ||
879 | { | 881 | { |
880 | int cpu = dev->id; | 882 | int cpu = dev->id; |
881 | int val, rc; | 883 | int val, rc; |
@@ -922,7 +924,8 @@ out: | |||
922 | static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); | 924 | static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); |
923 | #endif /* CONFIG_HOTPLUG_CPU */ | 925 | #endif /* CONFIG_HOTPLUG_CPU */ |
924 | 926 | ||
925 | static ssize_t cpu_polarization_show(struct sys_device *dev, char *buf) | 927 | static ssize_t cpu_polarization_show(struct sys_device *dev, |
928 | struct sysdev_attribute *attr, char *buf) | ||
926 | { | 929 | { |
927 | int cpu = dev->id; | 930 | int cpu = dev->id; |
928 | ssize_t count; | 931 | ssize_t count; |
@@ -950,7 +953,8 @@ static ssize_t cpu_polarization_show(struct sys_device *dev, char *buf) | |||
950 | } | 953 | } |
951 | static SYSDEV_ATTR(polarization, 0444, cpu_polarization_show, NULL); | 954 | static SYSDEV_ATTR(polarization, 0444, cpu_polarization_show, NULL); |
952 | 955 | ||
953 | static ssize_t show_cpu_address(struct sys_device *dev, char *buf) | 956 | static ssize_t show_cpu_address(struct sys_device *dev, |
957 | struct sysdev_attribute *attr, char *buf) | ||
954 | { | 958 | { |
955 | return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]); | 959 | return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]); |
956 | } | 960 | } |
@@ -970,7 +974,8 @@ static struct attribute_group cpu_common_attr_group = { | |||
970 | .attrs = cpu_common_attrs, | 974 | .attrs = cpu_common_attrs, |
971 | }; | 975 | }; |
972 | 976 | ||
973 | static ssize_t show_capability(struct sys_device *dev, char *buf) | 977 | static ssize_t show_capability(struct sys_device *dev, |
978 | struct sysdev_attribute *attr, char *buf) | ||
974 | { | 979 | { |
975 | unsigned int capability; | 980 | unsigned int capability; |
976 | int rc; | 981 | int rc; |
@@ -982,7 +987,8 @@ static ssize_t show_capability(struct sys_device *dev, char *buf) | |||
982 | } | 987 | } |
983 | static SYSDEV_ATTR(capability, 0444, show_capability, NULL); | 988 | static SYSDEV_ATTR(capability, 0444, show_capability, NULL); |
984 | 989 | ||
985 | static ssize_t show_idle_count(struct sys_device *dev, char *buf) | 990 | static ssize_t show_idle_count(struct sys_device *dev, |
991 | struct sysdev_attribute *attr, char *buf) | ||
986 | { | 992 | { |
987 | struct s390_idle_data *idle; | 993 | struct s390_idle_data *idle; |
988 | unsigned long long idle_count; | 994 | unsigned long long idle_count; |
@@ -995,7 +1001,8 @@ static ssize_t show_idle_count(struct sys_device *dev, char *buf) | |||
995 | } | 1001 | } |
996 | static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL); | 1002 | static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL); |
997 | 1003 | ||
998 | static ssize_t show_idle_time(struct sys_device *dev, char *buf) | 1004 | static ssize_t show_idle_time(struct sys_device *dev, |
1005 | struct sysdev_attribute *attr, char *buf) | ||
999 | { | 1006 | { |
1000 | struct s390_idle_data *idle; | 1007 | struct s390_idle_data *idle; |
1001 | unsigned long long new_time; | 1008 | unsigned long long new_time; |
@@ -1112,7 +1119,9 @@ out: | |||
1112 | return rc; | 1119 | return rc; |
1113 | } | 1120 | } |
1114 | 1121 | ||
1115 | static ssize_t __ref rescan_store(struct sys_device *dev, const char *buf, | 1122 | static ssize_t __ref rescan_store(struct sys_device *dev, |
1123 | struct sysdev_attribute *attr, | ||
1124 | const char *buf, | ||
1116 | size_t count) | 1125 | size_t count) |
1117 | { | 1126 | { |
1118 | int rc; | 1127 | int rc; |
@@ -1123,7 +1132,9 @@ static ssize_t __ref rescan_store(struct sys_device *dev, const char *buf, | |||
1123 | static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store); | 1132 | static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store); |
1124 | #endif /* CONFIG_HOTPLUG_CPU */ | 1133 | #endif /* CONFIG_HOTPLUG_CPU */ |
1125 | 1134 | ||
1126 | static ssize_t dispatching_show(struct sys_device *dev, char *buf) | 1135 | static ssize_t dispatching_show(struct sys_device *dev, |
1136 | struct sysdev_attribute *attr, | ||
1137 | char *buf) | ||
1127 | { | 1138 | { |
1128 | ssize_t count; | 1139 | ssize_t count; |
1129 | 1140 | ||
@@ -1133,8 +1144,9 @@ static ssize_t dispatching_show(struct sys_device *dev, char *buf) | |||
1133 | return count; | 1144 | return count; |
1134 | } | 1145 | } |
1135 | 1146 | ||
1136 | static ssize_t dispatching_store(struct sys_device *dev, const char *buf, | 1147 | static ssize_t dispatching_store(struct sys_device *dev, |
1137 | size_t count) | 1148 | struct sysdev_attribute *attr, |
1149 | const char *buf, size_t count) | ||
1138 | { | 1150 | { |
1139 | int val, rc; | 1151 | int val, rc; |
1140 | char delim; | 1152 | char delim; |
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index f2cede3947b2..ab70d9bd9261 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
@@ -1100,7 +1100,9 @@ static inline struct etr_aib *etr_aib_from_dev(struct sys_device *dev) | |||
1100 | return etr_port1_online ? &etr_port1 : NULL; | 1100 | return etr_port1_online ? &etr_port1 : NULL; |
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | static ssize_t etr_online_show(struct sys_device *dev, char *buf) | 1103 | static ssize_t etr_online_show(struct sys_device *dev, |
1104 | struct sysdev_attribute *attr, | ||
1105 | char *buf) | ||
1104 | { | 1106 | { |
1105 | unsigned int online; | 1107 | unsigned int online; |
1106 | 1108 | ||
@@ -1109,7 +1111,8 @@ static ssize_t etr_online_show(struct sys_device *dev, char *buf) | |||
1109 | } | 1111 | } |
1110 | 1112 | ||
1111 | static ssize_t etr_online_store(struct sys_device *dev, | 1113 | static ssize_t etr_online_store(struct sys_device *dev, |
1112 | const char *buf, size_t count) | 1114 | struct sysdev_attribute *attr, |
1115 | const char *buf, size_t count) | ||
1113 | { | 1116 | { |
1114 | unsigned int value; | 1117 | unsigned int value; |
1115 | 1118 | ||
@@ -1136,7 +1139,9 @@ static ssize_t etr_online_store(struct sys_device *dev, | |||
1136 | 1139 | ||
1137 | static SYSDEV_ATTR(online, 0600, etr_online_show, etr_online_store); | 1140 | static SYSDEV_ATTR(online, 0600, etr_online_show, etr_online_store); |
1138 | 1141 | ||
1139 | static ssize_t etr_stepping_control_show(struct sys_device *dev, char *buf) | 1142 | static ssize_t etr_stepping_control_show(struct sys_device *dev, |
1143 | struct sysdev_attribute *attr, | ||
1144 | char *buf) | ||
1140 | { | 1145 | { |
1141 | return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ? | 1146 | return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ? |
1142 | etr_eacr.e0 : etr_eacr.e1); | 1147 | etr_eacr.e0 : etr_eacr.e1); |
@@ -1144,7 +1149,8 @@ static ssize_t etr_stepping_control_show(struct sys_device *dev, char *buf) | |||
1144 | 1149 | ||
1145 | static SYSDEV_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL); | 1150 | static SYSDEV_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL); |
1146 | 1151 | ||
1147 | static ssize_t etr_mode_code_show(struct sys_device *dev, char *buf) | 1152 | static ssize_t etr_mode_code_show(struct sys_device *dev, |
1153 | struct sysdev_attribute *attr, char *buf) | ||
1148 | { | 1154 | { |
1149 | if (!etr_port0_online && !etr_port1_online) | 1155 | if (!etr_port0_online && !etr_port1_online) |
1150 | /* Status word is not uptodate if both ports are offline. */ | 1156 | /* Status word is not uptodate if both ports are offline. */ |
@@ -1155,7 +1161,8 @@ static ssize_t etr_mode_code_show(struct sys_device *dev, char *buf) | |||
1155 | 1161 | ||
1156 | static SYSDEV_ATTR(state_code, 0400, etr_mode_code_show, NULL); | 1162 | static SYSDEV_ATTR(state_code, 0400, etr_mode_code_show, NULL); |
1157 | 1163 | ||
1158 | static ssize_t etr_untuned_show(struct sys_device *dev, char *buf) | 1164 | static ssize_t etr_untuned_show(struct sys_device *dev, |
1165 | struct sysdev_attribute *attr, char *buf) | ||
1159 | { | 1166 | { |
1160 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1167 | struct etr_aib *aib = etr_aib_from_dev(dev); |
1161 | 1168 | ||
@@ -1166,7 +1173,8 @@ static ssize_t etr_untuned_show(struct sys_device *dev, char *buf) | |||
1166 | 1173 | ||
1167 | static SYSDEV_ATTR(untuned, 0400, etr_untuned_show, NULL); | 1174 | static SYSDEV_ATTR(untuned, 0400, etr_untuned_show, NULL); |
1168 | 1175 | ||
1169 | static ssize_t etr_network_id_show(struct sys_device *dev, char *buf) | 1176 | static ssize_t etr_network_id_show(struct sys_device *dev, |
1177 | struct sysdev_attribute *attr, char *buf) | ||
1170 | { | 1178 | { |
1171 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1179 | struct etr_aib *aib = etr_aib_from_dev(dev); |
1172 | 1180 | ||
@@ -1177,7 +1185,8 @@ static ssize_t etr_network_id_show(struct sys_device *dev, char *buf) | |||
1177 | 1185 | ||
1178 | static SYSDEV_ATTR(network, 0400, etr_network_id_show, NULL); | 1186 | static SYSDEV_ATTR(network, 0400, etr_network_id_show, NULL); |
1179 | 1187 | ||
1180 | static ssize_t etr_id_show(struct sys_device *dev, char *buf) | 1188 | static ssize_t etr_id_show(struct sys_device *dev, |
1189 | struct sysdev_attribute *attr, char *buf) | ||
1181 | { | 1190 | { |
1182 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1191 | struct etr_aib *aib = etr_aib_from_dev(dev); |
1183 | 1192 | ||
@@ -1188,7 +1197,8 @@ static ssize_t etr_id_show(struct sys_device *dev, char *buf) | |||
1188 | 1197 | ||
1189 | static SYSDEV_ATTR(id, 0400, etr_id_show, NULL); | 1198 | static SYSDEV_ATTR(id, 0400, etr_id_show, NULL); |
1190 | 1199 | ||
1191 | static ssize_t etr_port_number_show(struct sys_device *dev, char *buf) | 1200 | static ssize_t etr_port_number_show(struct sys_device *dev, |
1201 | struct sysdev_attribute *attr, char *buf) | ||
1192 | { | 1202 | { |
1193 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1203 | struct etr_aib *aib = etr_aib_from_dev(dev); |
1194 | 1204 | ||
@@ -1199,7 +1209,8 @@ static ssize_t etr_port_number_show(struct sys_device *dev, char *buf) | |||
1199 | 1209 | ||
1200 | static SYSDEV_ATTR(port, 0400, etr_port_number_show, NULL); | 1210 | static SYSDEV_ATTR(port, 0400, etr_port_number_show, NULL); |
1201 | 1211 | ||
1202 | static ssize_t etr_coupled_show(struct sys_device *dev, char *buf) | 1212 | static ssize_t etr_coupled_show(struct sys_device *dev, |
1213 | struct sysdev_attribute *attr, char *buf) | ||
1203 | { | 1214 | { |
1204 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1215 | struct etr_aib *aib = etr_aib_from_dev(dev); |
1205 | 1216 | ||
@@ -1210,7 +1221,8 @@ static ssize_t etr_coupled_show(struct sys_device *dev, char *buf) | |||
1210 | 1221 | ||
1211 | static SYSDEV_ATTR(coupled, 0400, etr_coupled_show, NULL); | 1222 | static SYSDEV_ATTR(coupled, 0400, etr_coupled_show, NULL); |
1212 | 1223 | ||
1213 | static ssize_t etr_local_time_show(struct sys_device *dev, char *buf) | 1224 | static ssize_t etr_local_time_show(struct sys_device *dev, |
1225 | struct sysdev_attribute *attr, char *buf) | ||
1214 | { | 1226 | { |
1215 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1227 | struct etr_aib *aib = etr_aib_from_dev(dev); |
1216 | 1228 | ||
@@ -1221,7 +1233,8 @@ static ssize_t etr_local_time_show(struct sys_device *dev, char *buf) | |||
1221 | 1233 | ||
1222 | static SYSDEV_ATTR(local_time, 0400, etr_local_time_show, NULL); | 1234 | static SYSDEV_ATTR(local_time, 0400, etr_local_time_show, NULL); |
1223 | 1235 | ||
1224 | static ssize_t etr_utc_offset_show(struct sys_device *dev, char *buf) | 1236 | static ssize_t etr_utc_offset_show(struct sys_device *dev, |
1237 | struct sysdev_attribute *attr, char *buf) | ||
1225 | { | 1238 | { |
1226 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1239 | struct etr_aib *aib = etr_aib_from_dev(dev); |
1227 | 1240 | ||
diff --git a/arch/sh/drivers/dma/dma-sysfs.c b/arch/sh/drivers/dma/dma-sysfs.c index 51b57c0d1a3c..347ee11351ec 100644 --- a/arch/sh/drivers/dma/dma-sysfs.c +++ b/arch/sh/drivers/dma/dma-sysfs.c | |||
@@ -23,7 +23,8 @@ static struct sysdev_class dma_sysclass = { | |||
23 | }; | 23 | }; |
24 | EXPORT_SYMBOL(dma_sysclass); | 24 | EXPORT_SYMBOL(dma_sysclass); |
25 | 25 | ||
26 | static ssize_t dma_show_devices(struct sys_device *dev, char *buf) | 26 | static ssize_t dma_show_devices(struct sys_device *dev, |
27 | struct sysdev_attribute *attr, char *buf) | ||
27 | { | 28 | { |
28 | ssize_t len = 0; | 29 | ssize_t len = 0; |
29 | int i; | 30 | int i; |
@@ -57,13 +58,15 @@ static int __init dma_sysclass_init(void) | |||
57 | } | 58 | } |
58 | postcore_initcall(dma_sysclass_init); | 59 | postcore_initcall(dma_sysclass_init); |
59 | 60 | ||
60 | static ssize_t dma_show_dev_id(struct sys_device *dev, char *buf) | 61 | static ssize_t dma_show_dev_id(struct sys_device *dev, |
62 | struct sysdev_attribute *attr, char *buf) | ||
61 | { | 63 | { |
62 | struct dma_channel *channel = to_dma_channel(dev); | 64 | struct dma_channel *channel = to_dma_channel(dev); |
63 | return sprintf(buf, "%s\n", channel->dev_id); | 65 | return sprintf(buf, "%s\n", channel->dev_id); |
64 | } | 66 | } |
65 | 67 | ||
66 | static ssize_t dma_store_dev_id(struct sys_device *dev, | 68 | static ssize_t dma_store_dev_id(struct sys_device *dev, |
69 | struct sysdev_attribute *attr, | ||
67 | const char *buf, size_t count) | 70 | const char *buf, size_t count) |
68 | { | 71 | { |
69 | struct dma_channel *channel = to_dma_channel(dev); | 72 | struct dma_channel *channel = to_dma_channel(dev); |
@@ -74,6 +77,7 @@ static ssize_t dma_store_dev_id(struct sys_device *dev, | |||
74 | static SYSDEV_ATTR(dev_id, S_IRUGO | S_IWUSR, dma_show_dev_id, dma_store_dev_id); | 77 | static SYSDEV_ATTR(dev_id, S_IRUGO | S_IWUSR, dma_show_dev_id, dma_store_dev_id); |
75 | 78 | ||
76 | static ssize_t dma_store_config(struct sys_device *dev, | 79 | static ssize_t dma_store_config(struct sys_device *dev, |
80 | struct sysdev_attribute *attr, | ||
77 | const char *buf, size_t count) | 81 | const char *buf, size_t count) |
78 | { | 82 | { |
79 | struct dma_channel *channel = to_dma_channel(dev); | 83 | struct dma_channel *channel = to_dma_channel(dev); |
@@ -87,13 +91,15 @@ static ssize_t dma_store_config(struct sys_device *dev, | |||
87 | 91 | ||
88 | static SYSDEV_ATTR(config, S_IWUSR, NULL, dma_store_config); | 92 | static SYSDEV_ATTR(config, S_IWUSR, NULL, dma_store_config); |
89 | 93 | ||
90 | static ssize_t dma_show_mode(struct sys_device *dev, char *buf) | 94 | static ssize_t dma_show_mode(struct sys_device *dev, |
95 | struct sysdev_attribute *attr, char *buf) | ||
91 | { | 96 | { |
92 | struct dma_channel *channel = to_dma_channel(dev); | 97 | struct dma_channel *channel = to_dma_channel(dev); |
93 | return sprintf(buf, "0x%08x\n", channel->mode); | 98 | return sprintf(buf, "0x%08x\n", channel->mode); |
94 | } | 99 | } |
95 | 100 | ||
96 | static ssize_t dma_store_mode(struct sys_device *dev, | 101 | static ssize_t dma_store_mode(struct sys_device *dev, |
102 | struct sysdev_attribute *attr, | ||
97 | const char *buf, size_t count) | 103 | const char *buf, size_t count) |
98 | { | 104 | { |
99 | struct dma_channel *channel = to_dma_channel(dev); | 105 | struct dma_channel *channel = to_dma_channel(dev); |
@@ -104,7 +110,8 @@ static ssize_t dma_store_mode(struct sys_device *dev, | |||
104 | static SYSDEV_ATTR(mode, S_IRUGO | S_IWUSR, dma_show_mode, dma_store_mode); | 110 | static SYSDEV_ATTR(mode, S_IRUGO | S_IWUSR, dma_show_mode, dma_store_mode); |
105 | 111 | ||
106 | #define dma_ro_attr(field, fmt) \ | 112 | #define dma_ro_attr(field, fmt) \ |
107 | static ssize_t dma_show_##field(struct sys_device *dev, char *buf) \ | 113 | static ssize_t dma_show_##field(struct sys_device *dev, \ |
114 | struct sysdev_attribute *attr, char *buf)\ | ||
108 | { \ | 115 | { \ |
109 | struct dma_channel *channel = to_dma_channel(dev); \ | 116 | struct dma_channel *channel = to_dma_channel(dev); \ |
110 | return sprintf(buf, fmt, channel->field); \ | 117 | return sprintf(buf, fmt, channel->field); \ |
diff --git a/arch/sparc64/kernel/sysfs.c b/arch/sparc64/kernel/sysfs.c index e885034a6b73..84e5ce146713 100644 --- a/arch/sparc64/kernel/sysfs.c +++ b/arch/sparc64/kernel/sysfs.c | |||
@@ -14,7 +14,8 @@ | |||
14 | static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64))); | 14 | static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64))); |
15 | 15 | ||
16 | #define SHOW_MMUSTAT_ULONG(NAME) \ | 16 | #define SHOW_MMUSTAT_ULONG(NAME) \ |
17 | static ssize_t show_##NAME(struct sys_device *dev, char *buf) \ | 17 | static ssize_t show_##NAME(struct sys_device *dev, \ |
18 | struct sysdev_attribute *attr, char *buf) \ | ||
18 | { \ | 19 | { \ |
19 | struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \ | 20 | struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \ |
20 | return sprintf(buf, "%lu\n", p->NAME); \ | 21 | return sprintf(buf, "%lu\n", p->NAME); \ |
@@ -135,13 +136,16 @@ static unsigned long write_mmustat_enable(unsigned long val) | |||
135 | return sun4v_mmustat_conf(ra, &orig_ra); | 136 | return sun4v_mmustat_conf(ra, &orig_ra); |
136 | } | 137 | } |
137 | 138 | ||
138 | static ssize_t show_mmustat_enable(struct sys_device *s, char *buf) | 139 | static ssize_t show_mmustat_enable(struct sys_device *s, |
140 | struct sysdev_attribute *attr, char *buf) | ||
139 | { | 141 | { |
140 | unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0); | 142 | unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0); |
141 | return sprintf(buf, "%lx\n", val); | 143 | return sprintf(buf, "%lx\n", val); |
142 | } | 144 | } |
143 | 145 | ||
144 | static ssize_t store_mmustat_enable(struct sys_device *s, const char *buf, size_t count) | 146 | static ssize_t store_mmustat_enable(struct sys_device *s, |
147 | struct sysdev_attribute *attr, const char *buf, | ||
148 | size_t count) | ||
145 | { | 149 | { |
146 | unsigned long val, err; | 150 | unsigned long val, err; |
147 | int ret = sscanf(buf, "%ld", &val); | 151 | int ret = sscanf(buf, "%ld", &val); |
@@ -179,14 +183,16 @@ static void unregister_mmu_stats(struct sys_device *s) | |||
179 | #endif | 183 | #endif |
180 | 184 | ||
181 | #define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \ | 185 | #define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \ |
182 | static ssize_t show_##NAME(struct sys_device *dev, char *buf) \ | 186 | static ssize_t show_##NAME(struct sys_device *dev, \ |
187 | struct sysdev_attribute *attr, char *buf) \ | ||
183 | { \ | 188 | { \ |
184 | cpuinfo_sparc *c = &cpu_data(dev->id); \ | 189 | cpuinfo_sparc *c = &cpu_data(dev->id); \ |
185 | return sprintf(buf, "%lu\n", c->MEMBER); \ | 190 | return sprintf(buf, "%lu\n", c->MEMBER); \ |
186 | } | 191 | } |
187 | 192 | ||
188 | #define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \ | 193 | #define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \ |
189 | static ssize_t show_##NAME(struct sys_device *dev, char *buf) \ | 194 | static ssize_t show_##NAME(struct sys_device *dev, \ |
195 | struct sysdev_attribute *attr, char *buf) \ | ||
190 | { \ | 196 | { \ |
191 | cpuinfo_sparc *c = &cpu_data(dev->id); \ | 197 | cpuinfo_sparc *c = &cpu_data(dev->id); \ |
192 | return sprintf(buf, "%u\n", c->MEMBER); \ | 198 | return sprintf(buf, "%u\n", c->MEMBER); \ |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c index c4a7ec31394c..e6a4d5f67643 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_64.c | |||
@@ -762,10 +762,14 @@ DEFINE_PER_CPU(struct sys_device, device_mce); | |||
762 | 762 | ||
763 | /* Why are there no generic functions for this? */ | 763 | /* Why are there no generic functions for this? */ |
764 | #define ACCESSOR(name, var, start) \ | 764 | #define ACCESSOR(name, var, start) \ |
765 | static ssize_t show_ ## name(struct sys_device *s, char *buf) { \ | 765 | static ssize_t show_ ## name(struct sys_device *s, \ |
766 | struct sysdev_attribute *attr, \ | ||
767 | char *buf) { \ | ||
766 | return sprintf(buf, "%lx\n", (unsigned long)var); \ | 768 | return sprintf(buf, "%lx\n", (unsigned long)var); \ |
767 | } \ | 769 | } \ |
768 | static ssize_t set_ ## name(struct sys_device *s,const char *buf,size_t siz) { \ | 770 | static ssize_t set_ ## name(struct sys_device *s, \ |
771 | struct sysdev_attribute *attr, \ | ||
772 | const char *buf, size_t siz) { \ | ||
769 | char *end; \ | 773 | char *end; \ |
770 | unsigned long new = simple_strtoul(buf, &end, 0); \ | 774 | unsigned long new = simple_strtoul(buf, &end, 0); \ |
771 | if (end == buf) return -EINVAL; \ | 775 | if (end == buf) return -EINVAL; \ |
@@ -786,14 +790,16 @@ ACCESSOR(bank3ctl,bank[3],mce_restart()) | |||
786 | ACCESSOR(bank4ctl,bank[4],mce_restart()) | 790 | ACCESSOR(bank4ctl,bank[4],mce_restart()) |
787 | ACCESSOR(bank5ctl,bank[5],mce_restart()) | 791 | ACCESSOR(bank5ctl,bank[5],mce_restart()) |
788 | 792 | ||
789 | static ssize_t show_trigger(struct sys_device *s, char *buf) | 793 | static ssize_t show_trigger(struct sys_device *s, struct sysdev_attribute *attr, |
794 | char *buf) | ||
790 | { | 795 | { |
791 | strcpy(buf, trigger); | 796 | strcpy(buf, trigger); |
792 | strcat(buf, "\n"); | 797 | strcat(buf, "\n"); |
793 | return strlen(trigger) + 1; | 798 | return strlen(trigger) + 1; |
794 | } | 799 | } |
795 | 800 | ||
796 | static ssize_t set_trigger(struct sys_device *s,const char *buf,size_t siz) | 801 | static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr, |
802 | const char *buf,size_t siz) | ||
797 | { | 803 | { |
798 | char *p; | 804 | char *p; |
799 | int len; | 805 | int len; |
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index 1f4cc48c14c6..d5ae2243f0b9 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c | |||
@@ -35,6 +35,7 @@ atomic_t therm_throt_en = ATOMIC_INIT(0); | |||
35 | 35 | ||
36 | #define define_therm_throt_sysdev_show_func(name) \ | 36 | #define define_therm_throt_sysdev_show_func(name) \ |
37 | static ssize_t therm_throt_sysdev_show_##name(struct sys_device *dev, \ | 37 | static ssize_t therm_throt_sysdev_show_##name(struct sys_device *dev, \ |
38 | struct sysdev_attribute *attr, \ | ||
38 | char *buf) \ | 39 | char *buf) \ |
39 | { \ | 40 | { \ |
40 | unsigned int cpu = dev->id; \ | 41 | unsigned int cpu = dev->id; \ |
diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c index 56b933119a04..fc4790638b69 100644 --- a/arch/x86/kernel/microcode.c +++ b/arch/x86/kernel/microcode.c | |||
@@ -644,7 +644,9 @@ static void microcode_fini_cpu(int cpu) | |||
644 | mutex_unlock(µcode_mutex); | 644 | mutex_unlock(µcode_mutex); |
645 | } | 645 | } |
646 | 646 | ||
647 | static ssize_t reload_store(struct sys_device *dev, const char *buf, size_t sz) | 647 | static ssize_t reload_store(struct sys_device *dev, |
648 | struct sysdev_attribute *attr, | ||
649 | const char *buf, size_t sz) | ||
648 | { | 650 | { |
649 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; | 651 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; |
650 | char *end; | 652 | char *end; |
@@ -674,14 +676,16 @@ static ssize_t reload_store(struct sys_device *dev, const char *buf, size_t sz) | |||
674 | return sz; | 676 | return sz; |
675 | } | 677 | } |
676 | 678 | ||
677 | static ssize_t version_show(struct sys_device *dev, char *buf) | 679 | static ssize_t version_show(struct sys_device *dev, |
680 | struct sysdev_attribute *attr, char *buf) | ||
678 | { | 681 | { |
679 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; | 682 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; |
680 | 683 | ||
681 | return sprintf(buf, "0x%x\n", uci->rev); | 684 | return sprintf(buf, "0x%x\n", uci->rev); |
682 | } | 685 | } |
683 | 686 | ||
684 | static ssize_t pf_show(struct sys_device *dev, char *buf) | 687 | static ssize_t pf_show(struct sys_device *dev, |
688 | struct sysdev_attribute *attr, char *buf) | ||
685 | { | 689 | { |
686 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; | 690 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; |
687 | 691 | ||
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index e38dfed41d80..20537d507909 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -21,15 +21,16 @@ EXPORT_SYMBOL(cpu_sysdev_class); | |||
21 | static DEFINE_PER_CPU(struct sys_device *, cpu_sys_devices); | 21 | static DEFINE_PER_CPU(struct sys_device *, cpu_sys_devices); |
22 | 22 | ||
23 | #ifdef CONFIG_HOTPLUG_CPU | 23 | #ifdef CONFIG_HOTPLUG_CPU |
24 | static ssize_t show_online(struct sys_device *dev, char *buf) | 24 | static ssize_t show_online(struct sys_device *dev, struct sysdev_attribute *attr, |
25 | char *buf) | ||
25 | { | 26 | { |
26 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 27 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); |
27 | 28 | ||
28 | return sprintf(buf, "%u\n", !!cpu_online(cpu->sysdev.id)); | 29 | return sprintf(buf, "%u\n", !!cpu_online(cpu->sysdev.id)); |
29 | } | 30 | } |
30 | 31 | ||
31 | static ssize_t __ref store_online(struct sys_device *dev, const char *buf, | 32 | static ssize_t __ref store_online(struct sys_device *dev, struct sysdev_attribute *attr, |
32 | size_t count) | 33 | const char *buf, size_t count) |
33 | { | 34 | { |
34 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 35 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); |
35 | ssize_t ret; | 36 | ssize_t ret; |
@@ -80,7 +81,8 @@ static inline void register_cpu_control(struct cpu *cpu) | |||
80 | #ifdef CONFIG_KEXEC | 81 | #ifdef CONFIG_KEXEC |
81 | #include <linux/kexec.h> | 82 | #include <linux/kexec.h> |
82 | 83 | ||
83 | static ssize_t show_crash_notes(struct sys_device *dev, char *buf) | 84 | static ssize_t show_crash_notes(struct sys_device *dev, struct sysdev_attribute *attr, |
85 | char *buf) | ||
84 | { | 86 | { |
85 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 87 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); |
86 | ssize_t rc; | 88 | ssize_t rc; |
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); |
diff --git a/drivers/base/node.c b/drivers/base/node.c index 0f867a083338..5116b78c6325 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c | |||
@@ -36,11 +36,13 @@ static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf) | |||
36 | return len; | 36 | return len; |
37 | } | 37 | } |
38 | 38 | ||
39 | static inline ssize_t node_read_cpumask(struct sys_device *dev, char *buf) | 39 | static inline ssize_t node_read_cpumask(struct sys_device *dev, |
40 | struct sysdev_attribute *attr, char *buf) | ||
40 | { | 41 | { |
41 | return node_read_cpumap(dev, 0, buf); | 42 | return node_read_cpumap(dev, 0, buf); |
42 | } | 43 | } |
43 | static inline ssize_t node_read_cpulist(struct sys_device *dev, char *buf) | 44 | static inline ssize_t node_read_cpulist(struct sys_device *dev, |
45 | struct sysdev_attribute *attr, char *buf) | ||
44 | { | 46 | { |
45 | return node_read_cpumap(dev, 1, buf); | 47 | return node_read_cpumap(dev, 1, buf); |
46 | } | 48 | } |
@@ -49,7 +51,8 @@ static SYSDEV_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL); | |||
49 | static SYSDEV_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL); | 51 | static SYSDEV_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL); |
50 | 52 | ||
51 | #define K(x) ((x) << (PAGE_SHIFT - 10)) | 53 | #define K(x) ((x) << (PAGE_SHIFT - 10)) |
52 | static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) | 54 | static ssize_t node_read_meminfo(struct sys_device * dev, |
55 | struct sysdev_attribute *attr, char * buf) | ||
53 | { | 56 | { |
54 | int n; | 57 | int n; |
55 | int nid = dev->id; | 58 | int nid = dev->id; |
@@ -112,7 +115,8 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) | |||
112 | #undef K | 115 | #undef K |
113 | static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL); | 116 | static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL); |
114 | 117 | ||
115 | static ssize_t node_read_numastat(struct sys_device * dev, char * buf) | 118 | static ssize_t node_read_numastat(struct sys_device * dev, |
119 | struct sysdev_attribute *attr, char * buf) | ||
116 | { | 120 | { |
117 | return sprintf(buf, | 121 | return sprintf(buf, |
118 | "numa_hit %lu\n" | 122 | "numa_hit %lu\n" |
@@ -130,7 +134,8 @@ static ssize_t node_read_numastat(struct sys_device * dev, char * buf) | |||
130 | } | 134 | } |
131 | static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); | 135 | static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); |
132 | 136 | ||
133 | static ssize_t node_read_distance(struct sys_device * dev, char * buf) | 137 | static ssize_t node_read_distance(struct sys_device * dev, |
138 | struct sysdev_attribute *attr, char * buf) | ||
134 | { | 139 | { |
135 | int nid = dev->id; | 140 | int nid = dev->id; |
136 | int len = 0; | 141 | int len = 0; |
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 50690d9df248..dc7dace14e1c 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
@@ -36,7 +36,7 @@ sysdev_show(struct kobject * kobj, struct attribute * attr, char * buffer) | |||
36 | struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr); | 36 | struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr); |
37 | 37 | ||
38 | if (sysdev_attr->show) | 38 | if (sysdev_attr->show) |
39 | return sysdev_attr->show(sysdev, buffer); | 39 | return sysdev_attr->show(sysdev, sysdev_attr, buffer); |
40 | return -EIO; | 40 | return -EIO; |
41 | } | 41 | } |
42 | 42 | ||
@@ -49,7 +49,7 @@ sysdev_store(struct kobject * kobj, struct attribute * attr, | |||
49 | struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr); | 49 | struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr); |
50 | 50 | ||
51 | if (sysdev_attr->store) | 51 | if (sysdev_attr->store) |
52 | return sysdev_attr->store(sysdev, buffer, count); | 52 | return sysdev_attr->store(sysdev, sysdev_attr, buffer, count); |
53 | return -EIO; | 53 | return -EIO; |
54 | } | 54 | } |
55 | 55 | ||
diff --git a/drivers/base/topology.c b/drivers/base/topology.c index 3f6d9b0a6abe..199cd97e32e6 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c | |||
@@ -34,7 +34,8 @@ | |||
34 | static SYSDEV_ATTR(_name, 0444, show_##_name, NULL) | 34 | static SYSDEV_ATTR(_name, 0444, show_##_name, NULL) |
35 | 35 | ||
36 | #define define_id_show_func(name) \ | 36 | #define define_id_show_func(name) \ |
37 | static ssize_t show_##name(struct sys_device *dev, char *buf) \ | 37 | static ssize_t show_##name(struct sys_device *dev, \ |
38 | struct sysdev_attribute *attr, char *buf) \ | ||
38 | { \ | 39 | { \ |
39 | unsigned int cpu = dev->id; \ | 40 | unsigned int cpu = dev->id; \ |
40 | return sprintf(buf, "%d\n", topology_##name(cpu)); \ | 41 | return sprintf(buf, "%d\n", topology_##name(cpu)); \ |
@@ -59,14 +60,17 @@ static ssize_t show_cpumap(int type, cpumask_t *mask, char *buf) | |||
59 | 60 | ||
60 | #ifdef arch_provides_topology_pointers | 61 | #ifdef arch_provides_topology_pointers |
61 | #define define_siblings_show_map(name) \ | 62 | #define define_siblings_show_map(name) \ |
62 | static ssize_t show_##name(struct sys_device *dev, char *buf) \ | 63 | static ssize_t show_##name(struct sys_device *dev, \ |
64 | struct sysdev_attribute *attr, char *buf) \ | ||
63 | { \ | 65 | { \ |
64 | unsigned int cpu = dev->id; \ | 66 | unsigned int cpu = dev->id; \ |
65 | return show_cpumap(0, &(topology_##name(cpu)), buf); \ | 67 | return show_cpumap(0, &(topology_##name(cpu)), buf); \ |
66 | } | 68 | } |
67 | 69 | ||
68 | #define define_siblings_show_list(name) \ | 70 | #define define_siblings_show_list(name) \ |
69 | static ssize_t show_##name##_list(struct sys_device *dev, char *buf) \ | 71 | static ssize_t show_##name##_list(struct sys_device *dev, \ |
72 | struct sysdev_attribute *attr, \ | ||
73 | char *buf) \ | ||
70 | { \ | 74 | { \ |
71 | unsigned int cpu = dev->id; \ | 75 | unsigned int cpu = dev->id; \ |
72 | return show_cpumap(1, &(topology_##name(cpu)), buf); \ | 76 | return show_cpumap(1, &(topology_##name(cpu)), buf); \ |
@@ -74,7 +78,8 @@ static ssize_t show_##name##_list(struct sys_device *dev, char *buf) \ | |||
74 | 78 | ||
75 | #else | 79 | #else |
76 | #define define_siblings_show_map(name) \ | 80 | #define define_siblings_show_map(name) \ |
77 | static ssize_t show_##name(struct sys_device *dev, char *buf) \ | 81 | static ssize_t show_##name(struct sys_device *dev, \ |
82 | struct sysdev_attribute *attr, char *buf) \ | ||
78 | { \ | 83 | { \ |
79 | unsigned int cpu = dev->id; \ | 84 | unsigned int cpu = dev->id; \ |
80 | cpumask_t mask = topology_##name(cpu); \ | 85 | cpumask_t mask = topology_##name(cpu); \ |
@@ -82,7 +87,9 @@ static ssize_t show_##name(struct sys_device *dev, char *buf) \ | |||
82 | } | 87 | } |
83 | 88 | ||
84 | #define define_siblings_show_list(name) \ | 89 | #define define_siblings_show_list(name) \ |
85 | static ssize_t show_##name##_list(struct sys_device *dev, char *buf) \ | 90 | static ssize_t show_##name##_list(struct sys_device *dev, \ |
91 | struct sysdev_attribute *attr, \ | ||
92 | char *buf) \ | ||
86 | { \ | 93 | { \ |
87 | unsigned int cpu = dev->id; \ | 94 | unsigned int cpu = dev->id; \ |
88 | cpumask_t mask = topology_##name(cpu); \ | 95 | cpumask_t mask = topology_##name(cpu); \ |
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c index e949618b9be0..31a0e0b455b6 100644 --- a/drivers/cpuidle/sysfs.c +++ b/drivers/cpuidle/sysfs.c | |||
@@ -21,7 +21,8 @@ static int __init cpuidle_sysfs_setup(char *unused) | |||
21 | } | 21 | } |
22 | __setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup); | 22 | __setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup); |
23 | 23 | ||
24 | static ssize_t show_available_governors(struct sys_device *dev, char *buf) | 24 | static ssize_t show_available_governors(struct sys_device *dev, |
25 | struct sysdev_attribute *attr, char *buf) | ||
25 | { | 26 | { |
26 | ssize_t i = 0; | 27 | ssize_t i = 0; |
27 | struct cpuidle_governor *tmp; | 28 | struct cpuidle_governor *tmp; |
@@ -39,7 +40,8 @@ out: | |||
39 | return i; | 40 | return i; |
40 | } | 41 | } |
41 | 42 | ||
42 | static ssize_t show_current_driver(struct sys_device *dev, char *buf) | 43 | static ssize_t show_current_driver(struct sys_device *dev, |
44 | struct sysdev_attribute *attr, char *buf) | ||
43 | { | 45 | { |
44 | ssize_t ret; | 46 | ssize_t ret; |
45 | 47 | ||
@@ -53,7 +55,8 @@ static ssize_t show_current_driver(struct sys_device *dev, char *buf) | |||
53 | return ret; | 55 | return ret; |
54 | } | 56 | } |
55 | 57 | ||
56 | static ssize_t show_current_governor(struct sys_device *dev, char *buf) | 58 | static ssize_t show_current_governor(struct sys_device *dev, |
59 | struct sysdev_attribute *attr, char *buf) | ||
57 | { | 60 | { |
58 | ssize_t ret; | 61 | ssize_t ret; |
59 | 62 | ||
@@ -68,6 +71,7 @@ static ssize_t show_current_governor(struct sys_device *dev, char *buf) | |||
68 | } | 71 | } |
69 | 72 | ||
70 | static ssize_t store_current_governor(struct sys_device *dev, | 73 | static ssize_t store_current_governor(struct sys_device *dev, |
74 | struct sysdev_attribute *attr, | ||
71 | const char *buf, size_t count) | 75 | const char *buf, size_t count) |
72 | { | 76 | { |
73 | char gov_name[CPUIDLE_NAME_LEN]; | 77 | char gov_name[CPUIDLE_NAME_LEN]; |
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 591bc29b55f5..d4427cb86979 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -610,6 +610,7 @@ static ssize_t show_target_kb(struct sys_device *dev, char *buf) | |||
610 | } | 610 | } |
611 | 611 | ||
612 | static ssize_t store_target_kb(struct sys_device *dev, | 612 | static ssize_t store_target_kb(struct sys_device *dev, |
613 | struct sysdev_attribute *attr, | ||
613 | const char *buf, | 614 | const char *buf, |
614 | size_t count) | 615 | size_t count) |
615 | { | 616 | { |
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h index f2767bc6b735..8dcf3162b21b 100644 --- a/include/linux/sysdev.h +++ b/include/linux/sysdev.h | |||
@@ -99,8 +99,9 @@ extern void sysdev_unregister(struct sys_device *); | |||
99 | 99 | ||
100 | struct sysdev_attribute { | 100 | struct sysdev_attribute { |
101 | struct attribute attr; | 101 | struct attribute attr; |
102 | ssize_t (*show)(struct sys_device *, char *); | 102 | ssize_t (*show)(struct sys_device *, struct sysdev_attribute *, char *); |
103 | ssize_t (*store)(struct sys_device *, const char *, size_t); | 103 | ssize_t (*store)(struct sys_device *, struct sysdev_attribute *, |
104 | const char *, size_t); | ||
104 | }; | 105 | }; |
105 | 106 | ||
106 | 107 | ||
diff --git a/kernel/rtmutex-tester.c b/kernel/rtmutex-tester.c index 092e4c620af9..a56f629b057a 100644 --- a/kernel/rtmutex-tester.c +++ b/kernel/rtmutex-tester.c | |||
@@ -297,8 +297,8 @@ static int test_func(void *data) | |||
297 | * | 297 | * |
298 | * opcode:data | 298 | * opcode:data |
299 | */ | 299 | */ |
300 | static ssize_t sysfs_test_command(struct sys_device *dev, const char *buf, | 300 | static ssize_t sysfs_test_command(struct sys_device *dev, struct sysdev_attribute *attr, |
301 | size_t count) | 301 | const char *buf, size_t count) |
302 | { | 302 | { |
303 | struct sched_param schedpar; | 303 | struct sched_param schedpar; |
304 | struct test_thread_data *td; | 304 | struct test_thread_data *td; |
@@ -360,7 +360,8 @@ static ssize_t sysfs_test_command(struct sys_device *dev, const char *buf, | |||
360 | * @dev: thread to query | 360 | * @dev: thread to query |
361 | * @buf: char buffer to be filled with thread status info | 361 | * @buf: char buffer to be filled with thread status info |
362 | */ | 362 | */ |
363 | static ssize_t sysfs_test_status(struct sys_device *dev, char *buf) | 363 | static ssize_t sysfs_test_status(struct sys_device *dev, struct sysdev_attribute *attr, |
364 | char *buf) | ||
364 | { | 365 | { |
365 | struct test_thread_data *td; | 366 | struct test_thread_data *td; |
366 | struct task_struct *tsk; | 367 | struct task_struct *tsk; |
diff --git a/kernel/sched.c b/kernel/sched.c index 99e6d850ecab..b1104ea5d255 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -7737,11 +7737,13 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt) | |||
7737 | } | 7737 | } |
7738 | 7738 | ||
7739 | #ifdef CONFIG_SCHED_MC | 7739 | #ifdef CONFIG_SCHED_MC |
7740 | static ssize_t sched_mc_power_savings_show(struct sys_device *dev, char *page) | 7740 | static ssize_t sched_mc_power_savings_show(struct sys_device *dev, |
7741 | struct sysdev_attribute *attr, char *page) | ||
7741 | { | 7742 | { |
7742 | return sprintf(page, "%u\n", sched_mc_power_savings); | 7743 | return sprintf(page, "%u\n", sched_mc_power_savings); |
7743 | } | 7744 | } |
7744 | static ssize_t sched_mc_power_savings_store(struct sys_device *dev, | 7745 | static ssize_t sched_mc_power_savings_store(struct sys_device *dev, |
7746 | struct sysdev_attribute *attr, | ||
7745 | const char *buf, size_t count) | 7747 | const char *buf, size_t count) |
7746 | { | 7748 | { |
7747 | return sched_power_savings_store(buf, count, 0); | 7749 | return sched_power_savings_store(buf, count, 0); |
@@ -7751,11 +7753,13 @@ static SYSDEV_ATTR(sched_mc_power_savings, 0644, sched_mc_power_savings_show, | |||
7751 | #endif | 7753 | #endif |
7752 | 7754 | ||
7753 | #ifdef CONFIG_SCHED_SMT | 7755 | #ifdef CONFIG_SCHED_SMT |
7754 | static ssize_t sched_smt_power_savings_show(struct sys_device *dev, char *page) | 7756 | static ssize_t sched_smt_power_savings_show(struct sys_device *dev, |
7757 | struct sysdev_attribute *attr, char *page) | ||
7755 | { | 7758 | { |
7756 | return sprintf(page, "%u\n", sched_smt_power_savings); | 7759 | return sprintf(page, "%u\n", sched_smt_power_savings); |
7757 | } | 7760 | } |
7758 | static ssize_t sched_smt_power_savings_store(struct sys_device *dev, | 7761 | static ssize_t sched_smt_power_savings_store(struct sys_device *dev, |
7762 | struct sysdev_attribute *attr, | ||
7759 | const char *buf, size_t count) | 7763 | const char *buf, size_t count) |
7760 | { | 7764 | { |
7761 | return sched_power_savings_store(buf, count, 1); | 7765 | return sched_power_savings_store(buf, count, 1); |
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index dadde5361f32..b1c2da81b050 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
@@ -376,7 +376,8 @@ void clocksource_unregister(struct clocksource *cs) | |||
376 | * Provides sysfs interface for listing current clocksource. | 376 | * Provides sysfs interface for listing current clocksource. |
377 | */ | 377 | */ |
378 | static ssize_t | 378 | static ssize_t |
379 | sysfs_show_current_clocksources(struct sys_device *dev, char *buf) | 379 | sysfs_show_current_clocksources(struct sys_device *dev, |
380 | struct sysdev_attribute *attr, char *buf) | ||
380 | { | 381 | { |
381 | ssize_t count = 0; | 382 | ssize_t count = 0; |
382 | 383 | ||
@@ -397,6 +398,7 @@ sysfs_show_current_clocksources(struct sys_device *dev, char *buf) | |||
397 | * clocksource selction. | 398 | * clocksource selction. |
398 | */ | 399 | */ |
399 | static ssize_t sysfs_override_clocksource(struct sys_device *dev, | 400 | static ssize_t sysfs_override_clocksource(struct sys_device *dev, |
401 | struct sysdev_attribute *attr, | ||
400 | const char *buf, size_t count) | 402 | const char *buf, size_t count) |
401 | { | 403 | { |
402 | struct clocksource *ovr = NULL; | 404 | struct clocksource *ovr = NULL; |
@@ -449,7 +451,9 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev, | |||
449 | * Provides sysfs interface for listing registered clocksources | 451 | * Provides sysfs interface for listing registered clocksources |
450 | */ | 452 | */ |
451 | static ssize_t | 453 | static ssize_t |
452 | sysfs_show_available_clocksources(struct sys_device *dev, char *buf) | 454 | sysfs_show_available_clocksources(struct sys_device *dev, |
455 | struct sysdev_attribute *attr, | ||
456 | char *buf) | ||
453 | { | 457 | { |
454 | struct clocksource *src; | 458 | struct clocksource *src; |
455 | ssize_t count = 0; | 459 | ssize_t count = 0; |