Lines Matching refs:edac_dev
41 static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev) in edac_device_dump_device() argument
44 edac_dev, edac_dev->dev_idx); in edac_device_dump_device()
45 edac_dbg(4, "\tedac_dev->edac_check = %p\n", edac_dev->edac_check); in edac_device_dump_device()
46 edac_dbg(3, "\tdev = %p\n", edac_dev->dev); in edac_device_dump_device()
48 edac_dev->mod_name, edac_dev->ctl_name); in edac_device_dump_device()
49 edac_dbg(3, "\tpvt_info = %p\n\n", edac_dev->pvt_info); in edac_device_dump_device()
250 struct edac_device_ctl_info *edac_dev; in find_edac_device_by_dev() local
256 edac_dev = list_entry(item, struct edac_device_ctl_info, link); in find_edac_device_by_dev()
258 if (edac_dev->dev == dev) in find_edac_device_by_dev()
259 return edac_dev; in find_edac_device_by_dev()
276 static int add_edac_dev_to_global_list(struct edac_device_ctl_info *edac_dev) in add_edac_dev_to_global_list() argument
284 rover = find_edac_device_by_dev(edac_dev->dev); in add_edac_dev_to_global_list()
292 if (rover->dev_idx >= edac_dev->dev_idx) { in add_edac_dev_to_global_list()
293 if (unlikely(rover->dev_idx == edac_dev->dev_idx)) in add_edac_dev_to_global_list()
301 list_add_tail_rcu(&edac_dev->link, insert_before); in add_edac_dev_to_global_list()
349 struct edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work); in edac_device_workq_function() local
354 if (edac_dev->op_state == OP_OFFLINE) { in edac_device_workq_function()
360 if ((edac_dev->op_state == OP_RUNNING_POLL) && in edac_device_workq_function()
361 (edac_dev->edac_check != NULL)) { in edac_device_workq_function()
362 edac_dev->edac_check(edac_dev); in edac_device_workq_function()
372 if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) in edac_device_workq_function()
373 edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); in edac_device_workq_function()
375 edac_queue_work(&edac_dev->work, edac_dev->delay); in edac_device_workq_function()
383 static void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev, in edac_device_workq_setup() argument
392 edac_dev->poll_msec = msec; in edac_device_workq_setup()
393 edac_dev->delay = msecs_to_jiffies(msec); in edac_device_workq_setup()
395 INIT_DELAYED_WORK(&edac_dev->work, edac_device_workq_function); in edac_device_workq_setup()
402 if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) in edac_device_workq_setup()
403 edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); in edac_device_workq_setup()
405 edac_queue_work(&edac_dev->work, edac_dev->delay); in edac_device_workq_setup()
412 static void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev) in edac_device_workq_teardown() argument
414 if (!edac_dev->edac_check) in edac_device_workq_teardown()
417 edac_dev->op_state = OP_OFFLINE; in edac_device_workq_teardown()
419 edac_stop_work(&edac_dev->work); in edac_device_workq_teardown()
429 void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, in edac_device_reset_delay_period() argument
432 edac_dev->poll_msec = msec; in edac_device_reset_delay_period()
433 edac_dev->delay = msecs_to_jiffies(msec); in edac_device_reset_delay_period()
436 if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) in edac_device_reset_delay_period()
437 edac_mod_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); in edac_device_reset_delay_period()
439 edac_mod_work(&edac_dev->work, edac_dev->delay); in edac_device_reset_delay_period()
450 int edac_device_add_device(struct edac_device_ctl_info *edac_dev) in edac_device_add_device() argument
456 edac_device_dump_device(edac_dev); in edac_device_add_device()
460 if (add_edac_dev_to_global_list(edac_dev)) in edac_device_add_device()
464 edac_dev->start_time = jiffies; in edac_device_add_device()
467 if (edac_device_create_sysfs(edac_dev)) { in edac_device_add_device()
468 edac_device_printk(edac_dev, KERN_WARNING, in edac_device_add_device()
474 if (edac_dev->edac_check != NULL) { in edac_device_add_device()
476 edac_dev->op_state = OP_RUNNING_POLL; in edac_device_add_device()
478 edac_device_workq_setup(edac_dev, edac_dev->poll_msec ?: DEFAULT_POLL_INTERVAL); in edac_device_add_device()
480 edac_dev->op_state = OP_RUNNING_INTERRUPT; in edac_device_add_device()
484 edac_device_printk(edac_dev, KERN_INFO, in edac_device_add_device()
486 edac_dev->mod_name, edac_dev->ctl_name, edac_dev->dev_name, in edac_device_add_device()
487 edac_op_state_to_string(edac_dev->op_state)); in edac_device_add_device()
494 del_edac_device_from_global_list(edac_dev); in edac_device_add_device()
504 struct edac_device_ctl_info *edac_dev; in edac_device_del_device() local
511 edac_dev = find_edac_device_by_dev(dev); in edac_device_del_device()
512 if (edac_dev == NULL) { in edac_device_del_device()
518 edac_dev->op_state = OP_OFFLINE; in edac_device_del_device()
521 del_edac_device_from_global_list(edac_dev); in edac_device_del_device()
526 edac_device_workq_teardown(edac_dev); in edac_device_del_device()
529 edac_device_remove_sysfs(edac_dev); in edac_device_del_device()
533 edac_dev->dev_idx, in edac_device_del_device()
534 edac_dev->mod_name, edac_dev->ctl_name, edac_dev_name(edac_dev)); in edac_device_del_device()
536 return edac_dev; in edac_device_del_device()
540 static inline int edac_device_get_log_ce(struct edac_device_ctl_info *edac_dev) in edac_device_get_log_ce() argument
542 return edac_dev->log_ce; in edac_device_get_log_ce()
545 static inline int edac_device_get_log_ue(struct edac_device_ctl_info *edac_dev) in edac_device_get_log_ue() argument
547 return edac_dev->log_ue; in edac_device_get_log_ue()
551 *edac_dev) in edac_device_get_panic_on_ue()
553 return edac_dev->panic_on_ue; in edac_device_get_panic_on_ue()
556 void edac_device_handle_ce_count(struct edac_device_ctl_info *edac_dev, in edac_device_handle_ce_count() argument
566 if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) { in edac_device_handle_ce_count()
567 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ce_count()
570 edac_dev->nr_instances); in edac_device_handle_ce_count()
574 instance = edac_dev->instances + inst_nr; in edac_device_handle_ce_count()
577 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ce_count()
592 edac_dev->counters.ce_count += count; in edac_device_handle_ce_count()
594 if (edac_device_get_log_ce(edac_dev)) in edac_device_handle_ce_count()
595 edac_device_printk(edac_dev, KERN_WARNING, in edac_device_handle_ce_count()
597 edac_dev->ctl_name, instance->name, in edac_device_handle_ce_count()
602 void edac_device_handle_ue_count(struct edac_device_ctl_info *edac_dev, in edac_device_handle_ue_count() argument
612 if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) { in edac_device_handle_ue_count()
613 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ue_count()
616 edac_dev->nr_instances); in edac_device_handle_ue_count()
620 instance = edac_dev->instances + inst_nr; in edac_device_handle_ue_count()
623 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ue_count()
638 edac_dev->counters.ue_count += count; in edac_device_handle_ue_count()
640 if (edac_device_get_log_ue(edac_dev)) in edac_device_handle_ue_count()
641 edac_device_printk(edac_dev, KERN_EMERG, in edac_device_handle_ue_count()
643 edac_dev->ctl_name, instance->name, in edac_device_handle_ue_count()
646 if (edac_device_get_panic_on_ue(edac_dev)) in edac_device_handle_ue_count()
648 edac_dev->ctl_name, instance->name, in edac_device_handle_ue_count()