aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_device_sysfs.c
diff options
context:
space:
mode:
authorDouglas Thompson <dougthompson@xmission.com>2007-07-19 04:50:20 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:55 -0400
commit52490c8d07680a7ecc3c1a70a16841455d37e96a (patch)
treeacebfdd53c8512bbda09fee32347828a0d0ed368 /drivers/edac/edac_device_sysfs.c
parentb2ccaecad2b00bf7bc72d5b864425daf43a4080d (diff)
drivers/edac: edac_device code tidying
For the file edac_device.c perform some coding style enhancements Add some function header comments Made for better readability commands Signed-off-by: Douglas Thompson <dougthompson@xmission.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, 8 insertions, 14 deletions
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c
index 5bf7cbab27d4..7a233e6e2b36 100644
--- a/drivers/edac/edac_device_sysfs.c
+++ b/drivers/edac/edac_device_sysfs.c
@@ -292,8 +292,8 @@ static void edac_device_ctrl_instance_release(struct kobject *kobj)
292/* instance specific attribute structure */ 292/* instance specific attribute structure */
293struct instance_attribute { 293struct instance_attribute {
294 struct attribute attr; 294 struct attribute attr;
295 ssize_t(*show) (struct edac_device_instance *, char *); 295 ssize_t(*show) (struct edac_device_instance *, char *);
296 ssize_t(*store) (struct edac_device_instance *, const char *, size_t); 296 ssize_t(*store) (struct edac_device_instance *, const char *, size_t);
297}; 297};
298 298
299/* Function to 'show' fields from the edac_dev 'instance' structure */ 299/* Function to 'show' fields from the edac_dev 'instance' structure */
@@ -540,9 +540,8 @@ static int edac_device_create_instance(struct edac_device_ctl_info *edac_dev,
540 for (i = 0; i < instance->nr_blocks; i++) { 540 for (i = 0; i < instance->nr_blocks; i++) {
541 err = edac_device_create_block(edac_dev, instance, i); 541 err = edac_device_create_block(edac_dev, instance, i);
542 if (err) { 542 if (err) {
543 for (j = 0; j < i; j++) { 543 for (j = 0; j < i; j++)
544 edac_device_delete_block(edac_dev, instance, j); 544 edac_device_delete_block(edac_dev, instance, j);
545 }
546 return err; 545 return err;
547 } 546 }
548 } 547 }
@@ -566,9 +565,8 @@ static void edac_device_delete_instance(struct edac_device_ctl_info *edac_dev,
566 instance = &edac_dev->instances[idx]; 565 instance = &edac_dev->instances[idx];
567 566
568 /* unregister all blocks in this instance */ 567 /* unregister all blocks in this instance */
569 for (i = 0; i < instance->nr_blocks; i++) { 568 for (i = 0; i < instance->nr_blocks; i++)
570 edac_device_delete_block(edac_dev, instance, i); 569 edac_device_delete_block(edac_dev, instance, i);
571 }
572 570
573 /* unregister this instance's kobject */ 571 /* unregister this instance's kobject */
574 init_completion(&instance->kobj_complete); 572 init_completion(&instance->kobj_complete);
@@ -593,9 +591,8 @@ static int edac_device_create_instances(struct edac_device_ctl_info *edac_dev)
593 err = edac_device_create_instance(edac_dev, i); 591 err = edac_device_create_instance(edac_dev, i);
594 if (err) { 592 if (err) {
595 /* unwind previous instances on error */ 593 /* unwind previous instances on error */
596 for (j = 0; j < i; j++) { 594 for (j = 0; j < i; j++)
597 edac_device_delete_instance(edac_dev, j); 595 edac_device_delete_instance(edac_dev, j);
598 }
599 return err; 596 return err;
600 } 597 }
601 } 598 }
@@ -612,9 +609,8 @@ static void edac_device_delete_instances(struct edac_device_ctl_info *edac_dev)
612 int i; 609 int i;
613 610
614 /* iterate over creation of the instances */ 611 /* iterate over creation of the instances */
615 for (i = 0; i < edac_dev->nr_instances; i++) { 612 for (i = 0; i < edac_dev->nr_instances; i++)
616 edac_device_delete_instance(edac_dev, i); 613 edac_device_delete_instance(edac_dev, i);
617 }
618} 614}
619 615
620/******************* edac_dev sysfs ctor/dtor code *************/ 616/******************* edac_dev sysfs ctor/dtor code *************/
@@ -637,9 +633,8 @@ static int edac_device_add_sysfs_attributes(
637 while (sysfs_attrib->attr.name != NULL) { 633 while (sysfs_attrib->attr.name != NULL) {
638 err = sysfs_create_file(&edac_dev->kobj, 634 err = sysfs_create_file(&edac_dev->kobj,
639 (struct attribute*) sysfs_attrib); 635 (struct attribute*) sysfs_attrib);
640 if (err) { 636 if (err)
641 return err; 637 return err;
642 }
643 638
644 sysfs_attrib++; 639 sysfs_attrib++;
645 } 640 }
@@ -696,9 +691,8 @@ int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev)
696 691
697 /* Create the first level instance directories */ 692 /* Create the first level instance directories */
698 err = edac_device_create_instances(edac_dev); 693 err = edac_device_create_instances(edac_dev);
699 if (err) { 694 if (err)
700 goto err_remove_link; 695 goto err_remove_link;
701 }
702 696
703 return 0; 697 return 0;
704 698