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()
171 struct edac_device_ctl_info *edac_dev; in find_edac_device_by_dev() local
177 edac_dev = list_entry(item, struct edac_device_ctl_info, link); in find_edac_device_by_dev()
179 if (edac_dev->dev == dev) in find_edac_device_by_dev()
180 return edac_dev; in find_edac_device_by_dev()
197 static int add_edac_dev_to_global_list(struct edac_device_ctl_info *edac_dev) in add_edac_dev_to_global_list() argument
205 rover = find_edac_device_by_dev(edac_dev->dev); in add_edac_dev_to_global_list()
213 if (rover->dev_idx >= edac_dev->dev_idx) { in add_edac_dev_to_global_list()
214 if (unlikely(rover->dev_idx == edac_dev->dev_idx)) in add_edac_dev_to_global_list()
222 list_add_tail_rcu(&edac_dev->link, insert_before); in add_edac_dev_to_global_list()
270 struct edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work); in edac_device_workq_function() local
275 if (edac_dev->op_state == OP_OFFLINE) { in edac_device_workq_function()
281 if ((edac_dev->op_state == OP_RUNNING_POLL) && in edac_device_workq_function()
282 (edac_dev->edac_check != NULL)) { in edac_device_workq_function()
283 edac_dev->edac_check(edac_dev); in edac_device_workq_function()
293 if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) in edac_device_workq_function()
294 edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); in edac_device_workq_function()
296 edac_queue_work(&edac_dev->work, edac_dev->delay); in edac_device_workq_function()
304 static void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev, in edac_device_workq_setup() argument
313 edac_dev->poll_msec = msec; in edac_device_workq_setup()
314 edac_dev->delay = msecs_to_jiffies(msec); in edac_device_workq_setup()
316 INIT_DELAYED_WORK(&edac_dev->work, edac_device_workq_function); in edac_device_workq_setup()
323 if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) in edac_device_workq_setup()
324 edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); in edac_device_workq_setup()
326 edac_queue_work(&edac_dev->work, edac_dev->delay); in edac_device_workq_setup()
333 static void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev) in edac_device_workq_teardown() argument
335 if (!edac_dev->edac_check) in edac_device_workq_teardown()
338 edac_dev->op_state = OP_OFFLINE; in edac_device_workq_teardown()
340 edac_stop_work(&edac_dev->work); in edac_device_workq_teardown()
350 void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, in edac_device_reset_delay_period() argument
353 edac_dev->poll_msec = msec; in edac_device_reset_delay_period()
354 edac_dev->delay = msecs_to_jiffies(msec); in edac_device_reset_delay_period()
357 if (edac_dev->poll_msec == DEFAULT_POLL_INTERVAL) in edac_device_reset_delay_period()
358 edac_mod_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay)); in edac_device_reset_delay_period()
360 edac_mod_work(&edac_dev->work, edac_dev->delay); in edac_device_reset_delay_period()
371 int edac_device_add_device(struct edac_device_ctl_info *edac_dev) in edac_device_add_device() argument
377 edac_device_dump_device(edac_dev); in edac_device_add_device()
381 if (add_edac_dev_to_global_list(edac_dev)) in edac_device_add_device()
385 edac_dev->start_time = jiffies; in edac_device_add_device()
388 if (edac_device_create_sysfs(edac_dev)) { in edac_device_add_device()
389 edac_device_printk(edac_dev, KERN_WARNING, in edac_device_add_device()
395 if (edac_dev->edac_check != NULL) { in edac_device_add_device()
397 edac_dev->op_state = OP_RUNNING_POLL; in edac_device_add_device()
399 edac_device_workq_setup(edac_dev, edac_dev->poll_msec ?: DEFAULT_POLL_INTERVAL); in edac_device_add_device()
401 edac_dev->op_state = OP_RUNNING_INTERRUPT; in edac_device_add_device()
405 edac_device_printk(edac_dev, KERN_INFO, in edac_device_add_device()
407 edac_dev->mod_name, edac_dev->ctl_name, edac_dev->dev_name, in edac_device_add_device()
408 edac_op_state_to_string(edac_dev->op_state)); in edac_device_add_device()
415 del_edac_device_from_global_list(edac_dev); in edac_device_add_device()
425 struct edac_device_ctl_info *edac_dev; in edac_device_del_device() local
432 edac_dev = find_edac_device_by_dev(dev); in edac_device_del_device()
433 if (edac_dev == NULL) { in edac_device_del_device()
439 edac_dev->op_state = OP_OFFLINE; in edac_device_del_device()
442 del_edac_device_from_global_list(edac_dev); in edac_device_del_device()
447 edac_device_workq_teardown(edac_dev); in edac_device_del_device()
450 edac_device_remove_sysfs(edac_dev); in edac_device_del_device()
454 edac_dev->dev_idx, in edac_device_del_device()
455 edac_dev->mod_name, edac_dev->ctl_name, edac_dev_name(edac_dev)); in edac_device_del_device()
457 return edac_dev; in edac_device_del_device()
461 static inline int edac_device_get_log_ce(struct edac_device_ctl_info *edac_dev) in edac_device_get_log_ce() argument
463 return edac_dev->log_ce; in edac_device_get_log_ce()
466 static inline int edac_device_get_log_ue(struct edac_device_ctl_info *edac_dev) in edac_device_get_log_ue() argument
468 return edac_dev->log_ue; in edac_device_get_log_ue()
472 *edac_dev) in edac_device_get_panic_on_ue()
474 return edac_dev->panic_on_ue; in edac_device_get_panic_on_ue()
477 void edac_device_handle_ce_count(struct edac_device_ctl_info *edac_dev, in edac_device_handle_ce_count() argument
487 if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) { in edac_device_handle_ce_count()
488 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ce_count()
491 edac_dev->nr_instances); in edac_device_handle_ce_count()
495 instance = edac_dev->instances + inst_nr; in edac_device_handle_ce_count()
498 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ce_count()
513 edac_dev->counters.ce_count += count; in edac_device_handle_ce_count()
515 if (edac_device_get_log_ce(edac_dev)) in edac_device_handle_ce_count()
516 edac_device_printk(edac_dev, KERN_WARNING, in edac_device_handle_ce_count()
518 edac_dev->ctl_name, instance->name, in edac_device_handle_ce_count()
523 void edac_device_handle_ue_count(struct edac_device_ctl_info *edac_dev, in edac_device_handle_ue_count() argument
533 if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) { in edac_device_handle_ue_count()
534 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ue_count()
537 edac_dev->nr_instances); in edac_device_handle_ue_count()
541 instance = edac_dev->instances + inst_nr; in edac_device_handle_ue_count()
544 edac_device_printk(edac_dev, KERN_ERR, in edac_device_handle_ue_count()
559 edac_dev->counters.ue_count += count; in edac_device_handle_ue_count()
561 if (edac_device_get_log_ue(edac_dev)) in edac_device_handle_ue_count()
562 edac_device_printk(edac_dev, KERN_EMERG, in edac_device_handle_ue_count()
564 edac_dev->ctl_name, instance->name, in edac_device_handle_ue_count()
567 if (edac_device_get_panic_on_ue(edac_dev)) in edac_device_handle_ue_count()
569 edac_dev->ctl_name, instance->name, in edac_device_handle_ue_count()