aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/edac/edac_device.c')
-rw-r--r--drivers/edac/edac_device.c110
1 files changed, 56 insertions, 54 deletions
diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index dfdfc4bbeba8..258e146efcbd 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -94,16 +94,16 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
94 94
95 /* Calc the 'end' offset past the ctl_info structure */ 95 /* Calc the 'end' offset past the ctl_info structure */
96 dev_inst = (struct edac_device_instance *) 96 dev_inst = (struct edac_device_instance *)
97 edac_align_ptr(&dev_ctl[1], sizeof(*dev_inst)); 97 edac_align_ptr(&dev_ctl[1], sizeof(*dev_inst));
98 98
99 /* Calc the 'end' offset past the instance array */ 99 /* Calc the 'end' offset past the instance array */
100 dev_blk = (struct edac_device_block *) 100 dev_blk = (struct edac_device_block *)
101 edac_align_ptr(&dev_inst[nr_instances], sizeof(*dev_blk)); 101 edac_align_ptr(&dev_inst[nr_instances], sizeof(*dev_blk));
102 102
103 /* Calc the 'end' offset past the dev_blk array */ 103 /* Calc the 'end' offset past the dev_blk array */
104 count = nr_instances * nr_blocks; 104 count = nr_instances * nr_blocks;
105 dev_attrib = (struct edac_attrib *) 105 dev_attrib = (struct edac_attrib *)
106 edac_align_ptr(&dev_blk[count], sizeof(*dev_attrib)); 106 edac_align_ptr(&dev_blk[count], sizeof(*dev_attrib));
107 107
108 /* Check for case of NO attributes specified */ 108 /* Check for case of NO attributes specified */
109 if (nr_attribs > 0) 109 if (nr_attribs > 0)
@@ -121,11 +121,11 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
121 * rather than an imaginary chunk of memory located at address 0. 121 * rather than an imaginary chunk of memory located at address 0.
122 */ 122 */
123 dev_inst = (struct edac_device_instance *) 123 dev_inst = (struct edac_device_instance *)
124 (((char *)dev_ctl) + ((unsigned long)dev_inst)); 124 (((char *)dev_ctl) + ((unsigned long)dev_inst));
125 dev_blk = (struct edac_device_block *) 125 dev_blk = (struct edac_device_block *)
126 (((char *)dev_ctl) + ((unsigned long)dev_blk)); 126 (((char *)dev_ctl) + ((unsigned long)dev_blk));
127 dev_attrib = (struct edac_attrib *) 127 dev_attrib = (struct edac_attrib *)
128 (((char *)dev_ctl) + ((unsigned long)dev_attrib)); 128 (((char *)dev_ctl) + ((unsigned long)dev_attrib));
129 pvt = sz_private ? (((char *)dev_ctl) + ((unsigned long)pvt)) : NULL; 129 pvt = sz_private ? (((char *)dev_ctl) + ((unsigned long)pvt)) : NULL;
130 130
131 memset(dev_ctl, 0, total_size); /* clear all fields */ 131 memset(dev_ctl, 0, total_size); /* clear all fields */
@@ -257,18 +257,18 @@ static int add_edac_dev_to_global_list(struct edac_device_ctl_info *edac_dev)
257 list_add_tail_rcu(&edac_dev->link, insert_before); 257 list_add_tail_rcu(&edac_dev->link, insert_before);
258 return 0; 258 return 0;
259 259
260 fail0: 260fail0:
261 edac_printk(KERN_WARNING, EDAC_MC, 261 edac_printk(KERN_WARNING, EDAC_MC,
262 "%s (%s) %s %s already assigned %d\n", 262 "%s (%s) %s %s already assigned %d\n",
263 rover->dev->bus_id, dev_name(rover), 263 rover->dev->bus_id, dev_name(rover),
264 rover->mod_name, rover->ctl_name, rover->dev_idx); 264 rover->mod_name, rover->ctl_name, rover->dev_idx);
265 return 1; 265 return 1;
266 266
267 fail1: 267fail1:
268 edac_printk(KERN_WARNING, EDAC_MC, 268 edac_printk(KERN_WARNING, EDAC_MC,
269 "bug in low-level driver: attempt to assign\n" 269 "bug in low-level driver: attempt to assign\n"
270 " duplicate dev_idx %d in %s()\n", rover->dev_idx, 270 " duplicate dev_idx %d in %s()\n", rover->dev_idx,
271 __func__); 271 __func__);
272 return 1; 272 return 1;
273} 273}
274 274
@@ -288,7 +288,7 @@ static void complete_edac_device_list_del(struct rcu_head *head)
288 * del_edac_device_from_global_list 288 * del_edac_device_from_global_list
289 */ 289 */
290static void del_edac_device_from_global_list(struct edac_device_ctl_info 290static void del_edac_device_from_global_list(struct edac_device_ctl_info
291 *edac_device) 291 *edac_device)
292{ 292{
293 list_del_rcu(&edac_device->link); 293 list_del_rcu(&edac_device->link);
294 init_completion(&edac_device->complete); 294 init_completion(&edac_device->complete);
@@ -342,8 +342,8 @@ static void edac_device_workq_function(struct work_struct *work_req)
342 342
343 /* Only poll controllers that are running polled and have a check */ 343 /* Only poll controllers that are running polled and have a check */
344 if ((edac_dev->op_state == OP_RUNNING_POLL) && 344 if ((edac_dev->op_state == OP_RUNNING_POLL) &&
345 (edac_dev->edac_check != NULL)) { 345 (edac_dev->edac_check != NULL)) {
346 edac_dev->edac_check(edac_dev); 346 edac_dev->edac_check(edac_dev);
347 } 347 }
348 348
349 unlock_device_list(); 349 unlock_device_list();
@@ -358,7 +358,7 @@ static void edac_device_workq_function(struct work_struct *work_req)
358 * passing in the new delay period in msec 358 * passing in the new delay period in msec
359 */ 359 */
360void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev, 360void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev,
361 unsigned msec) 361 unsigned msec)
362{ 362{
363 debugf0("%s()\n", __func__); 363 debugf0("%s()\n", __func__);
364 364
@@ -389,7 +389,7 @@ void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev)
389 */ 389 */
390 390
391void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, 391void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev,
392 unsigned long value) 392 unsigned long value)
393{ 393{
394 lock_device_list(); 394 lock_device_list();
395 395
@@ -434,7 +434,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx)
434 /* create this instance's sysfs entries */ 434 /* create this instance's sysfs entries */
435 if (edac_device_create_sysfs(edac_dev)) { 435 if (edac_device_create_sysfs(edac_dev)) {
436 edac_device_printk(edac_dev, KERN_WARNING, 436 edac_device_printk(edac_dev, KERN_WARNING,
437 "failed to create sysfs device\n"); 437 "failed to create sysfs device\n");
438 goto fail1; 438 goto fail1;
439 } 439 }
440 440
@@ -454,21 +454,21 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx)
454 454
455 /* Report action taken */ 455 /* Report action taken */
456 edac_device_printk(edac_dev, KERN_INFO, 456 edac_device_printk(edac_dev, KERN_INFO,
457 "Giving out device to module '%s' controller '%s': DEV '%s' (%s)\n", 457 "Giving out device to module '%s' controller "
458 edac_dev->mod_name, 458 "'%s': DEV '%s' (%s)\n",
459 edac_dev->ctl_name, 459 edac_dev->mod_name,
460 dev_name(edac_dev), 460 edac_dev->ctl_name,
461 edac_op_state_toString(edac_dev->op_state) 461 dev_name(edac_dev),
462 ); 462 edac_op_state_toString(edac_dev->op_state));
463 463
464 unlock_device_list(); 464 unlock_device_list();
465 return 0; 465 return 0;
466 466
467 fail1: 467fail1:
468 /* Some error, so remove the entry from the lsit */ 468 /* Some error, so remove the entry from the lsit */
469 del_edac_device_from_global_list(edac_dev); 469 del_edac_device_from_global_list(edac_dev);
470 470
471 fail0: 471fail0:
472 unlock_device_list(); 472 unlock_device_list();
473 return 1; 473 return 1;
474} 474}
@@ -516,9 +516,9 @@ struct edac_device_ctl_info *edac_device_del_device(struct device *dev)
516 unlock_device_list(); 516 unlock_device_list();
517 517
518 edac_printk(KERN_INFO, EDAC_MC, 518 edac_printk(KERN_INFO, EDAC_MC,
519 "Removed device %d for %s %s: DEV %s\n", 519 "Removed device %d for %s %s: DEV %s\n",
520 edac_dev->dev_idx, 520 edac_dev->dev_idx,
521 edac_dev->mod_name, edac_dev->ctl_name, dev_name(edac_dev)); 521 edac_dev->mod_name, edac_dev->ctl_name, dev_name(edac_dev));
522 522
523 return edac_dev; 523 return edac_dev;
524} 524}
@@ -536,7 +536,7 @@ static inline int edac_device_get_log_ue(struct edac_device_ctl_info *edac_dev)
536} 536}
537 537
538static inline int edac_device_get_panic_on_ue(struct edac_device_ctl_info 538static inline int edac_device_get_panic_on_ue(struct edac_device_ctl_info
539 *edac_dev) 539 *edac_dev)
540{ 540{
541 return edac_dev->panic_on_ue; 541 return edac_dev->panic_on_ue;
542} 542}
@@ -546,16 +546,16 @@ static inline int edac_device_get_panic_on_ue(struct edac_device_ctl_info
546 * perform a common output and handling of an 'edac_dev' CE event 546 * perform a common output and handling of an 'edac_dev' CE event
547 */ 547 */
548void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, 548void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,
549 int inst_nr, int block_nr, const char *msg) 549 int inst_nr, int block_nr, const char *msg)
550{ 550{
551 struct edac_device_instance *instance; 551 struct edac_device_instance *instance;
552 struct edac_device_block *block = NULL; 552 struct edac_device_block *block = NULL;
553 553
554 if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) { 554 if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) {
555 edac_device_printk(edac_dev, KERN_ERR, 555 edac_device_printk(edac_dev, KERN_ERR,
556 "INTERNAL ERROR: 'instance' out of range " 556 "INTERNAL ERROR: 'instance' out of range "
557 "(%d >= %d)\n", inst_nr, 557 "(%d >= %d)\n", inst_nr,
558 edac_dev->nr_instances); 558 edac_dev->nr_instances);
559 return; 559 return;
560 } 560 }
561 561
@@ -563,9 +563,10 @@ void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,
563 563
564 if ((block_nr >= instance->nr_blocks) || (block_nr < 0)) { 564 if ((block_nr >= instance->nr_blocks) || (block_nr < 0)) {
565 edac_device_printk(edac_dev, KERN_ERR, 565 edac_device_printk(edac_dev, KERN_ERR,
566 "INTERNAL ERROR: instance %d 'block' out of range " 566 "INTERNAL ERROR: instance %d 'block' "
567 "(%d >= %d)\n", inst_nr, block_nr, 567 "out of range (%d >= %d)\n",
568 instance->nr_blocks); 568 inst_nr, block_nr,
569 instance->nr_blocks);
569 return; 570 return;
570 } 571 }
571 572
@@ -580,9 +581,9 @@ void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,
580 581
581 if (edac_device_get_log_ce(edac_dev)) 582 if (edac_device_get_log_ce(edac_dev))
582 edac_device_printk(edac_dev, KERN_WARNING, 583 edac_device_printk(edac_dev, KERN_WARNING,
583 "CE: %s instance: %s block: %s '%s'\n", 584 "CE: %s instance: %s block: %s '%s'\n",
584 edac_dev->ctl_name, instance->name, 585 edac_dev->ctl_name, instance->name,
585 block ? block->name : "N/A", msg); 586 block ? block->name : "N/A", msg);
586} 587}
587 588
588EXPORT_SYMBOL_GPL(edac_device_handle_ce); 589EXPORT_SYMBOL_GPL(edac_device_handle_ce);
@@ -592,16 +593,16 @@ EXPORT_SYMBOL_GPL(edac_device_handle_ce);
592 * perform a common output and handling of an 'edac_dev' UE event 593 * perform a common output and handling of an 'edac_dev' UE event
593 */ 594 */
594void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev, 595void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,
595 int inst_nr, int block_nr, const char *msg) 596 int inst_nr, int block_nr, const char *msg)
596{ 597{
597 struct edac_device_instance *instance; 598 struct edac_device_instance *instance;
598 struct edac_device_block *block = NULL; 599 struct edac_device_block *block = NULL;
599 600
600 if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) { 601 if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) {
601 edac_device_printk(edac_dev, KERN_ERR, 602 edac_device_printk(edac_dev, KERN_ERR,
602 "INTERNAL ERROR: 'instance' out of range " 603 "INTERNAL ERROR: 'instance' out of range "
603 "(%d >= %d)\n", inst_nr, 604 "(%d >= %d)\n", inst_nr,
604 edac_dev->nr_instances); 605 edac_dev->nr_instances);
605 return; 606 return;
606 } 607 }
607 608
@@ -609,9 +610,10 @@ void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,
609 610
610 if ((block_nr >= instance->nr_blocks) || (block_nr < 0)) { 611 if ((block_nr >= instance->nr_blocks) || (block_nr < 0)) {
611 edac_device_printk(edac_dev, KERN_ERR, 612 edac_device_printk(edac_dev, KERN_ERR,
612 "INTERNAL ERROR: instance %d 'block' out of range " 613 "INTERNAL ERROR: instance %d 'block' "
613 "(%d >= %d)\n", inst_nr, block_nr, 614 "out of range (%d >= %d)\n",
614 instance->nr_blocks); 615 inst_nr, block_nr,
616 instance->nr_blocks);
615 return; 617 return;
616 } 618 }
617 619
@@ -626,14 +628,14 @@ void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,
626 628
627 if (edac_device_get_log_ue(edac_dev)) 629 if (edac_device_get_log_ue(edac_dev))
628 edac_device_printk(edac_dev, KERN_EMERG, 630 edac_device_printk(edac_dev, KERN_EMERG,
629 "UE: %s instance: %s block: %s '%s'\n", 631 "UE: %s instance: %s block: %s '%s'\n",
630 edac_dev->ctl_name, instance->name, 632 edac_dev->ctl_name, instance->name,
631 block ? block->name : "N/A", msg); 633 block ? block->name : "N/A", msg);
632 634
633 if (edac_device_get_panic_on_ue(edac_dev)) 635 if (edac_device_get_panic_on_ue(edac_dev))
634 panic("EDAC %s: UE instance: %s block %s '%s'\n", 636 panic("EDAC %s: UE instance: %s block %s '%s'\n",
635 edac_dev->ctl_name, instance->name, 637 edac_dev->ctl_name, instance->name,
636 block ? block->name : "N/A", msg); 638 block ? block->name : "N/A", msg);
637} 639}
638 640
639EXPORT_SYMBOL_GPL(edac_device_handle_ue); 641EXPORT_SYMBOL_GPL(edac_device_handle_ue);