drivers/edac: fix leaf sysfs attribute

This patch fixes and enhances the driver level set of sysfs attributes that
can be added to the 'block' level of an edac_device type of driver.

There is a controller information structure, which contains one or more
instances of device.  Each instance will have one or more blocks of device
specific counters.  This patch fixes the ability to have more detailed
attributes/controls for each of the 'blocks', providing for the addition of
controls/attributes from the low level driver to user space via sysfs.

Cc: Alan Cox alan@lxorguk.ukuu.org.uk
Signed-off-by: Douglas Thompson <dougthompson@xmission.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Douglas Thompson
2007-07-19 01:50:25 -07:00
committed by Linus Torvalds
parent 7d8536fb48
commit fd309a9d8e
3 changed files with 113 additions and 66 deletions

View File

@@ -456,8 +456,10 @@ static int edac_device_create_block(struct edac_device_ctl_info *edac_dev,
struct edac_device_instance *instance,
int idx)
{
int i;
int err;
struct edac_device_block *block;
struct edac_dev_sysfs_block_attribute *sysfs_attrib;
block = &instance->blocks[idx];
@@ -480,7 +482,27 @@ static int edac_device_create_block(struct edac_device_ctl_info *edac_dev,
return err;
}
/* If there are driver level block attributes, then added them
* to the block kobject
*/
sysfs_attrib = block->block_attributes;
if (sysfs_attrib != NULL) {
for (i = 0; i < block->nr_attribs; i++) {
err = sysfs_create_file(&block->kobj,
(struct attribute *) &sysfs_attrib[i]);
if (err)
goto err_on_attrib;
sysfs_attrib++;
}
}
return 0;
err_on_attrib:
kobject_unregister(&block->kobj);
return err;
}
/*