/* get the value and enforce that it is non-zero, must be at least *onemillisecondforthedelayperiod,betweenscans *Thencancellastoutstandingdelayfortheworkrequest *andsetanewone.
*/
value = simple_strtoul(data, NULL, 0);
edac_device_reset_delay_period(ctl_info, value);
/* init this block's kobject */
memset(&block->kobj, 0, sizeof(struct kobject));
/* bump the main kobject's reference count for this controller *andthisinstanceisdependentonthemain
*/
main_kobj = kobject_get(&edac_dev->kobj); if (!main_kobj) {
err = -ENODEV; goto err_out;
}
/* Add this block's kobject */
err = kobject_init_and_add(&block->kobj, &ktype_block_ctrl,
&instance->kobj, "%s", block->name); if (err) {
edac_dbg(1, "Failed to register instance '%s'\n", block->name);
kobject_put(main_kobj);
err = -ENODEV; goto err_out;
}
/* If there are driver level block attributes, then added them *totheblockkobject
*/
sysfs_attrib = block->block_attributes; if (sysfs_attrib && block->nr_attribs) { for (i = 0; i < block->nr_attribs; i++, sysfs_attrib++) {
edac_dbg(4, "creating block attrib='%s' attrib->%p to kobj=%p\n",
sysfs_attrib->attr.name,
sysfs_attrib, &block->kobj);
/* Create each block_attribute file */
err = sysfs_create_file(&block->kobj,
&sysfs_attrib->attr); if (err) goto err_on_attrib;
}
}
kobject_uevent(&block->kobj, KOBJ_ADD);
/* if this block has 'attributes' then we need to iterate over the list *and'remove'theattributesonthisblock
*/
sysfs_attrib = block->block_attributes; if (sysfs_attrib && block->nr_attribs) { for (i = 0; i < block->nr_attribs; i++, sysfs_attrib++) {
/* unregister this block's kobject, SEE: *edac_device_ctrl_block_release()callbackoperation
*/
kobject_put(&block->kobj);
}
/* instance ctor/dtor code */
/* *edac_device_create_instance *createjustoneinstanceofanedac_device'instance'
*/ staticint edac_device_create_instance(struct edac_device_ctl_info *edac_dev, int idx)
{ int i, j; int err; struct edac_device_instance *instance; struct kobject *main_kobj;
instance = &edac_dev->instances[idx];
/* Init the instance's kobject */
memset(&instance->kobj, 0, sizeof(struct kobject));
instance->ctl = edac_dev;
/* bump the main kobject's reference count for this controller *andthisinstanceisdependentonthemain
*/
main_kobj = kobject_get(&edac_dev->kobj); if (!main_kobj) {
err = -ENODEV; goto err_out;
}
/* Formally register this instance's kobject under the edac_device */
err = kobject_init_and_add(&instance->kobj, &ktype_instance_ctrl,
&edac_dev->kobj, "%s", instance->name); if (err != 0) {
edac_dbg(2, "Failed to register instance '%s'\n",
instance->name);
kobject_put(main_kobj); goto err_out;
}
edac_dbg(4, "now register '%d' blocks for instance %d\n",
instance->nr_blocks, idx);
/* register all blocks of this instance */ for (i = 0; i < instance->nr_blocks; i++) {
err = edac_device_create_block(edac_dev, instance,
&instance->blocks[i]); if (err) { /* If any fail, remove all previous ones */ for (j = 0; j < i; j++)
edac_device_delete_block(edac_dev,
&instance->blocks[j]); goto err_release_instance_kobj;
}
}
kobject_uevent(&instance->kobj, KOBJ_ADD);
/* *edac_device_remove_instance *removeanedac_deviceinstance
*/ staticvoid edac_device_delete_instance(struct edac_device_ctl_info *edac_dev, int idx)
{ struct edac_device_instance *instance; int i;
instance = &edac_dev->instances[idx];
/* unregister all blocks in this instance */ for (i = 0; i < instance->nr_blocks; i++)
edac_device_delete_block(edac_dev, &instance->blocks[i]);
/* unregister this instance's kobject, SEE: *edac_device_ctrl_instance_release()forcallbackoperation
*/
kobject_put(&instance->kobj);
}
/* *edac_device_create_instances *createthefirstlevelof'instances'forthisdevice *(ie'cache'mighthave'cache0','cache1','cache2',etc
*/ staticint edac_device_create_instances(struct edac_device_ctl_info *edac_dev)
{ int i, j; int err;
edac_dbg(0, "\n");
/* iterate over creation of the instances */ for (i = 0; i < edac_dev->nr_instances; i++) {
err = edac_device_create_instance(edac_dev, i); if (err) { /* unwind previous instances on error */ for (j = 0; j < i; j++)
edac_device_delete_instance(edac_dev, j); return err;
}
}
sysfs_attrib = edac_dev->sysfs_attributes; if (sysfs_attrib) { /* iterate over the array and create an attribute for each *entryinthelist
*/ while (sysfs_attrib->attr.name != NULL) {
err = sysfs_create_file(&edac_dev->kobj,
(struct attribute*) sysfs_attrib); if (err) goto err_out;
/* go create any main attributes callers wants */
err = edac_device_add_main_sysfs_attributes(edac_dev); if (err) {
edac_dbg(0, "failed to add sysfs attribs\n"); goto err_out;
}
/* create a symlink from the edac device *totheplatform'device'beingusedforthis
*/
err = sysfs_create_link(edac_kobj,
&edac_dev->dev->kobj, EDAC_DEVICE_SYMLINK); if (err) {
edac_dbg(0, "sysfs_create_link() returned err= %d\n", err); goto err_remove_main_attribs;
}
/* Create the first level instance directories *Inturn,thenestedblocksbeneaththeinstanceswill *beregisteredaswell
*/
err = edac_device_create_instances(edac_dev); if (err) {
edac_dbg(0, "edac_device_create_instances() returned err= %d\n",
err); goto err_remove_link;
}
/* remove any main attributes for this device */
edac_device_remove_main_sysfs_attributes(edac_dev);
/* remove the device sym link */
sysfs_remove_link(&edac_dev->kobj, EDAC_DEVICE_SYMLINK);
/* walk the instance/block kobject tree, deconstructing it */
edac_device_delete_instances(edac_dev);
}
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.26Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-09-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.