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()
220 struct edac_device_ctl_info *edac_dev; in find_edac_device_by_dev() local
226 edac_dev = list_entry(item, struct edac_device_ctl_info, link); in find_edac_device_by_dev()
228 if (edac_dev->dev == dev) in find_edac_device_by_dev()
229 return edac_dev; in find_edac_device_by_dev()
246 static int add_edac_dev_to_global_list(struct edac_device_ctl_info *edac_dev) in add_edac_dev_to_global_list() argument
254 rover = find_edac_device_by_dev(edac_dev->dev); in add_edac_dev_to_global_list()
262 if (rover->dev_idx >= edac_dev->dev_idx) { in add_edac_dev_to_global_list()
263 if (unlikely(rover->dev_idx == edac_dev->dev_idx)) in add_edac_dev_to_global_list()
271 list_add_tail_rcu(&edac_dev->link, insert_before); in add_edac_dev_to_global_list()
319 struct edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work); in edac_device_workq_function() local
324 if (edac_dev->op_state == OP_OFFLINE) { in edac_device_workq_function()
330 if ((edac_dev->op_state == OP_RUNNING_POLL) && in edac_device_workq_function()
331 (edac_dev->edac_check != NULL)) { in edac_device_workq_function()
332 edac_dev->edac_check(edac_dev); in edac_device_workq_function()
342 if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) in edac_device_workq_function()
343 edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); in edac_device_workq_function()
345 edac_queue_work(&edac_dev->work, edac_dev->delay); in edac_device_workq_function()
353 static void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev, in edac_device_workq_setup() argument
362 edac_dev->poll_msec = msec; in edac_device_workq_setup()
363 edac_dev->delay = msecs_to_jiffies(msec); in edac_device_workq_setup()
365 INIT_DELAYED_WORK(&edac_dev->work, edac_device_workq_function); in edac_device_workq_setup()
372 if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) in edac_device_workq_setup()
373 edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); in edac_device_workq_setup()
375 edac_queue_work(&edac_dev->work, edac_dev->delay); in edac_device_workq_setup()
382 static void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev) in edac_device_workq_teardown() argument
384 if (!edac_dev->edac_check) in edac_device_workq_teardown()
387 edac_dev->op_state = OP_OFFLINE; in edac_device_workq_teardown()
389 edac_stop_work(&edac_dev->work); in edac_device_workq_teardown()
399 void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, in edac_device_reset_delay_period() argument
402 edac_dev->poll_msec = msec; in edac_device_reset_delay_period()
403 edac_dev->delay = msecs_to_jiffies(msec); in edac_device_reset_delay_period()
406 if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) in edac_device_reset_delay_period()
407 edac_mod_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); in edac_device_reset_delay_period()
409 edac_mod_work(&edac_dev->work, edac_dev->delay); in edac_device_reset_delay_period()
420 int edac_device_add_device(struct edac_device_ctl_info *edac_dev) in edac_device_add_device() argument
426 edac_device_dump_device(edac_dev); in edac_device_add_device()
430 if (add_edac_dev_to_global_list(edac_dev)) in edac_device_add_device()
434 edac_dev->start_time = jiffies; in edac_device_add_device()
437 if (edac_device_create_sysfs(edac_dev)) { in edac_device_add_device()
438 edac_device_printk(edac_dev, KERN_WARNING, in edac_device_add_device()
444 if (edac_dev->edac_check != NULL) { in edac_device_add_device()
446 edac_dev->op_state = OP_RUNNING_POLL; in edac_device_add_device()
448 edac_device_workq_setup(edac_dev, edac_dev->poll_msec ?: DEFAULT_POLL_INTERVAL); in edac_device_add_device()
450 edac_dev->op_state = OP_RUNNING_INTERRUPT; in edac_device_add_device()
454 edac_device_printk(edac_dev, KERN_INFO, in edac_device_add_device()
456 edac_dev->mod_name, edac_dev->ctl_name, edac_dev->dev_name, in edac_device_add_device()
457 edac_op_state_to_string(edac_dev->op_state)); in edac_device_add_device()
464 del_edac_device_from_global_list(edac_dev); in edac_device_add_device()
474 struct edac_device_ctl_info *edac_dev; in edac_device_del_device() local
481 edac_dev = find_edac_device_by_dev(dev); in edac_device_del_device()
482 if (edac_dev == NULL) { in edac_device_del_device()
488 edac_dev->op_state = OP_OFFLINE; in edac_device_del_device()
491 del_edac_device_from_global_list(edac_dev); in edac_device_del_device()
496 edac_device_workq_teardown(edac_dev); in edac_device_del_device()
499 edac_device_remove_sysfs(edac_dev); in edac_device_del_device()
503 edac_dev->dev_idx, in edac_device_del_device()
504 edac_dev->mod_name, edac_dev->ctl_name, edac_dev_name(edac_dev)); in edac_device_del_device()
506 return edac_dev; in edac_device_del_device()
510 static inline int edac_device_get_log_ce(struct edac_device_ctl_info *edac_dev) in edac_device_get_log_ce() argument
512 return edac_dev->log_ce; in edac_device_get_log_ce()
515 static inline int edac_device_get_log_ue(struct edac_device_ctl_info *edac_dev) in edac_device_get_log_ue() argument
517 return edac_dev->log_ue; in edac_device_get_log_ue()
521 *edac_dev) in edac_device_get_panic_on_ue()
523 return edac_dev->panic_on_ue; in edac_device_get_panic_on_ue()
526 void edac_device_handle_ce_count(struct edac_device_ctl_info *edac_dev, in edac_device_handle_ce_count() argument
536 if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) { in edac_device_handle_ce_count()
537 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ce_count()
540 edac_dev->nr_instances); in edac_device_handle_ce_count()
544 instance = edac_dev->instances + inst_nr; in edac_device_handle_ce_count()
547 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ce_count()
562 edac_dev->counters.ce_count += count; in edac_device_handle_ce_count()
564 if (edac_device_get_log_ce(edac_dev)) in edac_device_handle_ce_count()
565 edac_device_printk(edac_dev, KERN_WARNING, in edac_device_handle_ce_count()
567 edac_dev->ctl_name, instance->name, in edac_device_handle_ce_count()
572 void edac_device_handle_ue_count(struct edac_device_ctl_info *edac_dev, in edac_device_handle_ue_count() argument
582 if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) { in edac_device_handle_ue_count()
583 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ue_count()
586 edac_dev->nr_instances); in edac_device_handle_ue_count()
590 instance = edac_dev->instances + inst_nr; in edac_device_handle_ue_count()
593 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ue_count()
608 edac_dev->counters.ue_count += count; in edac_device_handle_ue_count()
610 if (edac_device_get_log_ue(edac_dev)) in edac_device_handle_ue_count()
611 edac_device_printk(edac_dev, KERN_EMERG, in edac_device_handle_ue_count()
613 edac_dev->ctl_name, instance->name, in edac_device_handle_ue_count()
616 if (edac_device_get_panic_on_ue(edac_dev)) in edac_device_handle_ue_count()
618 edac_dev->ctl_name, instance->name, in edac_device_handle_ue_count()