diff options
author | Douglas Thompson <dougthompson@xmission.com> | 2007-07-19 04:50:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:55 -0400 |
commit | 52490c8d07680a7ecc3c1a70a16841455d37e96a (patch) | |
tree | acebfdd53c8512bbda09fee32347828a0d0ed368 /drivers/edac | |
parent | b2ccaecad2b00bf7bc72d5b864425daf43a4080d (diff) |
drivers/edac: edac_device code tidying
For the file edac_device.c perform some coding style enhancements
Add some function header comments
Made for better readability commands
Signed-off-by: Douglas Thompson <dougthompson@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/edac')
-rw-r--r-- | drivers/edac/edac_core.h | 11 | ||||
-rw-r--r-- | drivers/edac/edac_device.c | 105 | ||||
-rw-r--r-- | drivers/edac/edac_device_sysfs.c | 22 |
3 files changed, 62 insertions, 76 deletions
diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h index 8c114572b722..fa3ff8c25b36 100644 --- a/drivers/edac/edac_core.h +++ b/drivers/edac/edac_core.h | |||
@@ -470,8 +470,6 @@ struct edac_device_counter { | |||
470 | u32 ce_count; | 470 | u32 ce_count; |
471 | }; | 471 | }; |
472 | 472 | ||
473 | #define INC_COUNTER(cnt) (cnt++) | ||
474 | |||
475 | /* | 473 | /* |
476 | * An array of these is passed to the alloc() function | 474 | * An array of these is passed to the alloc() function |
477 | * to specify attributes of the edac_block | 475 | * to specify attributes of the edac_block |
@@ -632,15 +630,6 @@ struct edac_device_ctl_info { | |||
632 | #define to_edac_device_ctl_work(w) \ | 630 | #define to_edac_device_ctl_work(w) \ |
633 | container_of(w,struct edac_device_ctl_info,work) | 631 | container_of(w,struct edac_device_ctl_info,work) |
634 | 632 | ||
635 | /* Function to calc the number of delay jiffies from poll_msec */ | ||
636 | static inline void edac_device_calc_delay(struct edac_device_ctl_info *edac_dev) | ||
637 | { | ||
638 | /* convert from msec to jiffies */ | ||
639 | edac_dev->delay = edac_dev->poll_msec * HZ / 1000; | ||
640 | } | ||
641 | |||
642 | #define edac_calc_delay(dev) dev->delay = dev->poll_msec * HZ / 1000; | ||
643 | |||
644 | /* | 633 | /* |
645 | * The alloc() and free() functions for the 'edac_device' control info | 634 | * The alloc() and free() functions for the 'edac_device' control info |
646 | * structure. A MC driver will allocate one of these for each edac_device | 635 | * structure. A MC driver will allocate one of these for each edac_device |
diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c index 258e146efcbd..3ccadda3e723 100644 --- a/drivers/edac/edac_device.c +++ b/drivers/edac/edac_device.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
21 | #include <linux/timer.h> | 21 | #include <linux/timer.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/jiffies.h> | ||
23 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
24 | #include <linux/list.h> | 25 | #include <linux/list.h> |
25 | #include <linux/sysdev.h> | 26 | #include <linux/sysdev.h> |
@@ -31,20 +32,10 @@ | |||
31 | #include "edac_core.h" | 32 | #include "edac_core.h" |
32 | #include "edac_module.h" | 33 | #include "edac_module.h" |
33 | 34 | ||
34 | /* lock to memory controller's control array */ | 35 | /* lock to memory controller's control array 'edac_device_list' */ |
35 | static DECLARE_MUTEX(device_ctls_mutex); | 36 | static DECLARE_MUTEX(device_ctls_mutex); |
36 | static struct list_head edac_device_list = LIST_HEAD_INIT(edac_device_list); | 37 | static struct list_head edac_device_list = LIST_HEAD_INIT(edac_device_list); |
37 | 38 | ||
38 | static inline void lock_device_list(void) | ||
39 | { | ||
40 | down(&device_ctls_mutex); | ||
41 | } | ||
42 | |||
43 | static inline void unlock_device_list(void) | ||
44 | { | ||
45 | up(&device_ctls_mutex); | ||
46 | } | ||
47 | |||
48 | #ifdef CONFIG_EDAC_DEBUG | 39 | #ifdef CONFIG_EDAC_DEBUG |
49 | static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev) | 40 | static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev) |
50 | { | 41 | { |
@@ -58,20 +49,25 @@ static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev) | |||
58 | #endif /* CONFIG_EDAC_DEBUG */ | 49 | #endif /* CONFIG_EDAC_DEBUG */ |
59 | 50 | ||
60 | /* | 51 | /* |
61 | * The alloc() and free() functions for the 'edac_device' control info | 52 | * edac_device_alloc_ctl_info() |
62 | * structure. A MC driver will allocate one of these for each edac_device | 53 | * Allocate a new edac device control info structure |
63 | * it is going to control/register with the EDAC CORE. | 54 | * |
55 | * The control structure is allocated in complete chunk | ||
56 | * from the OS. It is in turn sub allocated to the | ||
57 | * various objects that compose the struture | ||
58 | * | ||
59 | * The structure has a 'nr_instance' array within itself. | ||
60 | * Each instance represents a major component | ||
61 | * Example: L1 cache and L2 cache are 2 instance components | ||
62 | * | ||
63 | * Within each instance is an array of 'nr_blocks' blockoffsets | ||
64 | */ | 64 | */ |
65 | struct edac_device_ctl_info *edac_device_alloc_ctl_info( | 65 | struct edac_device_ctl_info *edac_device_alloc_ctl_info( |
66 | unsigned sz_private, | 66 | unsigned sz_private, |
67 | char *edac_device_name, | 67 | char *edac_device_name, unsigned nr_instances, |
68 | unsigned nr_instances, | 68 | char *edac_block_name, unsigned nr_blocks, |
69 | char *edac_block_name, | 69 | unsigned offset_value, /* zero, 1, or other based offset */ |
70 | unsigned nr_blocks, | 70 | struct edac_attrib_spec *attrib_spec, unsigned nr_attribs) |
71 | unsigned offset_value, | ||
72 | struct edac_attrib_spec | ||
73 | *attrib_spec, | ||
74 | unsigned nr_attribs) | ||
75 | { | 71 | { |
76 | struct edac_device_ctl_info *dev_ctl; | 72 | struct edac_device_ctl_info *dev_ctl; |
77 | struct edac_device_instance *dev_inst, *inst; | 73 | struct edac_device_instance *dev_inst, *inst; |
@@ -90,7 +86,7 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( | |||
90 | * to be at least as stringent as what the compiler would | 86 | * to be at least as stringent as what the compiler would |
91 | * provide if we could simply hardcode everything into a single struct. | 87 | * provide if we could simply hardcode everything into a single struct. |
92 | */ | 88 | */ |
93 | dev_ctl = (struct edac_device_ctl_info *)0; | 89 | dev_ctl = (struct edac_device_ctl_info *)NULL; |
94 | 90 | ||
95 | /* Calc the 'end' offset past the ctl_info structure */ | 91 | /* Calc the 'end' offset past the ctl_info structure */ |
96 | dev_inst = (struct edac_device_instance *) | 92 | dev_inst = (struct edac_device_instance *) |
@@ -114,7 +110,8 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( | |||
114 | total_size = ((unsigned long)pvt) + sz_private; | 110 | total_size = ((unsigned long)pvt) + sz_private; |
115 | 111 | ||
116 | /* Allocate the amount of memory for the set of control structures */ | 112 | /* Allocate the amount of memory for the set of control structures */ |
117 | if ((dev_ctl = kmalloc(total_size, GFP_KERNEL)) == NULL) | 113 | dev_ctl = kzalloc(total_size, GFP_KERNEL); |
114 | if (dev_ctl == NULL) | ||
118 | return NULL; | 115 | return NULL; |
119 | 116 | ||
120 | /* Adjust pointers so they point within the memory we just allocated | 117 | /* Adjust pointers so they point within the memory we just allocated |
@@ -128,14 +125,12 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( | |||
128 | (((char *)dev_ctl) + ((unsigned long)dev_attrib)); | 125 | (((char *)dev_ctl) + ((unsigned long)dev_attrib)); |
129 | pvt = sz_private ? (((char *)dev_ctl) + ((unsigned long)pvt)) : NULL; | 126 | pvt = sz_private ? (((char *)dev_ctl) + ((unsigned long)pvt)) : NULL; |
130 | 127 | ||
131 | memset(dev_ctl, 0, total_size); /* clear all fields */ | ||
132 | dev_ctl->nr_instances = nr_instances; | 128 | dev_ctl->nr_instances = nr_instances; |
133 | dev_ctl->instances = dev_inst; | 129 | dev_ctl->instances = dev_inst; |
134 | dev_ctl->pvt_info = pvt; | 130 | dev_ctl->pvt_info = pvt; |
135 | 131 | ||
136 | /* Name of this edac device, ensure null terminated */ | 132 | /* Name of this edac device */ |
137 | snprintf(dev_ctl->name, sizeof(dev_ctl->name), "%s", edac_device_name); | 133 | snprintf(dev_ctl->name,sizeof(dev_ctl->name),"%s",edac_device_name); |
138 | dev_ctl->name[sizeof(dev_ctl->name) - 1] = '\0'; | ||
139 | 134 | ||
140 | /* Initialize every Instance */ | 135 | /* Initialize every Instance */ |
141 | for (instance = 0; instance < nr_instances; instance++) { | 136 | for (instance = 0; instance < nr_instances; instance++) { |
@@ -148,7 +143,6 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( | |||
148 | /* name of this instance */ | 143 | /* name of this instance */ |
149 | snprintf(inst->name, sizeof(inst->name), | 144 | snprintf(inst->name, sizeof(inst->name), |
150 | "%s%u", edac_device_name, instance); | 145 | "%s%u", edac_device_name, instance); |
151 | inst->name[sizeof(inst->name) - 1] = '\0'; | ||
152 | 146 | ||
153 | /* Initialize every block in each instance */ | 147 | /* Initialize every block in each instance */ |
154 | for (block = 0; block < nr_blocks; block++) { | 148 | for (block = 0; block < nr_blocks; block++) { |
@@ -159,7 +153,6 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( | |||
159 | blk->attribs = attrib_p; | 153 | blk->attribs = attrib_p; |
160 | snprintf(blk->name, sizeof(blk->name), | 154 | snprintf(blk->name, sizeof(blk->name), |
161 | "%s%d", edac_block_name, block+offset_value); | 155 | "%s%d", edac_block_name, block+offset_value); |
162 | blk->name[sizeof(blk->name) - 1] = '\0'; | ||
163 | 156 | ||
164 | debugf1("%s() instance=%d block=%d name=%s\n", | 157 | debugf1("%s() instance=%d block=%d name=%s\n", |
165 | __func__, instance, block, blk->name); | 158 | __func__, instance, block, blk->name); |
@@ -186,7 +179,6 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info( | |||
186 | 179 | ||
187 | return dev_ctl; | 180 | return dev_ctl; |
188 | } | 181 | } |
189 | |||
190 | EXPORT_SYMBOL_GPL(edac_device_alloc_ctl_info); | 182 | EXPORT_SYMBOL_GPL(edac_device_alloc_ctl_info); |
191 | 183 | ||
192 | /* | 184 | /* |
@@ -198,12 +190,17 @@ void edac_device_free_ctl_info(struct edac_device_ctl_info *ctl_info) | |||
198 | { | 190 | { |
199 | kfree(ctl_info); | 191 | kfree(ctl_info); |
200 | } | 192 | } |
201 | |||
202 | EXPORT_SYMBOL_GPL(edac_device_free_ctl_info); | 193 | EXPORT_SYMBOL_GPL(edac_device_free_ctl_info); |
203 | 194 | ||
204 | /* | 195 | /* |
205 | * find_edac_device_by_dev | 196 | * find_edac_device_by_dev |
206 | * scans the edac_device list for a specific 'struct device *' | 197 | * scans the edac_device list for a specific 'struct device *' |
198 | * | ||
199 | * lock to be held prior to call: device_ctls_mutex | ||
200 | * | ||
201 | * Return: | ||
202 | * pointer to control structure managing 'dev' | ||
203 | * NULL if not found on list | ||
207 | */ | 204 | */ |
208 | static struct edac_device_ctl_info *find_edac_device_by_dev(struct device *dev) | 205 | static struct edac_device_ctl_info *find_edac_device_by_dev(struct device *dev) |
209 | { | 206 | { |
@@ -226,6 +223,9 @@ static struct edac_device_ctl_info *find_edac_device_by_dev(struct device *dev) | |||
226 | * add_edac_dev_to_global_list | 223 | * add_edac_dev_to_global_list |
227 | * Before calling this function, caller must | 224 | * Before calling this function, caller must |
228 | * assign a unique value to edac_dev->dev_idx. | 225 | * assign a unique value to edac_dev->dev_idx. |
226 | * | ||
227 | * lock to be held prior to call: device_ctls_mutex | ||
228 | * | ||
229 | * Return: | 229 | * Return: |
230 | * 0 on success | 230 | * 0 on success |
231 | * 1 on failure. | 231 | * 1 on failure. |
@@ -238,7 +238,8 @@ static int add_edac_dev_to_global_list(struct edac_device_ctl_info *edac_dev) | |||
238 | insert_before = &edac_device_list; | 238 | insert_before = &edac_device_list; |
239 | 239 | ||
240 | /* Determine if already on the list */ | 240 | /* Determine if already on the list */ |
241 | if (unlikely((rover = find_edac_device_by_dev(edac_dev->dev)) != NULL)) | 241 | rover = find_edac_device_by_dev(edac_dev->dev); |
242 | if (unlikely(rover != NULL)) | ||
242 | goto fail0; | 243 | goto fail0; |
243 | 244 | ||
244 | /* Insert in ascending order by 'dev_idx', so find position */ | 245 | /* Insert in ascending order by 'dev_idx', so find position */ |
@@ -274,6 +275,8 @@ fail1: | |||
274 | 275 | ||
275 | /* | 276 | /* |
276 | * complete_edac_device_list_del | 277 | * complete_edac_device_list_del |
278 | * | ||
279 | * callback function when reference count is zero | ||
277 | */ | 280 | */ |
278 | static void complete_edac_device_list_del(struct rcu_head *head) | 281 | static void complete_edac_device_list_del(struct rcu_head *head) |
279 | { | 282 | { |
@@ -286,6 +289,9 @@ static void complete_edac_device_list_del(struct rcu_head *head) | |||
286 | 289 | ||
287 | /* | 290 | /* |
288 | * del_edac_device_from_global_list | 291 | * del_edac_device_from_global_list |
292 | * | ||
293 | * remove the RCU, setup for a callback call, then wait for the | ||
294 | * callback to occur | ||
289 | */ | 295 | */ |
290 | static void del_edac_device_from_global_list(struct edac_device_ctl_info | 296 | static void del_edac_device_from_global_list(struct edac_device_ctl_info |
291 | *edac_device) | 297 | *edac_device) |
@@ -325,8 +331,7 @@ struct edac_device_ctl_info *edac_device_find(int idx) | |||
325 | 331 | ||
326 | return NULL; | 332 | return NULL; |
327 | } | 333 | } |
328 | 334 | EXPORT_SYMBOL_GPL(edac_device_find); | |
329 | EXPORT_SYMBOL(edac_device_find); | ||
330 | 335 | ||
331 | /* | 336 | /* |
332 | * edac_device_workq_function | 337 | * edac_device_workq_function |
@@ -338,7 +343,7 @@ static void edac_device_workq_function(struct work_struct *work_req) | |||
338 | struct edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work); | 343 | struct edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work); |
339 | 344 | ||
340 | //debugf0("%s() here and running\n", __func__); | 345 | //debugf0("%s() here and running\n", __func__); |
341 | lock_device_list(); | 346 | down(&device_ctls_mutex); |
342 | 347 | ||
343 | /* Only poll controllers that are running polled and have a check */ | 348 | /* Only poll controllers that are running polled and have a check */ |
344 | if ((edac_dev->op_state == OP_RUNNING_POLL) && | 349 | if ((edac_dev->op_state == OP_RUNNING_POLL) && |
@@ -346,7 +351,7 @@ static void edac_device_workq_function(struct work_struct *work_req) | |||
346 | edac_dev->edac_check(edac_dev); | 351 | edac_dev->edac_check(edac_dev); |
347 | } | 352 | } |
348 | 353 | ||
349 | unlock_device_list(); | 354 | up(&device_ctls_mutex); |
350 | 355 | ||
351 | /* Reschedule */ | 356 | /* Reschedule */ |
352 | queue_delayed_work(edac_workqueue, &edac_dev->work, edac_dev->delay); | 357 | queue_delayed_work(edac_workqueue, &edac_dev->work, edac_dev->delay); |
@@ -363,7 +368,7 @@ void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev, | |||
363 | debugf0("%s()\n", __func__); | 368 | debugf0("%s()\n", __func__); |
364 | 369 | ||
365 | edac_dev->poll_msec = msec; | 370 | edac_dev->poll_msec = msec; |
366 | edac_calc_delay(edac_dev); /* Calc delay jiffies */ | 371 | edac_dev->delay = msecs_to_jiffies(msec); /* Calc delay jiffies */ |
367 | 372 | ||
368 | INIT_DELAYED_WORK(&edac_dev->work, edac_device_workq_function); | 373 | INIT_DELAYED_WORK(&edac_dev->work, edac_device_workq_function); |
369 | queue_delayed_work(edac_workqueue, &edac_dev->work, edac_dev->delay); | 374 | queue_delayed_work(edac_workqueue, &edac_dev->work, edac_dev->delay); |
@@ -391,7 +396,7 @@ void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev) | |||
391 | void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, | 396 | void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, |
392 | unsigned long value) | 397 | unsigned long value) |
393 | { | 398 | { |
394 | lock_device_list(); | 399 | down(&device_ctls_mutex); |
395 | 400 | ||
396 | /* cancel the current workq request */ | 401 | /* cancel the current workq request */ |
397 | edac_device_workq_teardown(edac_dev); | 402 | edac_device_workq_teardown(edac_dev); |
@@ -399,7 +404,7 @@ void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, | |||
399 | /* restart the workq request, with new delay value */ | 404 | /* restart the workq request, with new delay value */ |
400 | edac_device_workq_setup(edac_dev, value); | 405 | edac_device_workq_setup(edac_dev, value); |
401 | 406 | ||
402 | unlock_device_list(); | 407 | up(&device_ctls_mutex); |
403 | } | 408 | } |
404 | 409 | ||
405 | /** | 410 | /** |
@@ -423,7 +428,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx) | |||
423 | if (edac_debug_level >= 3) | 428 | if (edac_debug_level >= 3) |
424 | edac_device_dump_device(edac_dev); | 429 | edac_device_dump_device(edac_dev); |
425 | #endif | 430 | #endif |
426 | lock_device_list(); | 431 | down(&device_ctls_mutex); |
427 | 432 | ||
428 | if (add_edac_dev_to_global_list(edac_dev)) | 433 | if (add_edac_dev_to_global_list(edac_dev)) |
429 | goto fail0; | 434 | goto fail0; |
@@ -461,7 +466,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx) | |||
461 | dev_name(edac_dev), | 466 | dev_name(edac_dev), |
462 | edac_op_state_toString(edac_dev->op_state)); | 467 | edac_op_state_toString(edac_dev->op_state)); |
463 | 468 | ||
464 | unlock_device_list(); | 469 | up(&device_ctls_mutex); |
465 | return 0; | 470 | return 0; |
466 | 471 | ||
467 | fail1: | 472 | fail1: |
@@ -469,10 +474,9 @@ fail1: | |||
469 | del_edac_device_from_global_list(edac_dev); | 474 | del_edac_device_from_global_list(edac_dev); |
470 | 475 | ||
471 | fail0: | 476 | fail0: |
472 | unlock_device_list(); | 477 | up(&device_ctls_mutex); |
473 | return 1; | 478 | return 1; |
474 | } | 479 | } |
475 | |||
476 | EXPORT_SYMBOL_GPL(edac_device_add_device); | 480 | EXPORT_SYMBOL_GPL(edac_device_add_device); |
477 | 481 | ||
478 | /** | 482 | /** |
@@ -494,10 +498,12 @@ struct edac_device_ctl_info *edac_device_del_device(struct device *dev) | |||
494 | 498 | ||
495 | debugf0("MC: %s()\n", __func__); | 499 | debugf0("MC: %s()\n", __func__); |
496 | 500 | ||
497 | lock_device_list(); | 501 | down(&device_ctls_mutex); |
498 | 502 | ||
499 | if ((edac_dev = find_edac_device_by_dev(dev)) == NULL) { | 503 | /* Find the structure on the list, if not there, then leave */ |
500 | unlock_device_list(); | 504 | edac_dev = find_edac_device_by_dev(dev); |
505 | if (edac_dev == NULL) { | ||
506 | up(&device_ctls_mutex); | ||
501 | return NULL; | 507 | return NULL; |
502 | } | 508 | } |
503 | 509 | ||
@@ -513,7 +519,7 @@ struct edac_device_ctl_info *edac_device_del_device(struct device *dev) | |||
513 | /* deregister from global list */ | 519 | /* deregister from global list */ |
514 | del_edac_device_from_global_list(edac_dev); | 520 | del_edac_device_from_global_list(edac_dev); |
515 | 521 | ||
516 | unlock_device_list(); | 522 | up(&device_ctls_mutex); |
517 | 523 | ||
518 | edac_printk(KERN_INFO, EDAC_MC, | 524 | edac_printk(KERN_INFO, EDAC_MC, |
519 | "Removed device %d for %s %s: DEV %s\n", | 525 | "Removed device %d for %s %s: DEV %s\n", |
@@ -522,7 +528,6 @@ struct edac_device_ctl_info *edac_device_del_device(struct device *dev) | |||
522 | 528 | ||
523 | return edac_dev; | 529 | return edac_dev; |
524 | } | 530 | } |
525 | |||
526 | EXPORT_SYMBOL_GPL(edac_device_del_device); | 531 | EXPORT_SYMBOL_GPL(edac_device_del_device); |
527 | 532 | ||
528 | static inline int edac_device_get_log_ce(struct edac_device_ctl_info *edac_dev) | 533 | static inline int edac_device_get_log_ce(struct edac_device_ctl_info *edac_dev) |
@@ -585,7 +590,6 @@ void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, | |||
585 | edac_dev->ctl_name, instance->name, | 590 | edac_dev->ctl_name, instance->name, |
586 | block ? block->name : "N/A", msg); | 591 | block ? block->name : "N/A", msg); |
587 | } | 592 | } |
588 | |||
589 | EXPORT_SYMBOL_GPL(edac_device_handle_ce); | 593 | EXPORT_SYMBOL_GPL(edac_device_handle_ce); |
590 | 594 | ||
591 | /* | 595 | /* |
@@ -637,5 +641,4 @@ void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev, | |||
637 | edac_dev->ctl_name, instance->name, | 641 | edac_dev->ctl_name, instance->name, |
638 | block ? block->name : "N/A", msg); | 642 | block ? block->name : "N/A", msg); |
639 | } | 643 | } |
640 | |||
641 | EXPORT_SYMBOL_GPL(edac_device_handle_ue); | 644 | EXPORT_SYMBOL_GPL(edac_device_handle_ue); |
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c index 5bf7cbab27d4..7a233e6e2b36 100644 --- a/drivers/edac/edac_device_sysfs.c +++ b/drivers/edac/edac_device_sysfs.c | |||
@@ -292,8 +292,8 @@ static void edac_device_ctrl_instance_release(struct kobject *kobj) | |||
292 | /* instance specific attribute structure */ | 292 | /* instance specific attribute structure */ |
293 | struct instance_attribute { | 293 | struct instance_attribute { |
294 | struct attribute attr; | 294 | struct attribute attr; |
295 | ssize_t(*show) (struct edac_device_instance *, char *); | 295 | ssize_t(*show) (struct edac_device_instance *, char *); |
296 | ssize_t(*store) (struct edac_device_instance *, const char *, size_t); | 296 | ssize_t(*store) (struct edac_device_instance *, const char *, size_t); |
297 | }; | 297 | }; |
298 | 298 | ||
299 | /* Function to 'show' fields from the edac_dev 'instance' structure */ | 299 | /* Function to 'show' fields from the edac_dev 'instance' structure */ |
@@ -540,9 +540,8 @@ static int edac_device_create_instance(struct edac_device_ctl_info *edac_dev, | |||
540 | for (i = 0; i < instance->nr_blocks; i++) { | 540 | for (i = 0; i < instance->nr_blocks; i++) { |
541 | err = edac_device_create_block(edac_dev, instance, i); | 541 | err = edac_device_create_block(edac_dev, instance, i); |
542 | if (err) { | 542 | if (err) { |
543 | for (j = 0; j < i; j++) { | 543 | for (j = 0; j < i; j++) |
544 | edac_device_delete_block(edac_dev, instance, j); | 544 | edac_device_delete_block(edac_dev, instance, j); |
545 | } | ||
546 | return err; | 545 | return err; |
547 | } | 546 | } |
548 | } | 547 | } |
@@ -566,9 +565,8 @@ static void edac_device_delete_instance(struct edac_device_ctl_info *edac_dev, | |||
566 | instance = &edac_dev->instances[idx]; | 565 | instance = &edac_dev->instances[idx]; |
567 | 566 | ||
568 | /* unregister all blocks in this instance */ | 567 | /* unregister all blocks in this instance */ |
569 | for (i = 0; i < instance->nr_blocks; i++) { | 568 | for (i = 0; i < instance->nr_blocks; i++) |
570 | edac_device_delete_block(edac_dev, instance, i); | 569 | edac_device_delete_block(edac_dev, instance, i); |
571 | } | ||
572 | 570 | ||
573 | /* unregister this instance's kobject */ | 571 | /* unregister this instance's kobject */ |
574 | init_completion(&instance->kobj_complete); | 572 | init_completion(&instance->kobj_complete); |
@@ -593,9 +591,8 @@ static int edac_device_create_instances(struct edac_device_ctl_info *edac_dev) | |||
593 | err = edac_device_create_instance(edac_dev, i); | 591 | err = edac_device_create_instance(edac_dev, i); |
594 | if (err) { | 592 | if (err) { |
595 | /* unwind previous instances on error */ | 593 | /* unwind previous instances on error */ |
596 | for (j = 0; j < i; j++) { | 594 | for (j = 0; j < i; j++) |
597 | edac_device_delete_instance(edac_dev, j); | 595 | edac_device_delete_instance(edac_dev, j); |
598 | } | ||
599 | return err; | 596 | return err; |
600 | } | 597 | } |
601 | } | 598 | } |
@@ -612,9 +609,8 @@ static void edac_device_delete_instances(struct edac_device_ctl_info *edac_dev) | |||
612 | int i; | 609 | int i; |
613 | 610 | ||
614 | /* iterate over creation of the instances */ | 611 | /* iterate over creation of the instances */ |
615 | for (i = 0; i < edac_dev->nr_instances; i++) { | 612 | for (i = 0; i < edac_dev->nr_instances; i++) |
616 | edac_device_delete_instance(edac_dev, i); | 613 | edac_device_delete_instance(edac_dev, i); |
617 | } | ||
618 | } | 614 | } |
619 | 615 | ||
620 | /******************* edac_dev sysfs ctor/dtor code *************/ | 616 | /******************* edac_dev sysfs ctor/dtor code *************/ |
@@ -637,9 +633,8 @@ static int edac_device_add_sysfs_attributes( | |||
637 | while (sysfs_attrib->attr.name != NULL) { | 633 | while (sysfs_attrib->attr.name != NULL) { |
638 | err = sysfs_create_file(&edac_dev->kobj, | 634 | err = sysfs_create_file(&edac_dev->kobj, |
639 | (struct attribute*) sysfs_attrib); | 635 | (struct attribute*) sysfs_attrib); |
640 | if (err) { | 636 | if (err) |
641 | return err; | 637 | return err; |
642 | } | ||
643 | 638 | ||
644 | sysfs_attrib++; | 639 | sysfs_attrib++; |
645 | } | 640 | } |
@@ -696,9 +691,8 @@ int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev) | |||
696 | 691 | ||
697 | /* Create the first level instance directories */ | 692 | /* Create the first level instance directories */ |
698 | err = edac_device_create_instances(edac_dev); | 693 | err = edac_device_create_instances(edac_dev); |
699 | if (err) { | 694 | if (err) |
700 | goto err_remove_link; | 695 | goto err_remove_link; |
701 | } | ||
702 | 696 | ||
703 | return 0; | 697 | return 0; |
704 | 698 | ||