All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH 1/3] hwmon: (lm63) Create attributes for LM96163 in one call
@ 2014-01-20 18:38 Guenter Roeck
  2014-02-02 18:02 ` Jean Delvare
  2014-02-02 18:15 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Guenter Roeck @ 2014-01-20 18:38 UTC (permalink / raw)
  To: lm-sensors

There is no need to have both an attribute group plus an individual attribute
for LM96163. Add the attribute to the group and create all attributes with one
call.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/hwmon/lm63.c |   25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c
index d0def50..438e612 100644
--- a/drivers/hwmon/lm63.c
+++ b/drivers/hwmon/lm63.c
@@ -915,7 +915,8 @@ static struct attribute *lm63_attributes[] = {
 	NULL
 };
 
-static struct attribute *lm63_attributes_extra_lut[] = {
+static struct attribute *lm63_attributes_lm96163[] = {
+	&dev_attr_temp2_type.attr,
 	&sensor_dev_attr_pwm1_auto_point9_pwm.dev_attr.attr,
 	&sensor_dev_attr_pwm1_auto_point9_temp.dev_attr.attr,
 	&sensor_dev_attr_pwm1_auto_point9_temp_hyst.dev_attr.attr,
@@ -931,8 +932,8 @@ static struct attribute *lm63_attributes_extra_lut[] = {
 	NULL
 };
 
-static const struct attribute_group lm63_group_extra_lut = {
-	.attrs = lm63_attributes_extra_lut,
+static const struct attribute_group lm63_group_lm96163 = {
+	.attrs = lm63_attributes_lm96163,
 };
 
 /*
@@ -1133,12 +1134,8 @@ static int lm63_probe(struct i2c_client *client,
 			goto exit_remove_files;
 	}
 	if (data->kind = lm96163) {
-		err = device_create_file(&client->dev, &dev_attr_temp2_type);
-		if (err)
-			goto exit_remove_files;
-
 		err = sysfs_create_group(&client->dev.kobj,
-					 &lm63_group_extra_lut);
+					 &lm63_group_lm96163);
 		if (err)
 			goto exit_remove_files;
 	}
@@ -1154,10 +1151,8 @@ static int lm63_probe(struct i2c_client *client,
 exit_remove_files:
 	sysfs_remove_group(&client->dev.kobj, &lm63_group);
 	sysfs_remove_group(&client->dev.kobj, &lm63_group_fan1);
-	if (data->kind = lm96163) {
-		device_remove_file(&client->dev, &dev_attr_temp2_type);
-		sysfs_remove_group(&client->dev.kobj, &lm63_group_extra_lut);
-	}
+	if (data->kind = lm96163)
+		sysfs_remove_group(&client->dev.kobj, &lm63_group_lm96163);
 	return err;
 }
 
@@ -1168,10 +1163,8 @@ static int lm63_remove(struct i2c_client *client)
 	hwmon_device_unregister(data->hwmon_dev);
 	sysfs_remove_group(&client->dev.kobj, &lm63_group);
 	sysfs_remove_group(&client->dev.kobj, &lm63_group_fan1);
-	if (data->kind = lm96163) {
-		device_remove_file(&client->dev, &dev_attr_temp2_type);
-		sysfs_remove_group(&client->dev.kobj, &lm63_group_extra_lut);
-	}
+	if (data->kind = lm96163)
+		sysfs_remove_group(&client->dev.kobj, &lm63_group_lm96163);
 
 	return 0;
 }
-- 
1.7.9.7


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-02 18:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-20 18:38 [lm-sensors] [PATCH 1/3] hwmon: (lm63) Create attributes for LM96163 in one call Guenter Roeck
2014-02-02 18:02 ` Jean Delvare
2014-02-02 18:15 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.