Lines Matching +full:store +full:- +full:release

28  * Set of edac_device_ctl_info attribute store/show functions
35 return sprintf(data, "%u\n", ctl_info->log_ue); in edac_device_ctl_log_ue_show()
42 /* if parameter is zero, turn off flag, if non-zero turn on flag */ in edac_device_ctl_log_ue_store()
43 ctl_info->log_ue = (simple_strtoul(data, NULL, 0) != 0); in edac_device_ctl_log_ue_store()
52 return sprintf(data, "%u\n", ctl_info->log_ce); in edac_device_ctl_log_ce_show()
59 /* if parameter is zero, turn off flag, if non-zero turn on flag */ in edac_device_ctl_log_ce_store()
60 ctl_info->log_ce = (simple_strtoul(data, NULL, 0) != 0); in edac_device_ctl_log_ce_store()
69 return sprintf(data, "%u\n", ctl_info->panic_on_ue); in edac_device_ctl_panic_on_ue_show()
76 /* if parameter is zero, turn off flag, if non-zero turn on flag */ in edac_device_ctl_panic_on_ue_store()
77 ctl_info->panic_on_ue = (simple_strtoul(data, NULL, 0) != 0); in edac_device_ctl_panic_on_ue_store()
82 /* 'poll_msec' show and store functions*/
86 return sprintf(data, "%u\n", ctl_info->poll_msec); in edac_device_ctl_poll_msec_show()
95 /* get the value and enforce that it is non-zero, must be at least in edac_device_ctl_poll_msec_store()
110 ssize_t(*store) (struct edac_device_ctl_info *, const char *, size_t); member
123 if (ctl_info_attr->show) in edac_dev_ctl_info_show()
124 return ctl_info_attr->show(edac_dev, buffer); in edac_dev_ctl_info_show()
125 return -EIO; in edac_dev_ctl_info_show()
128 /* Function to 'store' fields into the edac_dev 'ctl_info' structure */
136 if (ctl_info_attr->store) in edac_dev_ctl_info_store()
137 return ctl_info_attr->store(edac_dev, buffer, count); in edac_dev_ctl_info_store()
138 return -EIO; in edac_dev_ctl_info_store()
144 .store = edac_dev_ctl_info_store
151 .store = _store, \
190 * When they are released their release functions decrement
196 * module no longer has dependency on keeping the release
206 edac_dbg(4, "control index=%d\n", edac_dev->dev_idx); in edac_device_ctrl_master_release()
209 module_put(edac_dev->owner); in edac_device_ctrl_master_release()
216 .release = edac_device_ctrl_master_release,
233 int err = -ENODEV; in edac_device_register_sysfs_main_kobj()
241 edac_dev->edac_subsys = edac_subsys; in edac_device_register_sysfs_main_kobj()
244 memset(&edac_dev->kobj, 0, sizeof(struct kobject)); in edac_device_register_sysfs_main_kobj()
249 edac_dev->owner = THIS_MODULE; in edac_device_register_sysfs_main_kobj()
251 if (!try_module_get(edac_dev->owner)) in edac_device_register_sysfs_main_kobj()
257 err = kobject_init_and_add(&edac_dev->kobj, &ktype_device_ctrl, in edac_device_register_sysfs_main_kobj()
258 &dev_root->kobj, "%s", edac_dev->name); in edac_device_register_sysfs_main_kobj()
263 edac_dev->name); in edac_device_register_sysfs_main_kobj()
266 kobject_uevent(&edac_dev->kobj, KOBJ_ADD); in edac_device_register_sysfs_main_kobj()
272 edac_dbg(4, "Registered '.../edac/%s' kobject\n", edac_dev->name); in edac_device_register_sysfs_main_kobj()
278 kobject_put(&edac_dev->kobj); in edac_device_register_sysfs_main_kobj()
279 module_put(edac_dev->owner); in edac_device_register_sysfs_main_kobj()
292 edac_dbg(4, "name of kobject is: %s\n", kobject_name(&dev->kobj)); in edac_device_unregister_sysfs_main_kobj()
301 kobject_put(&dev->kobj); in edac_device_unregister_sysfs_main_kobj()
304 /* edac_dev -> instance information */
307 * Set of low-level instance attribute show functions
312 return sprintf(data, "%u\n", instance->counters.ue_count); in instance_ue_count_show()
318 return sprintf(data, "%u\n", instance->counters.ce_count); in instance_ce_count_show()
324 /* DEVICE instance kobject release() function */
335 kobject_put(&instance->ctl->kobj); in edac_device_ctrl_instance_release()
342 ssize_t(*store) (struct edac_device_instance *, const char *, size_t); member
352 if (instance_attr->show) in edac_dev_instance_show()
353 return instance_attr->show(instance, buffer); in edac_dev_instance_show()
354 return -EIO; in edac_dev_instance_show()
357 /* Function to 'store' fields into the edac_dev 'instance' structure */
365 if (instance_attr->store) in edac_dev_instance_store()
366 return instance_attr->store(instance, buffer, count); in edac_dev_instance_store()
367 return -EIO; in edac_dev_instance_store()
373 .store = edac_dev_instance_store
380 .store = _store, \
401 .release = edac_device_ctrl_instance_release,
406 /* edac_dev -> instance -> block information */
413 * Set of low-level block attribute show functions
420 return sprintf(data, "%u\n", block->counters.ue_count); in block_ue_count_show()
428 return sprintf(data, "%u\n", block->counters.ce_count); in block_ce_count_show()
431 /* DEVICE block kobject release() function */
441 /* map from 'block kobj' to 'block->instance->controller->main_kobj' in edac_device_ctrl_block_release()
442 * now 'release' the block kobject in edac_device_ctrl_block_release()
444 kobject_put(&block->instance->ctl->kobj); in edac_device_ctrl_block_release()
455 if (block_attr->show) in edac_dev_block_show()
456 return block_attr->show(kobj, attr, buffer); in edac_dev_block_show()
457 return -EIO; in edac_dev_block_show()
484 .release = edac_device_ctrl_block_release,
504 instance->name, instance, block->name, block); in edac_device_create_block()
505 edac_dbg(4, "block kobj=%p block kobj->parent=%p\n", in edac_device_create_block()
506 &block->kobj, &block->kobj.parent); in edac_device_create_block()
509 memset(&block->kobj, 0, sizeof(struct kobject)); in edac_device_create_block()
514 main_kobj = kobject_get(&edac_dev->kobj); in edac_device_create_block()
516 err = -ENODEV; in edac_device_create_block()
521 err = kobject_init_and_add(&block->kobj, &ktype_block_ctrl, in edac_device_create_block()
522 &instance->kobj, in edac_device_create_block()
523 "%s", block->name); in edac_device_create_block()
525 edac_dbg(1, "Failed to register instance '%s'\n", block->name); in edac_device_create_block()
527 err = -ENODEV; in edac_device_create_block()
534 sysfs_attrib = block->block_attributes; in edac_device_create_block()
535 if (sysfs_attrib && block->nr_attribs) { in edac_device_create_block()
536 for (i = 0; i < block->nr_attribs; i++, sysfs_attrib++) { in edac_device_create_block()
538 edac_dbg(4, "creating block attrib='%s' attrib->%p to kobj=%p\n", in edac_device_create_block()
539 sysfs_attrib->attr.name, in edac_device_create_block()
540 sysfs_attrib, &block->kobj); in edac_device_create_block()
543 err = sysfs_create_file(&block->kobj, in edac_device_create_block()
544 &sysfs_attrib->attr); in edac_device_create_block()
549 kobject_uevent(&block->kobj, KOBJ_ADD); in edac_device_create_block()
555 kobject_put(&block->kobj); in edac_device_create_block()
573 sysfs_attrib = block->block_attributes; in edac_device_delete_block()
574 if (sysfs_attrib && block->nr_attribs) { in edac_device_delete_block()
575 for (i = 0; i < block->nr_attribs; i++, sysfs_attrib++) { in edac_device_delete_block()
578 sysfs_remove_file(&block->kobj, in edac_device_delete_block()
586 kobject_put(&block->kobj); in edac_device_delete_block()
603 instance = &edac_dev->instances[idx]; in edac_device_create_instance()
606 memset(&instance->kobj, 0, sizeof(struct kobject)); in edac_device_create_instance()
608 instance->ctl = edac_dev; in edac_device_create_instance()
613 main_kobj = kobject_get(&edac_dev->kobj); in edac_device_create_instance()
615 err = -ENODEV; in edac_device_create_instance()
620 err = kobject_init_and_add(&instance->kobj, &ktype_instance_ctrl, in edac_device_create_instance()
621 &edac_dev->kobj, "%s", instance->name); in edac_device_create_instance()
624 instance->name); in edac_device_create_instance()
630 instance->nr_blocks, idx); in edac_device_create_instance()
633 for (i = 0; i < instance->nr_blocks; i++) { in edac_device_create_instance()
635 &instance->blocks[i]); in edac_device_create_instance()
640 &instance->blocks[j]); in edac_device_create_instance()
644 kobject_uevent(&instance->kobj, KOBJ_ADD); in edac_device_create_instance()
647 idx, instance->name); in edac_device_create_instance()
653 kobject_put(&instance->kobj); in edac_device_create_instance()
669 instance = &edac_dev->instances[idx]; in edac_device_delete_instance()
672 for (i = 0; i < instance->nr_blocks; i++) in edac_device_delete_instance()
673 edac_device_delete_block(edac_dev, &instance->blocks[i]); in edac_device_delete_instance()
678 kobject_put(&instance->kobj); in edac_device_delete_instance()
694 for (i = 0; i < edac_dev->nr_instances; i++) { in edac_device_create_instances()
716 for (i = 0; i < edac_dev->nr_instances; i++) in edac_device_delete_instances()
732 sysfs_attrib = edac_dev->sysfs_attributes; in edac_device_add_main_sysfs_attributes()
737 while (sysfs_attrib->attr.name != NULL) { in edac_device_add_main_sysfs_attributes()
738 err = sysfs_create_file(&edac_dev->kobj, in edac_device_add_main_sysfs_attributes()
764 sysfs_attrib = edac_dev->sysfs_attributes; in edac_device_remove_main_sysfs_attributes()
766 while (sysfs_attrib->attr.name != NULL) { in edac_device_remove_main_sysfs_attributes()
767 sysfs_remove_file(&edac_dev->kobj, in edac_device_remove_main_sysfs_attributes()
791 struct kobject *edac_kobj = &edac_dev->kobj; in edac_device_create_sysfs()
793 edac_dbg(0, "idx=%d\n", edac_dev->dev_idx); in edac_device_create_sysfs()
806 &edac_dev->dev->kobj, EDAC_DEVICE_SYMLINK); in edac_device_create_sysfs()
824 edac_dbg(4, "create-instances done, idx=%d\n", edac_dev->dev_idx); in edac_device_create_sysfs()
831 sysfs_remove_link(&edac_dev->kobj, EDAC_DEVICE_SYMLINK); in edac_device_create_sysfs()
853 sysfs_remove_link(&edac_dev->kobj, EDAC_DEVICE_SYMLINK); in edac_device_remove_sysfs()