Lines Matching refs:edac_dev
38 static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev) in edac_device_dump_device() argument
41 edac_dev, edac_dev->dev_idx); in edac_device_dump_device()
42 edac_dbg(4, "\tedac_dev->edac_check = %p\n", edac_dev->edac_check); in edac_device_dump_device()
43 edac_dbg(3, "\tdev = %p\n", edac_dev->dev); in edac_device_dump_device()
45 edac_dev->mod_name, edac_dev->ctl_name); in edac_device_dump_device()
46 edac_dbg(3, "\tpvt_info = %p\n\n", edac_dev->pvt_info); in edac_device_dump_device()
247 struct edac_device_ctl_info *edac_dev; in find_edac_device_by_dev() local
253 edac_dev = list_entry(item, struct edac_device_ctl_info, link); in find_edac_device_by_dev()
255 if (edac_dev->dev == dev) in find_edac_device_by_dev()
256 return edac_dev; in find_edac_device_by_dev()
273 static int add_edac_dev_to_global_list(struct edac_device_ctl_info *edac_dev) in add_edac_dev_to_global_list() argument
281 rover = find_edac_device_by_dev(edac_dev->dev); in add_edac_dev_to_global_list()
289 if (rover->dev_idx >= edac_dev->dev_idx) { in add_edac_dev_to_global_list()
290 if (unlikely(rover->dev_idx == edac_dev->dev_idx)) in add_edac_dev_to_global_list()
298 list_add_tail_rcu(&edac_dev->link, insert_before); in add_edac_dev_to_global_list()
346 struct edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work); in edac_device_workq_function() local
351 if (edac_dev->op_state == OP_OFFLINE) { in edac_device_workq_function()
357 if ((edac_dev->op_state == OP_RUNNING_POLL) && in edac_device_workq_function()
358 (edac_dev->edac_check != NULL)) { in edac_device_workq_function()
359 edac_dev->edac_check(edac_dev); in edac_device_workq_function()
369 if (edac_dev->poll_msec == 1000) in edac_device_workq_function()
370 edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); in edac_device_workq_function()
372 edac_queue_work(&edac_dev->work, edac_dev->delay); in edac_device_workq_function()
380 static void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev, in edac_device_workq_setup() argument
389 edac_dev->poll_msec = msec; in edac_device_workq_setup()
390 edac_dev->delay = msecs_to_jiffies(msec); in edac_device_workq_setup()
392 INIT_DELAYED_WORK(&edac_dev->work, edac_device_workq_function); in edac_device_workq_setup()
399 if (edac_dev->poll_msec == 1000) in edac_device_workq_setup()
400 edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); in edac_device_workq_setup()
402 edac_queue_work(&edac_dev->work, edac_dev->delay); in edac_device_workq_setup()
409 static void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev) in edac_device_workq_teardown() argument
411 if (!edac_dev->edac_check) in edac_device_workq_teardown()
414 edac_dev->op_state = OP_OFFLINE; in edac_device_workq_teardown()
416 edac_stop_work(&edac_dev->work); in edac_device_workq_teardown()
426 void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, in edac_device_reset_delay_period() argument
434 edac_dev->poll_msec = value; in edac_device_reset_delay_period()
435 edac_dev->delay = jiffs; in edac_device_reset_delay_period()
437 edac_mod_work(&edac_dev->work, jiffs); in edac_device_reset_delay_period()
448 int edac_device_add_device(struct edac_device_ctl_info *edac_dev) in edac_device_add_device() argument
454 edac_device_dump_device(edac_dev); in edac_device_add_device()
458 if (add_edac_dev_to_global_list(edac_dev)) in edac_device_add_device()
462 edac_dev->start_time = jiffies; in edac_device_add_device()
465 if (edac_device_create_sysfs(edac_dev)) { in edac_device_add_device()
466 edac_device_printk(edac_dev, KERN_WARNING, in edac_device_add_device()
472 if (edac_dev->edac_check != NULL) { in edac_device_add_device()
474 edac_dev->op_state = OP_RUNNING_POLL; in edac_device_add_device()
480 edac_device_workq_setup(edac_dev, 1000); in edac_device_add_device()
482 edac_dev->op_state = OP_RUNNING_INTERRUPT; in edac_device_add_device()
486 edac_device_printk(edac_dev, KERN_INFO, in edac_device_add_device()
488 edac_dev->mod_name, edac_dev->ctl_name, edac_dev->dev_name, in edac_device_add_device()
489 edac_op_state_to_string(edac_dev->op_state)); in edac_device_add_device()
496 del_edac_device_from_global_list(edac_dev); in edac_device_add_device()
506 struct edac_device_ctl_info *edac_dev; in edac_device_del_device() local
513 edac_dev = find_edac_device_by_dev(dev); in edac_device_del_device()
514 if (edac_dev == NULL) { in edac_device_del_device()
520 edac_dev->op_state = OP_OFFLINE; in edac_device_del_device()
523 del_edac_device_from_global_list(edac_dev); in edac_device_del_device()
528 edac_device_workq_teardown(edac_dev); in edac_device_del_device()
531 edac_device_remove_sysfs(edac_dev); in edac_device_del_device()
535 edac_dev->dev_idx, in edac_device_del_device()
536 edac_dev->mod_name, edac_dev->ctl_name, edac_dev_name(edac_dev)); in edac_device_del_device()
538 return edac_dev; in edac_device_del_device()
542 static inline int edac_device_get_log_ce(struct edac_device_ctl_info *edac_dev) in edac_device_get_log_ce() argument
544 return edac_dev->log_ce; in edac_device_get_log_ce()
547 static inline int edac_device_get_log_ue(struct edac_device_ctl_info *edac_dev) in edac_device_get_log_ue() argument
549 return edac_dev->log_ue; in edac_device_get_log_ue()
553 *edac_dev) in edac_device_get_panic_on_ue()
555 return edac_dev->panic_on_ue; in edac_device_get_panic_on_ue()
558 void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev, in edac_device_handle_ce() argument
564 if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) { in edac_device_handle_ce()
565 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ce()
568 edac_dev->nr_instances); in edac_device_handle_ce()
572 instance = edac_dev->instances + inst_nr; in edac_device_handle_ce()
575 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ce()
590 edac_dev->counters.ce_count++; in edac_device_handle_ce()
592 if (edac_device_get_log_ce(edac_dev)) in edac_device_handle_ce()
593 edac_device_printk(edac_dev, KERN_WARNING, in edac_device_handle_ce()
595 edac_dev->ctl_name, instance->name, in edac_device_handle_ce()
600 void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev, in edac_device_handle_ue() argument
606 if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) { in edac_device_handle_ue()
607 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ue()
610 edac_dev->nr_instances); in edac_device_handle_ue()
614 instance = edac_dev->instances + inst_nr; in edac_device_handle_ue()
617 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ue()
632 edac_dev->counters.ue_count++; in edac_device_handle_ue()
634 if (edac_device_get_log_ue(edac_dev)) in edac_device_handle_ue()
635 edac_device_printk(edac_dev, KERN_EMERG, in edac_device_handle_ue()
637 edac_dev->ctl_name, instance->name, in edac_device_handle_ue()
640 if (edac_device_get_panic_on_ue(edac_dev)) in edac_device_handle_ue()
642 edac_dev->ctl_name, instance->name, in edac_device_handle_ue()