diff options
Diffstat (limited to 'drivers/hwmon/adt7475.c')
-rw-r--r-- | drivers/hwmon/adt7475.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c index e495665569e5..716dae9ff0f7 100644 --- a/drivers/hwmon/adt7475.c +++ b/drivers/hwmon/adt7475.c | |||
@@ -1109,6 +1109,14 @@ static int adt7475_detect(struct i2c_client *client, int kind, | |||
1109 | return 0; | 1109 | return 0; |
1110 | } | 1110 | } |
1111 | 1111 | ||
1112 | static void adt7475_remove_files(struct i2c_client *client, | ||
1113 | struct adt7475_data *data) | ||
1114 | { | ||
1115 | sysfs_remove_group(&client->dev.kobj, &adt7475_attr_group); | ||
1116 | if (data->has_voltage & 0x39) | ||
1117 | sysfs_remove_group(&client->dev.kobj, &adt7490_attr_group); | ||
1118 | } | ||
1119 | |||
1112 | static int adt7475_probe(struct i2c_client *client, | 1120 | static int adt7475_probe(struct i2c_client *client, |
1113 | const struct i2c_device_id *id) | 1121 | const struct i2c_device_id *id) |
1114 | { | 1122 | { |
@@ -1156,9 +1164,7 @@ static int adt7475_probe(struct i2c_client *client, | |||
1156 | return 0; | 1164 | return 0; |
1157 | 1165 | ||
1158 | eremove: | 1166 | eremove: |
1159 | sysfs_remove_group(&client->dev.kobj, &adt7475_attr_group); | 1167 | adt7475_remove_files(client, data); |
1160 | if (data->has_voltage & 0x39) | ||
1161 | sysfs_remove_group(&client->dev.kobj, &adt7490_attr_group); | ||
1162 | efree: | 1168 | efree: |
1163 | kfree(data); | 1169 | kfree(data); |
1164 | return ret; | 1170 | return ret; |
@@ -1169,9 +1175,7 @@ static int adt7475_remove(struct i2c_client *client) | |||
1169 | struct adt7475_data *data = i2c_get_clientdata(client); | 1175 | struct adt7475_data *data = i2c_get_clientdata(client); |
1170 | 1176 | ||
1171 | hwmon_device_unregister(data->hwmon_dev); | 1177 | hwmon_device_unregister(data->hwmon_dev); |
1172 | sysfs_remove_group(&client->dev.kobj, &adt7475_attr_group); | 1178 | adt7475_remove_files(client, data); |
1173 | if (data->has_voltage & 0x39) | ||
1174 | sysfs_remove_group(&client->dev.kobj, &adt7490_attr_group); | ||
1175 | kfree(data); | 1179 | kfree(data); |
1176 | 1180 | ||
1177 | return 0; | 1181 | return 0; |