aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/gl520sm.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-01-16 19:56:23 -0500
committerGuenter Roeck <guenter.roeck@ericsson.com>2012-03-18 21:27:23 -0400
commitf445a9af939a6989e356a25ca97ea691d98bc336 (patch)
tree04d062e2345cd68b7591a7d5b22272f9aa144229 /drivers/hwmon/gl520sm.c
parent43da3d123a6ec556a2e1b69a3b9c7d33af965fa0 (diff)
hwmon: (gl520sm) Fix: do not use assignment in if condition
Fix checkpatch issue: ERROR: do not use assignment in if condition Replace repeated calls to device_create_file() with calls to sysfs_create_group. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/gl520sm.c')
-rw-r--r--drivers/hwmon/gl520sm.c50
1 files changed, 20 insertions, 30 deletions
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c
index 01a494935198..5ff452b6a4d0 100644
--- a/drivers/hwmon/gl520sm.c
+++ b/drivers/hwmon/gl520sm.c
@@ -720,13 +720,16 @@ static const struct attribute_group gl520_group = {
720 .attrs = gl520_attributes, 720 .attrs = gl520_attributes,
721}; 721};
722 722
723static struct attribute *gl520_attributes_opt[] = { 723static struct attribute *gl520_attributes_in4[] = {
724 &sensor_dev_attr_in4_input.dev_attr.attr, 724 &sensor_dev_attr_in4_input.dev_attr.attr,
725 &sensor_dev_attr_in4_min.dev_attr.attr, 725 &sensor_dev_attr_in4_min.dev_attr.attr,
726 &sensor_dev_attr_in4_max.dev_attr.attr, 726 &sensor_dev_attr_in4_max.dev_attr.attr,
727 &sensor_dev_attr_in4_alarm.dev_attr.attr, 727 &sensor_dev_attr_in4_alarm.dev_attr.attr,
728 &sensor_dev_attr_in4_beep.dev_attr.attr, 728 &sensor_dev_attr_in4_beep.dev_attr.attr,
729 NULL
730};
729 731
732static struct attribute *gl520_attributes_temp2[] = {
730 &sensor_dev_attr_temp2_input.dev_attr.attr, 733 &sensor_dev_attr_temp2_input.dev_attr.attr,
731 &sensor_dev_attr_temp2_max.dev_attr.attr, 734 &sensor_dev_attr_temp2_max.dev_attr.attr,
732 &sensor_dev_attr_temp2_max_hyst.dev_attr.attr, 735 &sensor_dev_attr_temp2_max_hyst.dev_attr.attr,
@@ -735,8 +738,12 @@ static struct attribute *gl520_attributes_opt[] = {
735 NULL 738 NULL
736}; 739};
737 740
738static const struct attribute_group gl520_group_opt = { 741static const struct attribute_group gl520_group_in4 = {
739 .attrs = gl520_attributes_opt, 742 .attrs = gl520_attributes_in4,
743};
744
745static const struct attribute_group gl520_group_temp2 = {
746 .attrs = gl520_attributes_temp2,
740}; 747};
741 748
742 749
@@ -789,32 +796,13 @@ static int gl520_probe(struct i2c_client *client,
789 if (err) 796 if (err)
790 goto exit_free; 797 goto exit_free;
791 798
792 if (data->two_temps) { 799 if (data->two_temps)
793 if ((err = device_create_file(&client->dev, 800 err = sysfs_create_group(&client->dev.kobj, &gl520_group_temp2);
794 &sensor_dev_attr_temp2_input.dev_attr)) 801 else
795 || (err = device_create_file(&client->dev, 802 err = sysfs_create_group(&client->dev.kobj, &gl520_group_in4);
796 &sensor_dev_attr_temp2_max.dev_attr))
797 || (err = device_create_file(&client->dev,
798 &sensor_dev_attr_temp2_max_hyst.dev_attr))
799 || (err = device_create_file(&client->dev,
800 &sensor_dev_attr_temp2_alarm.dev_attr))
801 || (err = device_create_file(&client->dev,
802 &sensor_dev_attr_temp2_beep.dev_attr)))
803 goto exit_remove_files;
804 } else {
805 if ((err = device_create_file(&client->dev,
806 &sensor_dev_attr_in4_input.dev_attr))
807 || (err = device_create_file(&client->dev,
808 &sensor_dev_attr_in4_min.dev_attr))
809 || (err = device_create_file(&client->dev,
810 &sensor_dev_attr_in4_max.dev_attr))
811 || (err = device_create_file(&client->dev,
812 &sensor_dev_attr_in4_alarm.dev_attr))
813 || (err = device_create_file(&client->dev,
814 &sensor_dev_attr_in4_beep.dev_attr)))
815 goto exit_remove_files;
816 }
817 803
804 if (err)
805 goto exit_remove_files;
818 806
819 data->hwmon_dev = hwmon_device_register(&client->dev); 807 data->hwmon_dev = hwmon_device_register(&client->dev);
820 if (IS_ERR(data->hwmon_dev)) { 808 if (IS_ERR(data->hwmon_dev)) {
@@ -826,7 +814,8 @@ static int gl520_probe(struct i2c_client *client,
826 814
827exit_remove_files: 815exit_remove_files:
828 sysfs_remove_group(&client->dev.kobj, &gl520_group); 816 sysfs_remove_group(&client->dev.kobj, &gl520_group);
829 sysfs_remove_group(&client->dev.kobj, &gl520_group_opt); 817 sysfs_remove_group(&client->dev.kobj, &gl520_group_in4);
818 sysfs_remove_group(&client->dev.kobj, &gl520_group_temp2);
830exit_free: 819exit_free:
831 kfree(data); 820 kfree(data);
832exit: 821exit:
@@ -878,7 +867,8 @@ static int gl520_remove(struct i2c_client *client)
878 867
879 hwmon_device_unregister(data->hwmon_dev); 868 hwmon_device_unregister(data->hwmon_dev);
880 sysfs_remove_group(&client->dev.kobj, &gl520_group); 869 sysfs_remove_group(&client->dev.kobj, &gl520_group);
881 sysfs_remove_group(&client->dev.kobj, &gl520_group_opt); 870 sysfs_remove_group(&client->dev.kobj, &gl520_group_in4);
871 sysfs_remove_group(&client->dev.kobj, &gl520_group_temp2);
882 872
883 kfree(data); 873 kfree(data);
884 return 0; 874 return 0;