diff options
author | Douglas Thompson <dougthompson@xmission.com> | 2007-07-19 04:49:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:54 -0400 |
commit | 079708b9173595bf74b31b14c36e946359ae6c7e (patch) | |
tree | 79ed508a2ccdcf8d8095923cb4613594ed0af54d /drivers/edac/edac_device_sysfs.c | |
parent | 4de78c6877ec21142582ac19453c2d453d1ea298 (diff) |
drivers/edac: core Lindent cleanup
Run the EDAC CORE files through Lindent for cleanup
Signed-off-by: Douglas Thompson <dougthompson@xmission.com>
Signed-off-by: Dave Jiang <djiang@mvista.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/edac/edac_device_sysfs.c')
-rw-r--r-- | drivers/edac/edac_device_sysfs.c | 389 |
1 files changed, 175 insertions, 214 deletions
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c index afb190502646..69305e637810 100644 --- a/drivers/edac/edac_device_sysfs.c +++ b/drivers/edac/edac_device_sysfs.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include "edac_core.h" | 16 | #include "edac_core.h" |
17 | #include "edac_module.h" | 17 | #include "edac_module.h" |
18 | 18 | ||
19 | |||
20 | #define EDAC_DEVICE_SYMLINK "device" | 19 | #define EDAC_DEVICE_SYMLINK "device" |
21 | 20 | ||
22 | #define to_edacdev(k) container_of(k, struct edac_device_ctl_info, kobj) | 21 | #define to_edacdev(k) container_of(k, struct edac_device_ctl_info, kobj) |
@@ -25,43 +24,41 @@ | |||
25 | #ifdef DKT | 24 | #ifdef DKT |
26 | 25 | ||
27 | static ssize_t edac_dev_ue_count_show(struct edac_device_ctl_info *edac_dev, | 26 | static ssize_t edac_dev_ue_count_show(struct edac_device_ctl_info *edac_dev, |
28 | char *data) | 27 | char *data) |
29 | { | 28 | { |
30 | return sprintf(data,"%d\n", edac_dev->ue_count); | 29 | return sprintf(data, "%d\n", edac_dev->ue_count); |
31 | } | 30 | } |
32 | 31 | ||
33 | static ssize_t edac_dev_ce_count_show(struct edac_device_ctl_info *edac_dev, | 32 | static ssize_t edac_dev_ce_count_show(struct edac_device_ctl_info *edac_dev, |
34 | char *data) | 33 | char *data) |
35 | { | 34 | { |
36 | return sprintf(data,"%d\n", edac_dev->ce_count); | 35 | return sprintf(data, "%d\n", edac_dev->ce_count); |
37 | } | 36 | } |
38 | 37 | ||
39 | static ssize_t edac_dev_seconds_show(struct edac_device_ctl_info *edac_dev, | 38 | static ssize_t edac_dev_seconds_show(struct edac_device_ctl_info *edac_dev, |
40 | char *data) | 39 | char *data) |
41 | { | 40 | { |
42 | return sprintf(data,"%ld\n", (jiffies - edac_dev->start_time) / HZ); | 41 | return sprintf(data, "%ld\n", (jiffies - edac_dev->start_time) / HZ); |
43 | } | 42 | } |
44 | 43 | ||
45 | static ssize_t edac_dev_ctl_name_show(struct edac_device_ctl_info *edac_dev, | 44 | static ssize_t edac_dev_ctl_name_show(struct edac_device_ctl_info *edac_dev, |
46 | char *data) | 45 | char *data) |
47 | { | 46 | { |
48 | return sprintf(data,"%s\n", edac_dev->ctl_name); | 47 | return sprintf(data, "%s\n", edac_dev->ctl_name); |
49 | } | 48 | } |
50 | 49 | ||
51 | |||
52 | struct edacdev_attribute { | 50 | struct edacdev_attribute { |
53 | struct attribute attr; | 51 | struct attribute attr; |
54 | ssize_t (*show)(struct edac_device_ctl_info *,char *); | 52 | ssize_t(*show) (struct edac_device_ctl_info *, char *); |
55 | ssize_t (*store)(struct edac_device_ctl_info *, const char *,size_t); | 53 | ssize_t(*store) (struct edac_device_ctl_info *, const char *, size_t); |
56 | }; | 54 | }; |
57 | 55 | ||
58 | |||
59 | /* EDAC DEVICE show/store functions for top most object */ | 56 | /* EDAC DEVICE show/store functions for top most object */ |
60 | static ssize_t edacdev_show(struct kobject *kobj, struct attribute *attr, | 57 | static ssize_t edacdev_show(struct kobject *kobj, struct attribute *attr, |
61 | char *buffer) | 58 | char *buffer) |
62 | { | 59 | { |
63 | struct edac_device_ctl_info *edac_dev = to_edacdev(kobj); | 60 | struct edac_device_ctl_info *edac_dev = to_edacdev(kobj); |
64 | struct edacdev_attribute * edacdev_attr = to_edacdev_attr(attr); | 61 | struct edacdev_attribute *edacdev_attr = to_edacdev_attr(attr); |
65 | 62 | ||
66 | if (edacdev_attr->show) | 63 | if (edacdev_attr->show) |
67 | return edacdev_attr->show(edac_dev, buffer); | 64 | return edacdev_attr->show(edac_dev, buffer); |
@@ -70,10 +67,10 @@ static ssize_t edacdev_show(struct kobject *kobj, struct attribute *attr, | |||
70 | } | 67 | } |
71 | 68 | ||
72 | static ssize_t edacdev_store(struct kobject *kobj, struct attribute *attr, | 69 | static ssize_t edacdev_store(struct kobject *kobj, struct attribute *attr, |
73 | const char *buffer, size_t count) | 70 | const char *buffer, size_t count) |
74 | { | 71 | { |
75 | struct edac_device_ctl_info *edac_dev = to_edacdev(kobj); | 72 | struct edac_device_ctl_info *edac_dev = to_edacdev(kobj); |
76 | struct edacdev_attribute * edacdev_attr = to_edacdev_attr(attr); | 73 | struct edacdev_attribute *edacdev_attr = to_edacdev_attr(attr); |
77 | 74 | ||
78 | if (edacdev_attr->store) | 75 | if (edacdev_attr->store) |
79 | return edacdev_attr->store(edac_dev, buffer, count); | 76 | return edacdev_attr->store(edac_dev, buffer, count); |
@@ -94,14 +91,13 @@ static struct edacdev_attribute edac_dev_attr_##_name = { \ | |||
94 | }; | 91 | }; |
95 | 92 | ||
96 | /* default Control file */ | 93 | /* default Control file */ |
97 | EDACDEV_ATTR(reset_counters,S_IWUSR,NULL,edac_dev_reset_counters_store); | 94 | EDACDEV_ATTR(reset_counters, S_IWUSR, NULL, edac_dev_reset_counters_store); |
98 | 95 | ||
99 | /* default Attribute files */ | 96 | /* default Attribute files */ |
100 | EDACDEV_ATTR(mc_name,S_IRUGO,edac_dev_ctl_name_show,NULL); | 97 | EDACDEV_ATTR(mc_name, S_IRUGO, edac_dev_ctl_name_show, NULL); |
101 | EDACDEV_ATTR(seconds_since_reset,S_IRUGO,edac_dev_seconds_show,NULL); | 98 | EDACDEV_ATTR(seconds_since_reset, S_IRUGO, edac_dev_seconds_show, NULL); |
102 | EDACDEV_ATTR(ue_count,S_IRUGO,edac_dev_ue_count_show,NULL); | 99 | EDACDEV_ATTR(ue_count, S_IRUGO, edac_dev_ue_count_show, NULL); |
103 | EDACDEV_ATTR(ce_count,S_IRUGO,edac_dev_ce_count_show,NULL); | 100 | EDACDEV_ATTR(ce_count, S_IRUGO, edac_dev_ce_count_show, NULL); |
104 | |||
105 | 101 | ||
106 | static struct edacdev_attribute *edacdev_attr[] = { | 102 | static struct edacdev_attribute *edacdev_attr[] = { |
107 | &edacdev_attr_reset_counters, | 103 | &edacdev_attr_reset_counters, |
@@ -127,7 +123,7 @@ static void edac_dev_instance_release(struct kobject *kobj) | |||
127 | static struct kobj_type ktype_device = { | 123 | static struct kobj_type ktype_device = { |
128 | .release = edac_dev_instance_release, | 124 | .release = edac_dev_instance_release, |
129 | .sysfs_ops = &edacdev_ops, | 125 | .sysfs_ops = &edacdev_ops, |
130 | .default_attrs = (struct attribute **) edacdev_attr, | 126 | .default_attrs = (struct attribute **)edacdev_attr, |
131 | }; | 127 | }; |
132 | 128 | ||
133 | #endif | 129 | #endif |
@@ -139,67 +135,66 @@ static struct kobj_type ktype_device = { | |||
139 | */ | 135 | */ |
140 | 136 | ||
141 | /* 'log_ue' */ | 137 | /* 'log_ue' */ |
142 | static ssize_t edac_device_ctl_log_ue_show( | 138 | static ssize_t edac_device_ctl_log_ue_show(struct edac_device_ctl_info |
143 | struct edac_device_ctl_info *ctl_info, char *data) | 139 | *ctl_info, char *data) |
144 | { | 140 | { |
145 | return sprintf(data,"%u\n", ctl_info->log_ue); | 141 | return sprintf(data, "%u\n", ctl_info->log_ue); |
146 | } | 142 | } |
147 | 143 | ||
148 | static ssize_t edac_device_ctl_log_ue_store( | 144 | static ssize_t edac_device_ctl_log_ue_store(struct edac_device_ctl_info |
149 | struct edac_device_ctl_info *ctl_info, | 145 | *ctl_info, const char *data, |
150 | const char *data,size_t count) | 146 | size_t count) |
151 | { | 147 | { |
152 | /* if parameter is zero, turn off flag, if non-zero turn on flag */ | 148 | /* if parameter is zero, turn off flag, if non-zero turn on flag */ |
153 | ctl_info->log_ue = (simple_strtoul(data,NULL,0) != 0); | 149 | ctl_info->log_ue = (simple_strtoul(data, NULL, 0) != 0); |
154 | 150 | ||
155 | return count; | 151 | return count; |
156 | } | 152 | } |
157 | 153 | ||
158 | /* 'log_ce' */ | 154 | /* 'log_ce' */ |
159 | static ssize_t edac_device_ctl_log_ce_show( | 155 | static ssize_t edac_device_ctl_log_ce_show(struct edac_device_ctl_info |
160 | struct edac_device_ctl_info *ctl_info,char *data) | 156 | *ctl_info, char *data) |
161 | { | 157 | { |
162 | return sprintf(data,"%u\n", ctl_info->log_ce); | 158 | return sprintf(data, "%u\n", ctl_info->log_ce); |
163 | } | 159 | } |
164 | 160 | ||
165 | static ssize_t edac_device_ctl_log_ce_store( | 161 | static ssize_t edac_device_ctl_log_ce_store(struct edac_device_ctl_info |
166 | struct edac_device_ctl_info *ctl_info, | 162 | *ctl_info, const char *data, |
167 | const char *data,size_t count) | 163 | size_t count) |
168 | { | 164 | { |
169 | /* if parameter is zero, turn off flag, if non-zero turn on flag */ | 165 | /* if parameter is zero, turn off flag, if non-zero turn on flag */ |
170 | ctl_info->log_ce = (simple_strtoul(data,NULL,0) != 0); | 166 | ctl_info->log_ce = (simple_strtoul(data, NULL, 0) != 0); |
171 | 167 | ||
172 | return count; | 168 | return count; |
173 | } | 169 | } |
174 | 170 | ||
175 | |||
176 | /* 'panic_on_ue' */ | 171 | /* 'panic_on_ue' */ |
177 | static ssize_t edac_device_ctl_panic_on_ue_show( | 172 | static ssize_t edac_device_ctl_panic_on_ue_show(struct edac_device_ctl_info |
178 | struct edac_device_ctl_info *ctl_info, char *data) | 173 | *ctl_info, char *data) |
179 | { | 174 | { |
180 | return sprintf(data,"%u\n", ctl_info->panic_on_ue); | 175 | return sprintf(data, "%u\n", ctl_info->panic_on_ue); |
181 | } | 176 | } |
182 | 177 | ||
183 | static ssize_t edac_device_ctl_panic_on_ue_store( | 178 | static ssize_t edac_device_ctl_panic_on_ue_store(struct edac_device_ctl_info |
184 | struct edac_device_ctl_info *ctl_info, | 179 | *ctl_info, const char *data, |
185 | const char *data,size_t count) | 180 | size_t count) |
186 | { | 181 | { |
187 | /* if parameter is zero, turn off flag, if non-zero turn on flag */ | 182 | /* if parameter is zero, turn off flag, if non-zero turn on flag */ |
188 | ctl_info->panic_on_ue = (simple_strtoul(data,NULL,0) != 0); | 183 | ctl_info->panic_on_ue = (simple_strtoul(data, NULL, 0) != 0); |
189 | 184 | ||
190 | return count; | 185 | return count; |
191 | } | 186 | } |
192 | 187 | ||
193 | /* 'poll_msec' show and store functions*/ | 188 | /* 'poll_msec' show and store functions*/ |
194 | static ssize_t edac_device_ctl_poll_msec_show( | 189 | static ssize_t edac_device_ctl_poll_msec_show(struct edac_device_ctl_info |
195 | struct edac_device_ctl_info *ctl_info, char *data) | 190 | *ctl_info, char *data) |
196 | { | 191 | { |
197 | return sprintf(data,"%u\n", ctl_info->poll_msec); | 192 | return sprintf(data, "%u\n", ctl_info->poll_msec); |
198 | } | 193 | } |
199 | 194 | ||
200 | static ssize_t edac_device_ctl_poll_msec_store( | 195 | static ssize_t edac_device_ctl_poll_msec_store(struct edac_device_ctl_info |
201 | struct edac_device_ctl_info *ctl_info, | 196 | *ctl_info, const char *data, |
202 | const char *data,size_t count) | 197 | size_t count) |
203 | { | 198 | { |
204 | unsigned long value; | 199 | unsigned long value; |
205 | 200 | ||
@@ -208,18 +203,17 @@ static ssize_t edac_device_ctl_poll_msec_store( | |||
208 | * Then cancel last outstanding delay for the work request | 203 | * Then cancel last outstanding delay for the work request |
209 | * and set a new one. | 204 | * and set a new one. |
210 | */ | 205 | */ |
211 | value = simple_strtoul(data,NULL,0); | 206 | value = simple_strtoul(data, NULL, 0); |
212 | edac_device_reset_delay_period(ctl_info,value); | 207 | edac_device_reset_delay_period(ctl_info, value); |
213 | 208 | ||
214 | return count; | 209 | return count; |
215 | } | 210 | } |
216 | 211 | ||
217 | |||
218 | /* edac_device_ctl_info specific attribute structure */ | 212 | /* edac_device_ctl_info specific attribute structure */ |
219 | struct ctl_info_attribute { | 213 | struct ctl_info_attribute { |
220 | struct attribute attr; | 214 | struct attribute attr; |
221 | ssize_t (*show)(struct edac_device_ctl_info *,char *); | 215 | ssize_t(*show) (struct edac_device_ctl_info *, char *); |
222 | ssize_t (*store)(struct edac_device_ctl_info *,const char *,size_t); | 216 | ssize_t(*store) (struct edac_device_ctl_info *, const char *, size_t); |
223 | }; | 217 | }; |
224 | 218 | ||
225 | #define to_ctl_info(k) container_of(k, struct edac_device_ctl_info, kobj) | 219 | #define to_ctl_info(k) container_of(k, struct edac_device_ctl_info, kobj) |
@@ -227,34 +221,33 @@ struct ctl_info_attribute { | |||
227 | 221 | ||
228 | /* Function to 'show' fields from the edac_dev 'ctl_info' structure */ | 222 | /* Function to 'show' fields from the edac_dev 'ctl_info' structure */ |
229 | static ssize_t edac_dev_ctl_info_show(struct kobject *kobj, | 223 | static ssize_t edac_dev_ctl_info_show(struct kobject *kobj, |
230 | struct attribute *attr, | 224 | struct attribute *attr, char *buffer) |
231 | char *buffer) | ||
232 | { | 225 | { |
233 | struct edac_device_ctl_info *edac_dev = to_ctl_info(kobj); | 226 | struct edac_device_ctl_info *edac_dev = to_ctl_info(kobj); |
234 | struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr); | 227 | struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr); |
235 | 228 | ||
236 | if (ctl_info_attr->show) | 229 | if (ctl_info_attr->show) |
237 | return ctl_info_attr->show(edac_dev,buffer); | 230 | return ctl_info_attr->show(edac_dev, buffer); |
238 | return -EIO; | 231 | return -EIO; |
239 | } | 232 | } |
240 | 233 | ||
241 | /* Function to 'store' fields into the edac_dev 'ctl_info' structure */ | 234 | /* Function to 'store' fields into the edac_dev 'ctl_info' structure */ |
242 | static ssize_t edac_dev_ctl_info_store(struct kobject *kobj, | 235 | static ssize_t edac_dev_ctl_info_store(struct kobject *kobj, |
243 | struct attribute *attr, | 236 | struct attribute *attr, |
244 | const char *buffer, size_t count) | 237 | const char *buffer, size_t count) |
245 | { | 238 | { |
246 | struct edac_device_ctl_info *edac_dev = to_ctl_info(kobj); | 239 | struct edac_device_ctl_info *edac_dev = to_ctl_info(kobj); |
247 | struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr); | 240 | struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr); |
248 | 241 | ||
249 | if (ctl_info_attr->store) | 242 | if (ctl_info_attr->store) |
250 | return ctl_info_attr->store(edac_dev, buffer, count); | 243 | return ctl_info_attr->store(edac_dev, buffer, count); |
251 | return -EIO; | 244 | return -EIO; |
252 | } | 245 | } |
253 | 246 | ||
254 | /* edac_dev file operations for an 'ctl_info' */ | 247 | /* edac_dev file operations for an 'ctl_info' */ |
255 | static struct sysfs_ops device_ctl_info_ops = { | 248 | static struct sysfs_ops device_ctl_info_ops = { |
256 | .show = edac_dev_ctl_info_show, | 249 | .show = edac_dev_ctl_info_show, |
257 | .store = edac_dev_ctl_info_store | 250 | .store = edac_dev_ctl_info_store |
258 | }; | 251 | }; |
259 | 252 | ||
260 | #define CTL_INFO_ATTR(_name,_mode,_show,_store) \ | 253 | #define CTL_INFO_ATTR(_name,_mode,_show,_store) \ |
@@ -264,21 +257,16 @@ static struct ctl_info_attribute attr_ctl_info_##_name = { \ | |||
264 | .store = _store, \ | 257 | .store = _store, \ |
265 | }; | 258 | }; |
266 | 259 | ||
267 | |||
268 | /* Declare the various ctl_info attributes here and their respective ops */ | 260 | /* Declare the various ctl_info attributes here and their respective ops */ |
269 | CTL_INFO_ATTR(log_ue,S_IRUGO|S_IWUSR, | 261 | CTL_INFO_ATTR(log_ue, S_IRUGO | S_IWUSR, |
270 | edac_device_ctl_log_ue_show, | 262 | edac_device_ctl_log_ue_show, edac_device_ctl_log_ue_store); |
271 | edac_device_ctl_log_ue_store); | 263 | CTL_INFO_ATTR(log_ce, S_IRUGO | S_IWUSR, |
272 | CTL_INFO_ATTR(log_ce,S_IRUGO|S_IWUSR, | 264 | edac_device_ctl_log_ce_show, edac_device_ctl_log_ce_store); |
273 | edac_device_ctl_log_ce_show, | 265 | CTL_INFO_ATTR(panic_on_ue, S_IRUGO | S_IWUSR, |
274 | edac_device_ctl_log_ce_store); | 266 | edac_device_ctl_panic_on_ue_show, |
275 | CTL_INFO_ATTR(panic_on_ue,S_IRUGO|S_IWUSR, | 267 | edac_device_ctl_panic_on_ue_store); |
276 | edac_device_ctl_panic_on_ue_show, | 268 | CTL_INFO_ATTR(poll_msec, S_IRUGO | S_IWUSR, |
277 | edac_device_ctl_panic_on_ue_store); | 269 | edac_device_ctl_poll_msec_show, edac_device_ctl_poll_msec_store); |
278 | CTL_INFO_ATTR(poll_msec,S_IRUGO|S_IWUSR, | ||
279 | edac_device_ctl_poll_msec_show, | ||
280 | edac_device_ctl_poll_msec_store); | ||
281 | |||
282 | 270 | ||
283 | /* Base Attributes of the EDAC_DEVICE ECC object */ | 271 | /* Base Attributes of the EDAC_DEVICE ECC object */ |
284 | static struct ctl_info_attribute *device_ctrl_attr[] = { | 272 | static struct ctl_info_attribute *device_ctrl_attr[] = { |
@@ -303,10 +291,9 @@ static void edac_device_ctrl_master_release(struct kobject *kobj) | |||
303 | static struct kobj_type ktype_device_ctrl = { | 291 | static struct kobj_type ktype_device_ctrl = { |
304 | .release = edac_device_ctrl_master_release, | 292 | .release = edac_device_ctrl_master_release, |
305 | .sysfs_ops = &device_ctl_info_ops, | 293 | .sysfs_ops = &device_ctl_info_ops, |
306 | .default_attrs = (struct attribute **) device_ctrl_attr, | 294 | .default_attrs = (struct attribute **)device_ctrl_attr, |
307 | }; | 295 | }; |
308 | 296 | ||
309 | |||
310 | /**************** edac_device main kobj ctor/dtor code *********************/ | 297 | /**************** edac_device main kobj ctor/dtor code *********************/ |
311 | 298 | ||
312 | /* | 299 | /* |
@@ -317,41 +304,39 @@ static struct kobj_type ktype_device_ctrl = { | |||
317 | * Return: 0 SUCCESS | 304 | * Return: 0 SUCCESS |
318 | * !0 FAILURE | 305 | * !0 FAILURE |
319 | */ | 306 | */ |
320 | static int edac_device_register_main_kobj( | 307 | static int edac_device_register_main_kobj(struct edac_device_ctl_info *edac_dev) |
321 | struct edac_device_ctl_info *edac_dev) | ||
322 | { | 308 | { |
323 | int err = 0; | 309 | int err = 0; |
324 | struct sysdev_class *edac_class; | 310 | struct sysdev_class *edac_class; |
325 | 311 | ||
326 | debugf1("%s()\n", __func__); | 312 | debugf1("%s()\n", __func__); |
327 | 313 | ||
328 | /* get the /sys/devices/system/edac reference */ | 314 | /* get the /sys/devices/system/edac reference */ |
329 | edac_class = edac_get_edac_class(); | 315 | edac_class = edac_get_edac_class(); |
330 | if (edac_class == NULL) { | 316 | if (edac_class == NULL) { |
331 | debugf1("%s() no edac_class error=%d\n", __func__, err); | 317 | debugf1("%s() no edac_class error=%d\n", __func__, err); |
332 | return err; | 318 | return err; |
333 | } | 319 | } |
334 | 320 | ||
335 | /* Point to the 'edac_class' this instance 'reports' to */ | 321 | /* Point to the 'edac_class' this instance 'reports' to */ |
336 | edac_dev->edac_class = edac_class; | 322 | edac_dev->edac_class = edac_class; |
337 | 323 | ||
338 | /* Init the devices's kobject */ | 324 | /* Init the devices's kobject */ |
339 | memset(&edac_dev->kobj, 0, sizeof (struct kobject)); | 325 | memset(&edac_dev->kobj, 0, sizeof(struct kobject)); |
340 | edac_dev->kobj.ktype = &ktype_device_ctrl; | 326 | edac_dev->kobj.ktype = &ktype_device_ctrl; |
341 | 327 | ||
342 | /* set this new device under the edac_class kobject */ | 328 | /* set this new device under the edac_class kobject */ |
343 | edac_dev->kobj.parent = &edac_class->kset.kobj; | 329 | edac_dev->kobj.parent = &edac_class->kset.kobj; |
344 | 330 | ||
345 | /* generate sysfs "..../edac/<name>" */ | 331 | /* generate sysfs "..../edac/<name>" */ |
346 | debugf1("%s() set name of kobject to: %s\n", | 332 | debugf1("%s() set name of kobject to: %s\n", __func__, edac_dev->name); |
347 | __func__, edac_dev->name); | 333 | err = kobject_set_name(&edac_dev->kobj, "%s", edac_dev->name); |
348 | err = kobject_set_name(&edac_dev->kobj,"%s",edac_dev->name); | ||
349 | if (err) | 334 | if (err) |
350 | return err; | 335 | return err; |
351 | err = kobject_register(&edac_dev->kobj); | 336 | err = kobject_register(&edac_dev->kobj); |
352 | if (err) { | 337 | if (err) { |
353 | debugf1("%s()Failed to register '.../edac/%s'\n", | 338 | debugf1("%s()Failed to register '.../edac/%s'\n", |
354 | __func__,edac_dev->name); | 339 | __func__, edac_dev->name); |
355 | return err; | 340 | return err; |
356 | } | 341 | } |
357 | 342 | ||
@@ -365,8 +350,8 @@ static int edac_device_register_main_kobj( | |||
365 | * edac_device_unregister_main_kobj: | 350 | * edac_device_unregister_main_kobj: |
366 | * the '..../edac/<name>' kobject | 351 | * the '..../edac/<name>' kobject |
367 | */ | 352 | */ |
368 | static void edac_device_unregister_main_kobj( | 353 | static void edac_device_unregister_main_kobj(struct edac_device_ctl_info |
369 | struct edac_device_ctl_info *edac_dev) | 354 | *edac_dev) |
370 | { | 355 | { |
371 | debugf0("%s()\n", __func__); | 356 | debugf0("%s()\n", __func__); |
372 | debugf1("%s() name of kobject is: %s\n", | 357 | debugf1("%s() name of kobject is: %s\n", |
@@ -382,26 +367,23 @@ static void edac_device_unregister_main_kobj( | |||
382 | wait_for_completion(&edac_dev->kobj_complete); | 367 | wait_for_completion(&edac_dev->kobj_complete); |
383 | } | 368 | } |
384 | 369 | ||
385 | |||
386 | /*************** edac_dev -> instance information ***********/ | 370 | /*************** edac_dev -> instance information ***********/ |
387 | 371 | ||
388 | /* | 372 | /* |
389 | * Set of low-level instance attribute show functions | 373 | * Set of low-level instance attribute show functions |
390 | */ | 374 | */ |
391 | static ssize_t instance_ue_count_show( | 375 | static ssize_t instance_ue_count_show(struct edac_device_instance *instance, |
392 | struct edac_device_instance *instance, char *data) | 376 | char *data) |
393 | { | 377 | { |
394 | return sprintf(data,"%u\n", instance->counters.ue_count); | 378 | return sprintf(data, "%u\n", instance->counters.ue_count); |
395 | } | 379 | } |
396 | 380 | ||
397 | static ssize_t instance_ce_count_show( | 381 | static ssize_t instance_ce_count_show(struct edac_device_instance *instance, |
398 | struct edac_device_instance *instance, char *data) | 382 | char *data) |
399 | { | 383 | { |
400 | return sprintf(data,"%u\n", instance->counters.ce_count); | 384 | return sprintf(data, "%u\n", instance->counters.ce_count); |
401 | } | 385 | } |
402 | 386 | ||
403 | |||
404 | |||
405 | #define to_instance(k) container_of(k, struct edac_device_instance, kobj) | 387 | #define to_instance(k) container_of(k, struct edac_device_instance, kobj) |
406 | #define to_instance_attr(a) container_of(a,struct instance_attribute,attr) | 388 | #define to_instance_attr(a) container_of(a,struct instance_attribute,attr) |
407 | 389 | ||
@@ -416,48 +398,42 @@ static void edac_device_ctrl_instance_release(struct kobject *kobj) | |||
416 | complete(&instance->kobj_complete); | 398 | complete(&instance->kobj_complete); |
417 | } | 399 | } |
418 | 400 | ||
419 | |||
420 | /* instance specific attribute structure */ | 401 | /* instance specific attribute structure */ |
421 | struct instance_attribute { | 402 | struct instance_attribute { |
422 | struct attribute attr; | 403 | struct attribute attr; |
423 | ssize_t (*show)(struct edac_device_instance *,char *); | 404 | ssize_t(*show) (struct edac_device_instance *, char *); |
424 | ssize_t (*store)(struct edac_device_instance *,const char *,size_t); | 405 | ssize_t(*store) (struct edac_device_instance *, const char *, size_t); |
425 | }; | 406 | }; |
426 | 407 | ||
427 | |||
428 | /* Function to 'show' fields from the edac_dev 'instance' structure */ | 408 | /* Function to 'show' fields from the edac_dev 'instance' structure */ |
429 | static ssize_t edac_dev_instance_show(struct kobject *kobj, | 409 | static ssize_t edac_dev_instance_show(struct kobject *kobj, |
430 | struct attribute *attr, | 410 | struct attribute *attr, char *buffer) |
431 | char *buffer) | ||
432 | { | 411 | { |
433 | struct edac_device_instance *instance = to_instance(kobj); | 412 | struct edac_device_instance *instance = to_instance(kobj); |
434 | struct instance_attribute *instance_attr = to_instance_attr(attr); | 413 | struct instance_attribute *instance_attr = to_instance_attr(attr); |
435 | 414 | ||
436 | if (instance_attr->show) | 415 | if (instance_attr->show) |
437 | return instance_attr->show(instance,buffer); | 416 | return instance_attr->show(instance, buffer); |
438 | return -EIO; | 417 | return -EIO; |
439 | } | 418 | } |
440 | 419 | ||
441 | |||
442 | /* Function to 'store' fields into the edac_dev 'instance' structure */ | 420 | /* Function to 'store' fields into the edac_dev 'instance' structure */ |
443 | static ssize_t edac_dev_instance_store(struct kobject *kobj, | 421 | static ssize_t edac_dev_instance_store(struct kobject *kobj, |
444 | struct attribute *attr, | 422 | struct attribute *attr, |
445 | const char *buffer, size_t count) | 423 | const char *buffer, size_t count) |
446 | { | 424 | { |
447 | struct edac_device_instance *instance = to_instance(kobj); | 425 | struct edac_device_instance *instance = to_instance(kobj); |
448 | struct instance_attribute *instance_attr = to_instance_attr(attr); | 426 | struct instance_attribute *instance_attr = to_instance_attr(attr); |
449 | 427 | ||
450 | if (instance_attr->store) | 428 | if (instance_attr->store) |
451 | return instance_attr->store(instance, buffer, count); | 429 | return instance_attr->store(instance, buffer, count); |
452 | return -EIO; | 430 | return -EIO; |
453 | } | 431 | } |
454 | 432 | ||
455 | |||
456 | |||
457 | /* edac_dev file operations for an 'instance' */ | 433 | /* edac_dev file operations for an 'instance' */ |
458 | static struct sysfs_ops device_instance_ops = { | 434 | static struct sysfs_ops device_instance_ops = { |
459 | .show = edac_dev_instance_show, | 435 | .show = edac_dev_instance_show, |
460 | .store = edac_dev_instance_store | 436 | .store = edac_dev_instance_store |
461 | }; | 437 | }; |
462 | 438 | ||
463 | #define INSTANCE_ATTR(_name,_mode,_show,_store) \ | 439 | #define INSTANCE_ATTR(_name,_mode,_show,_store) \ |
@@ -472,8 +448,8 @@ static struct instance_attribute attr_instance_##_name = { \ | |||
472 | * Each contains a pointer to a show and an optional set | 448 | * Each contains a pointer to a show and an optional set |
473 | * function pointer that does the low level output/input | 449 | * function pointer that does the low level output/input |
474 | */ | 450 | */ |
475 | INSTANCE_ATTR(ce_count,S_IRUGO,instance_ce_count_show,NULL); | 451 | INSTANCE_ATTR(ce_count, S_IRUGO, instance_ce_count_show, NULL); |
476 | INSTANCE_ATTR(ue_count,S_IRUGO,instance_ue_count_show,NULL); | 452 | INSTANCE_ATTR(ue_count, S_IRUGO, instance_ue_count_show, NULL); |
477 | 453 | ||
478 | /* list of edac_dev 'instance' attributes */ | 454 | /* list of edac_dev 'instance' attributes */ |
479 | static struct instance_attribute *device_instance_attr[] = { | 455 | static struct instance_attribute *device_instance_attr[] = { |
@@ -486,29 +462,24 @@ static struct instance_attribute *device_instance_attr[] = { | |||
486 | static struct kobj_type ktype_instance_ctrl = { | 462 | static struct kobj_type ktype_instance_ctrl = { |
487 | .release = edac_device_ctrl_instance_release, | 463 | .release = edac_device_ctrl_instance_release, |
488 | .sysfs_ops = &device_instance_ops, | 464 | .sysfs_ops = &device_instance_ops, |
489 | .default_attrs = (struct attribute **) device_instance_attr, | 465 | .default_attrs = (struct attribute **)device_instance_attr, |
490 | }; | 466 | }; |
491 | 467 | ||
492 | |||
493 | /*************** edac_dev -> instance -> block information *********/ | 468 | /*************** edac_dev -> instance -> block information *********/ |
494 | 469 | ||
495 | /* | 470 | /* |
496 | * Set of low-level block attribute show functions | 471 | * Set of low-level block attribute show functions |
497 | */ | 472 | */ |
498 | static ssize_t block_ue_count_show( | 473 | static ssize_t block_ue_count_show(struct edac_device_block *block, char *data) |
499 | struct edac_device_block *block, char *data) | ||
500 | { | 474 | { |
501 | return sprintf(data,"%u\n", block->counters.ue_count); | 475 | return sprintf(data, "%u\n", block->counters.ue_count); |
502 | } | 476 | } |
503 | 477 | ||
504 | static ssize_t block_ce_count_show( | 478 | static ssize_t block_ce_count_show(struct edac_device_block *block, char *data) |
505 | struct edac_device_block *block, char *data) | ||
506 | { | 479 | { |
507 | return sprintf(data,"%u\n", block->counters.ce_count); | 480 | return sprintf(data, "%u\n", block->counters.ce_count); |
508 | } | 481 | } |
509 | 482 | ||
510 | |||
511 | |||
512 | #define to_block(k) container_of(k, struct edac_device_block, kobj) | 483 | #define to_block(k) container_of(k, struct edac_device_block, kobj) |
513 | #define to_block_attr(a) container_of(a,struct block_attribute,attr) | 484 | #define to_block_attr(a) container_of(a,struct block_attribute,attr) |
514 | 485 | ||
@@ -525,46 +496,42 @@ static void edac_device_ctrl_block_release(struct kobject *kobj) | |||
525 | 496 | ||
526 | /* block specific attribute structure */ | 497 | /* block specific attribute structure */ |
527 | struct block_attribute { | 498 | struct block_attribute { |
528 | struct attribute attr; | 499 | struct attribute attr; |
529 | ssize_t (*show)(struct edac_device_block *,char *); | 500 | ssize_t(*show) (struct edac_device_block *, char *); |
530 | ssize_t (*store)(struct edac_device_block *,const char *,size_t); | 501 | ssize_t(*store) (struct edac_device_block *, const char *, size_t); |
531 | }; | 502 | }; |
532 | 503 | ||
533 | /* Function to 'show' fields from the edac_dev 'block' structure */ | 504 | /* Function to 'show' fields from the edac_dev 'block' structure */ |
534 | static ssize_t edac_dev_block_show(struct kobject *kobj, | 505 | static ssize_t edac_dev_block_show(struct kobject *kobj, |
535 | struct attribute *attr, | 506 | struct attribute *attr, char *buffer) |
536 | char *buffer) | ||
537 | { | 507 | { |
538 | struct edac_device_block *block = to_block(kobj); | 508 | struct edac_device_block *block = to_block(kobj); |
539 | struct block_attribute *block_attr = to_block_attr(attr); | 509 | struct block_attribute *block_attr = to_block_attr(attr); |
540 | 510 | ||
541 | if (block_attr->show) | 511 | if (block_attr->show) |
542 | return block_attr->show(block,buffer); | 512 | return block_attr->show(block, buffer); |
543 | return -EIO; | 513 | return -EIO; |
544 | } | 514 | } |
545 | 515 | ||
546 | |||
547 | /* Function to 'store' fields into the edac_dev 'block' structure */ | 516 | /* Function to 'store' fields into the edac_dev 'block' structure */ |
548 | static ssize_t edac_dev_block_store(struct kobject *kobj, | 517 | static ssize_t edac_dev_block_store(struct kobject *kobj, |
549 | struct attribute *attr, | 518 | struct attribute *attr, |
550 | const char *buffer, size_t count) | 519 | const char *buffer, size_t count) |
551 | { | 520 | { |
552 | struct edac_device_block *block = to_block(kobj); | 521 | struct edac_device_block *block = to_block(kobj); |
553 | struct block_attribute *block_attr = to_block_attr(attr); | 522 | struct block_attribute *block_attr = to_block_attr(attr); |
554 | 523 | ||
555 | if (block_attr->store) | 524 | if (block_attr->store) |
556 | return block_attr->store(block, buffer, count); | 525 | return block_attr->store(block, buffer, count); |
557 | return -EIO; | 526 | return -EIO; |
558 | } | 527 | } |
559 | 528 | ||
560 | |||
561 | /* edac_dev file operations for a 'block' */ | 529 | /* edac_dev file operations for a 'block' */ |
562 | static struct sysfs_ops device_block_ops = { | 530 | static struct sysfs_ops device_block_ops = { |
563 | .show = edac_dev_block_show, | 531 | .show = edac_dev_block_show, |
564 | .store = edac_dev_block_store | 532 | .store = edac_dev_block_store |
565 | }; | 533 | }; |
566 | 534 | ||
567 | |||
568 | #define BLOCK_ATTR(_name,_mode,_show,_store) \ | 535 | #define BLOCK_ATTR(_name,_mode,_show,_store) \ |
569 | static struct block_attribute attr_block_##_name = { \ | 536 | static struct block_attribute attr_block_##_name = { \ |
570 | .attr = {.name = __stringify(_name), .mode = _mode }, \ | 537 | .attr = {.name = __stringify(_name), .mode = _mode }, \ |
@@ -572,9 +539,8 @@ static struct block_attribute attr_block_##_name = { \ | |||
572 | .store = _store, \ | 539 | .store = _store, \ |
573 | }; | 540 | }; |
574 | 541 | ||
575 | BLOCK_ATTR(ce_count,S_IRUGO,block_ce_count_show,NULL); | 542 | BLOCK_ATTR(ce_count, S_IRUGO, block_ce_count_show, NULL); |
576 | BLOCK_ATTR(ue_count,S_IRUGO,block_ue_count_show,NULL); | 543 | BLOCK_ATTR(ue_count, S_IRUGO, block_ue_count_show, NULL); |
577 | |||
578 | 544 | ||
579 | /* list of edac_dev 'block' attributes */ | 545 | /* list of edac_dev 'block' attributes */ |
580 | static struct block_attribute *device_block_attr[] = { | 546 | static struct block_attribute *device_block_attr[] = { |
@@ -587,19 +553,17 @@ static struct block_attribute *device_block_attr[] = { | |||
587 | static struct kobj_type ktype_block_ctrl = { | 553 | static struct kobj_type ktype_block_ctrl = { |
588 | .release = edac_device_ctrl_block_release, | 554 | .release = edac_device_ctrl_block_release, |
589 | .sysfs_ops = &device_block_ops, | 555 | .sysfs_ops = &device_block_ops, |
590 | .default_attrs = (struct attribute **) device_block_attr, | 556 | .default_attrs = (struct attribute **)device_block_attr, |
591 | }; | 557 | }; |
592 | 558 | ||
593 | |||
594 | /************** block ctor/dtor code ************/ | 559 | /************** block ctor/dtor code ************/ |
595 | 560 | ||
596 | /* | 561 | /* |
597 | * edac_device_create_block | 562 | * edac_device_create_block |
598 | */ | 563 | */ |
599 | static int edac_device_create_block( | 564 | static int edac_device_create_block(struct edac_device_ctl_info *edac_dev, |
600 | struct edac_device_ctl_info *edac_dev, | 565 | struct edac_device_instance *instance, |
601 | struct edac_device_instance *instance, | 566 | int idx) |
602 | int idx) | ||
603 | { | 567 | { |
604 | int err; | 568 | int err; |
605 | struct edac_device_block *block; | 569 | struct edac_device_block *block; |
@@ -607,21 +571,21 @@ static int edac_device_create_block( | |||
607 | block = &instance->blocks[idx]; | 571 | block = &instance->blocks[idx]; |
608 | 572 | ||
609 | debugf1("%s() Instance '%s' block[%d] '%s'\n", | 573 | debugf1("%s() Instance '%s' block[%d] '%s'\n", |
610 | __func__,instance->name, idx, block->name); | 574 | __func__, instance->name, idx, block->name); |
611 | 575 | ||
612 | /* init this block's kobject */ | 576 | /* init this block's kobject */ |
613 | memset(&block->kobj, 0, sizeof (struct kobject)); | 577 | memset(&block->kobj, 0, sizeof(struct kobject)); |
614 | block->kobj.parent = &instance->kobj; | 578 | block->kobj.parent = &instance->kobj; |
615 | block->kobj.ktype = &ktype_block_ctrl; | 579 | block->kobj.ktype = &ktype_block_ctrl; |
616 | 580 | ||
617 | err = kobject_set_name(&block->kobj,"%s",block->name); | 581 | err = kobject_set_name(&block->kobj, "%s", block->name); |
618 | if (err) | 582 | if (err) |
619 | return err; | 583 | return err; |
620 | 584 | ||
621 | err = kobject_register(&block->kobj); | 585 | err = kobject_register(&block->kobj); |
622 | if (err) { | 586 | if (err) { |
623 | debugf1("%s()Failed to register instance '%s'\n", | 587 | debugf1("%s()Failed to register instance '%s'\n", |
624 | __func__,block->name); | 588 | __func__, block->name); |
625 | return err; | 589 | return err; |
626 | } | 590 | } |
627 | 591 | ||
@@ -631,10 +595,9 @@ static int edac_device_create_block( | |||
631 | /* | 595 | /* |
632 | * edac_device_delete_block(edac_dev,j); | 596 | * edac_device_delete_block(edac_dev,j); |
633 | */ | 597 | */ |
634 | static void edac_device_delete_block( | 598 | static void edac_device_delete_block(struct edac_device_ctl_info *edac_dev, |
635 | struct edac_device_ctl_info *edac_dev, | 599 | struct edac_device_instance *instance, |
636 | struct edac_device_instance *instance, | 600 | int idx) |
637 | int idx) | ||
638 | { | 601 | { |
639 | struct edac_device_block *block; | 602 | struct edac_device_block *block; |
640 | 603 | ||
@@ -652,8 +615,8 @@ static void edac_device_delete_block( | |||
652 | * edac_device_create_instance | 615 | * edac_device_create_instance |
653 | * create just one instance of an edac_device 'instance' | 616 | * create just one instance of an edac_device 'instance' |
654 | */ | 617 | */ |
655 | static int edac_device_create_instance( | 618 | static int edac_device_create_instance(struct edac_device_ctl_info *edac_dev, |
656 | struct edac_device_ctl_info *edac_dev, int idx) | 619 | int idx) |
657 | { | 620 | { |
658 | int i, j; | 621 | int i, j; |
659 | int err; | 622 | int err; |
@@ -662,32 +625,32 @@ static int edac_device_create_instance( | |||
662 | instance = &edac_dev->instances[idx]; | 625 | instance = &edac_dev->instances[idx]; |
663 | 626 | ||
664 | /* Init the instance's kobject */ | 627 | /* Init the instance's kobject */ |
665 | memset(&instance->kobj, 0, sizeof (struct kobject)); | 628 | memset(&instance->kobj, 0, sizeof(struct kobject)); |
666 | 629 | ||
667 | /* set this new device under the edac_device main kobject */ | 630 | /* set this new device under the edac_device main kobject */ |
668 | instance->kobj.parent = &edac_dev->kobj; | 631 | instance->kobj.parent = &edac_dev->kobj; |
669 | instance->kobj.ktype = &ktype_instance_ctrl; | 632 | instance->kobj.ktype = &ktype_instance_ctrl; |
670 | 633 | ||
671 | err = kobject_set_name(&instance->kobj,"%s",instance->name); | 634 | err = kobject_set_name(&instance->kobj, "%s", instance->name); |
672 | if (err) | 635 | if (err) |
673 | return err; | 636 | return err; |
674 | 637 | ||
675 | err = kobject_register(&instance->kobj); | 638 | err = kobject_register(&instance->kobj); |
676 | if (err != 0) { | 639 | if (err != 0) { |
677 | debugf2("%s() Failed to register instance '%s'\n", | 640 | debugf2("%s() Failed to register instance '%s'\n", |
678 | __func__,instance->name); | 641 | __func__, instance->name); |
679 | return err; | 642 | return err; |
680 | } | 643 | } |
681 | 644 | ||
682 | debugf1("%s() now register '%d' blocks for instance %d\n", | 645 | debugf1("%s() now register '%d' blocks for instance %d\n", |
683 | __func__,instance->nr_blocks,idx); | 646 | __func__, instance->nr_blocks, idx); |
684 | 647 | ||
685 | /* register all blocks of this instance */ | 648 | /* register all blocks of this instance */ |
686 | for (i = 0; i < instance->nr_blocks; i++ ) { | 649 | for (i = 0; i < instance->nr_blocks; i++) { |
687 | err = edac_device_create_block(edac_dev,instance,i); | 650 | err = edac_device_create_block(edac_dev, instance, i); |
688 | if (err) { | 651 | if (err) { |
689 | for (j = 0; j < i; j++) { | 652 | for (j = 0; j < i; j++) { |
690 | edac_device_delete_block(edac_dev,instance,j); | 653 | edac_device_delete_block(edac_dev, instance, j); |
691 | } | 654 | } |
692 | return err; | 655 | return err; |
693 | } | 656 | } |
@@ -703,8 +666,8 @@ static int edac_device_create_instance( | |||
703 | * edac_device_remove_instance | 666 | * edac_device_remove_instance |
704 | * remove an edac_device instance | 667 | * remove an edac_device instance |
705 | */ | 668 | */ |
706 | static void edac_device_delete_instance( | 669 | static void edac_device_delete_instance(struct edac_device_ctl_info *edac_dev, |
707 | struct edac_device_ctl_info *edac_dev, int idx) | 670 | int idx) |
708 | { | 671 | { |
709 | int i; | 672 | int i; |
710 | struct edac_device_instance *instance; | 673 | struct edac_device_instance *instance; |
@@ -713,7 +676,7 @@ static void edac_device_delete_instance( | |||
713 | 676 | ||
714 | /* unregister all blocks in this instance */ | 677 | /* unregister all blocks in this instance */ |
715 | for (i = 0; i < instance->nr_blocks; i++) { | 678 | for (i = 0; i < instance->nr_blocks; i++) { |
716 | edac_device_delete_block(edac_dev,instance,i); | 679 | edac_device_delete_block(edac_dev, instance, i); |
717 | } | 680 | } |
718 | 681 | ||
719 | /* unregister this instance's kobject */ | 682 | /* unregister this instance's kobject */ |
@@ -735,12 +698,12 @@ static int edac_device_create_instances(struct edac_device_ctl_info *edac_dev) | |||
735 | debugf0("%s()\n", __func__); | 698 | debugf0("%s()\n", __func__); |
736 | 699 | ||
737 | /* iterate over creation of the instances */ | 700 | /* iterate over creation of the instances */ |
738 | for (i = 0; i < edac_dev->nr_instances; i++ ) { | 701 | for (i = 0; i < edac_dev->nr_instances; i++) { |
739 | err = edac_device_create_instance(edac_dev,i); | 702 | err = edac_device_create_instance(edac_dev, i); |
740 | if (err) { | 703 | if (err) { |
741 | /* unwind previous instances on error */ | 704 | /* unwind previous instances on error */ |
742 | for (j = 0; j < i; j++) { | 705 | for (j = 0; j < i; j++) { |
743 | edac_device_delete_instance(edac_dev,j); | 706 | edac_device_delete_instance(edac_dev, j); |
744 | } | 707 | } |
745 | return err; | 708 | return err; |
746 | } | 709 | } |
@@ -758,8 +721,8 @@ static void edac_device_delete_instances(struct edac_device_ctl_info *edac_dev) | |||
758 | int i; | 721 | int i; |
759 | 722 | ||
760 | /* iterate over creation of the instances */ | 723 | /* iterate over creation of the instances */ |
761 | for (i = 0; i < edac_dev->nr_instances; i++ ) { | 724 | for (i = 0; i < edac_dev->nr_instances; i++) { |
762 | edac_device_delete_instance(edac_dev,i); | 725 | edac_device_delete_instance(edac_dev, i); |
763 | } | 726 | } |
764 | } | 727 | } |
765 | 728 | ||
@@ -777,7 +740,7 @@ static void edac_device_delete_instances(struct edac_device_ctl_info *edac_dev) | |||
777 | int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev) | 740 | int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev) |
778 | { | 741 | { |
779 | int err; | 742 | int err; |
780 | struct kobject *edac_kobj=&edac_dev->kobj; | 743 | struct kobject *edac_kobj = &edac_dev->kobj; |
781 | 744 | ||
782 | /* register this instance's main kobj with the edac class kobj */ | 745 | /* register this instance's main kobj with the edac class kobj */ |
783 | err = edac_device_register_main_kobj(edac_dev); | 746 | err = edac_device_register_main_kobj(edac_dev); |
@@ -790,8 +753,7 @@ int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev) | |||
790 | * to the platform 'device' being used for this | 753 | * to the platform 'device' being used for this |
791 | */ | 754 | */ |
792 | err = sysfs_create_link(edac_kobj, | 755 | err = sysfs_create_link(edac_kobj, |
793 | &edac_dev->dev->kobj, | 756 | &edac_dev->dev->kobj, EDAC_DEVICE_SYMLINK); |
794 | EDAC_DEVICE_SYMLINK); | ||
795 | if (err) { | 757 | if (err) { |
796 | debugf0("%s() sysfs_create_link() returned err= %d\n", | 758 | debugf0("%s() sysfs_create_link() returned err= %d\n", |
797 | __func__, err); | 759 | __func__, err); |
@@ -811,7 +773,7 @@ int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev) | |||
811 | 773 | ||
812 | /* Error unwind stack */ | 774 | /* Error unwind stack */ |
813 | 775 | ||
814 | error0: | 776 | error0: |
815 | edac_device_unregister_main_kobj(edac_dev); | 777 | edac_device_unregister_main_kobj(edac_dev); |
816 | 778 | ||
817 | return err; | 779 | return err; |
@@ -834,4 +796,3 @@ void edac_device_remove_sysfs(struct edac_device_ctl_info *edac_dev) | |||
834 | /* unregister the instance's main kobj */ | 796 | /* unregister the instance's main kobj */ |
835 | edac_device_unregister_main_kobj(edac_dev); | 797 | edac_device_unregister_main_kobj(edac_dev); |
836 | } | 798 | } |
837 | |||