aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/sis5595.c
diff options
context:
space:
mode:
authorIvo Manca <pinkel@gmail.com>2007-10-15 07:27:13 -0400
committerMark M. Hoffman <mhoffman@lightlink.com>2007-11-08 08:42:45 -0500
commit76e63860daedb302bddd707a765411c902d936bd (patch)
treeedca474909eea2964048e572f346311e655f5f48 /drivers/hwmon/sis5595.c
parent5c726b3ba0d6692253a09d88c701f0c4b45ca248 (diff)
hwmon: (sis5595) Split sis5595_attributes_opt
Use sysfs_create_group instead of individual calls to device_create_file by splitting sis5595_attributes_opt into sis5595_attributes_in4 and sis5595_attributes_temp1. Signed-off-by: Ivo Manca <pinkel@gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/sis5595.c')
-rw-r--r--drivers/hwmon/sis5595.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c
index 9b04d226111a..a276806f3d53 100644
--- a/drivers/hwmon/sis5595.c
+++ b/drivers/hwmon/sis5595.c
@@ -495,12 +495,19 @@ static const struct attribute_group sis5595_group = {
495 .attrs = sis5595_attributes, 495 .attrs = sis5595_attributes,
496}; 496};
497 497
498static struct attribute *sis5595_attributes_opt[] = { 498static struct attribute *sis5595_attributes_in4[] = {
499 &sensor_dev_attr_in4_input.dev_attr.attr, 499 &sensor_dev_attr_in4_input.dev_attr.attr,
500 &sensor_dev_attr_in4_min.dev_attr.attr, 500 &sensor_dev_attr_in4_min.dev_attr.attr,
501 &sensor_dev_attr_in4_max.dev_attr.attr, 501 &sensor_dev_attr_in4_max.dev_attr.attr,
502 &sensor_dev_attr_in4_alarm.dev_attr.attr, 502 &sensor_dev_attr_in4_alarm.dev_attr.attr,
503 NULL
504};
505
506static const struct attribute_group sis5595_group_in4 = {
507 .attrs = sis5595_attributes_in4,
508};
503 509
510static struct attribute *sis5595_attributes_temp1[] = {
504 &dev_attr_temp1_input.attr, 511 &dev_attr_temp1_input.attr,
505 &dev_attr_temp1_max.attr, 512 &dev_attr_temp1_max.attr,
506 &dev_attr_temp1_max_hyst.attr, 513 &dev_attr_temp1_max_hyst.attr,
@@ -508,8 +515,8 @@ static struct attribute *sis5595_attributes_opt[] = {
508 NULL 515 NULL
509}; 516};
510 517
511static const struct attribute_group sis5595_group_opt = { 518static const struct attribute_group sis5595_group_temp1 = {
512 .attrs = sis5595_attributes_opt, 519 .attrs = sis5595_attributes_temp1,
513}; 520};
514 521
515/* This is called when the module is loaded */ 522/* This is called when the module is loaded */
@@ -564,24 +571,12 @@ static int __devinit sis5595_probe(struct platform_device *pdev)
564 if ((err = sysfs_create_group(&pdev->dev.kobj, &sis5595_group))) 571 if ((err = sysfs_create_group(&pdev->dev.kobj, &sis5595_group)))
565 goto exit_free; 572 goto exit_free;
566 if (data->maxins == 4) { 573 if (data->maxins == 4) {
567 if ((err = device_create_file(&pdev->dev, 574 if ((err = sysfs_create_group(&pdev->dev.kobj,
568 &sensor_dev_attr_in4_input.dev_attr)) 575 &sis5595_group_in4)))
569 || (err = device_create_file(&pdev->dev,
570 &sensor_dev_attr_in4_min.dev_attr))
571 || (err = device_create_file(&pdev->dev,
572 &sensor_dev_attr_in4_max.dev_attr))
573 || (err = device_create_file(&pdev->dev,
574 &sensor_dev_attr_in4_alarm.dev_attr)))
575 goto exit_remove_files; 576 goto exit_remove_files;
576 } else { 577 } else {
577 if ((err = device_create_file(&pdev->dev, 578 if ((err = sysfs_create_group(&pdev->dev.kobj,
578 &dev_attr_temp1_input)) 579 &sis5595_group_temp1)))
579 || (err = device_create_file(&pdev->dev,
580 &dev_attr_temp1_max))
581 || (err = device_create_file(&pdev->dev,
582 &dev_attr_temp1_max_hyst))
583 || (err = device_create_file(&pdev->dev,
584 &sensor_dev_attr_temp1_alarm.dev_attr)))
585 goto exit_remove_files; 580 goto exit_remove_files;
586 } 581 }
587 582
@@ -595,7 +590,8 @@ static int __devinit sis5595_probe(struct platform_device *pdev)
595 590
596exit_remove_files: 591exit_remove_files:
597 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group); 592 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group);
598 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_opt); 593 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_in4);
594 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_temp1);
599exit_free: 595exit_free:
600 kfree(data); 596 kfree(data);
601exit_release: 597exit_release:
@@ -610,7 +606,8 @@ static int __devexit sis5595_remove(struct platform_device *pdev)
610 606
611 hwmon_device_unregister(data->hwmon_dev); 607 hwmon_device_unregister(data->hwmon_dev);
612 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group); 608 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group);
613 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_opt); 609 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_in4);
610 sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_temp1);
614 611
615 release_region(data->addr, SIS5595_EXTENT); 612 release_region(data->addr, SIS5595_EXTENT);
616 platform_set_drvdata(pdev, NULL); 613 platform_set_drvdata(pdev, NULL);