diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-12-09 20:36:06 +0100 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-12-09 20:36:06 +0100 |
commit | 0f14480b62235ef4fce1cd4755e1cde4c9be5f78 (patch) | |
tree | 2307177c29b69f30cf0a8b35e0e41c58b9340a2e | |
parent | 3d849981711741e76e501e4b9e3e7b792f2b0fd5 (diff) | |
download | blackbird-op-linux-0f14480b62235ef4fce1cd4755e1cde4c9be5f78.tar.gz blackbird-op-linux-0f14480b62235ef4fce1cd4755e1cde4c9be5f78.zip |
hwmon: (adt7475) Move sysfs files removal to a separate function
Move sysfs files removal to a separate function. The code is common to
the device probing error path and the standard device removal path. As
it will grow with future driver development, this avoids code
duplication.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Jordan Crouse <jordan@cosmicpenguin.net>
Cc: "Darrick J. Wong" <djwong@us.ibm.com>
-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, return 0; } +static void adt7475_remove_files(struct i2c_client *client, + struct adt7475_data *data) +{ + sysfs_remove_group(&client->dev.kobj, &adt7475_attr_group); + if (data->has_voltage & 0x39) + sysfs_remove_group(&client->dev.kobj, &adt7490_attr_group); +} + static int adt7475_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -1156,9 +1164,7 @@ static int adt7475_probe(struct i2c_client *client, return 0; eremove: - sysfs_remove_group(&client->dev.kobj, &adt7475_attr_group); - if (data->has_voltage & 0x39) - sysfs_remove_group(&client->dev.kobj, &adt7490_attr_group); + adt7475_remove_files(client, data); efree: kfree(data); return ret; @@ -1169,9 +1175,7 @@ static int adt7475_remove(struct i2c_client *client) struct adt7475_data *data = i2c_get_clientdata(client); hwmon_device_unregister(data->hwmon_dev); - sysfs_remove_group(&client->dev.kobj, &adt7475_attr_group); - if (data->has_voltage & 0x39) - sysfs_remove_group(&client->dev.kobj, &adt7490_attr_group); + adt7475_remove_files(client, data); kfree(data); return 0; |