diff options
author | Douglas Thompson <dougthompson@xmission.com> | 2007-07-19 04:50:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:56 -0400 |
commit | fd309a9d8e63e9176759d00630b65d772ae06e0c (patch) | |
tree | 6862ba1ef11429b8ed51b005ad7db6ae4144e970 /drivers/edac/edac_device_sysfs.c | |
parent | 7d8536fb484360f35c0a9e3631641948bf168e2b (diff) |
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.c | 22 |
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, | |||
456 | struct edac_device_instance *instance, | 456 | struct edac_device_instance *instance, |
457 | int idx) | 457 | int idx) |
458 | { | 458 | { |
459 | int i; | ||
459 | int err; | 460 | int err; |
460 | struct edac_device_block *block; | 461 | struct edac_device_block *block; |
462 | struct edac_dev_sysfs_block_attribute *sysfs_attrib; | ||
461 | 463 | ||
462 | block = &instance->blocks[idx]; | 464 | block = &instance->blocks[idx]; |
463 | 465 | ||
@@ -480,7 +482,27 @@ static int edac_device_create_block(struct edac_device_ctl_info *edac_dev, | |||
480 | return err; | 482 | return err; |
481 | } | 483 | } |
482 | 484 | ||
485 | /* If there are driver level block attributes, then added them | ||
486 | * to the block kobject | ||
487 | */ | ||
488 | sysfs_attrib = block->block_attributes; | ||
489 | if (sysfs_attrib != NULL) { | ||
490 | for (i = 0; i < block->nr_attribs; i++) { | ||
491 | err = sysfs_create_file(&block->kobj, | ||
492 | (struct attribute *) &sysfs_attrib[i]); | ||
493 | if (err) | ||
494 | goto err_on_attrib; | ||
495 | |||
496 | sysfs_attrib++; | ||
497 | } | ||
498 | } | ||
499 | |||
483 | return 0; | 500 | return 0; |
501 | |||
502 | err_on_attrib: | ||
503 | kobject_unregister(&block->kobj); | ||
504 | |||
505 | return err; | ||
484 | } | 506 | } |
485 | 507 | ||
486 | /* | 508 | /* |