summaryrefslogtreecommitdiff
path: root/drivers/edac/edac_device_sysfs.c
diff options
context:
space:
mode:
authorDouglas Thompson <dougthompson@xmission.com>2007-07-19 12:50:25 +0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 21:04:56 +0400
commitfd309a9d8e63e9176759d00630b65d772ae06e0c (patch)
tree6862ba1ef11429b8ed51b005ad7db6ae4144e970 /drivers/edac/edac_device_sysfs.c
parent7d8536fb484360f35c0a9e3631641948bf168e2b (diff)
downloadlinux-fd309a9d8e63e9176759d00630b65d772ae06e0c.tar.xz
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>
Diffstat (limited to 'drivers/edac/edac_device_sysfs.c')
-rw-r--r--drivers/edac/edac_device_sysfs.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c
index 7a233e6e2b36..235b4c79355d 100644
--- a/drivers/edac/edac_device_sysfs.c
+++ b/drivers/edac/edac_device_sysfs.c
@@ -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;
}
/*