diff options
author | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-02-25 17:26:47 +0100 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-03-15 06:36:25 +0100 |
commit | bc6db2b5ce79b1d5c4ba2763948fa6e731d60295 (patch) | |
tree | d243af5c11d9d8e79d8631cb0b0fef9ddabf63d3 /drivers/hwmon/lm85.c | |
parent | hwmon: (lm85) Use boolean to determine if VID5 is configured (diff) | |
download | linux-bc6db2b5ce79b1d5c4ba2763948fa6e731d60295.tar.xz linux-bc6db2b5ce79b1d5c4ba2763948fa6e731d60295.zip |
hwmon: (lm85) Use function to remove sysfs attribute files
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/lm85.c')
-rw-r--r-- | drivers/hwmon/lm85.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 22536761a7fd..590226a7c5a2 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c @@ -1281,6 +1281,15 @@ static int lm85_detect(struct i2c_client *client, struct i2c_board_info *info) return 0; } +static void lm85_remove_files(struct i2c_client *client, struct lm85_data *data) +{ + sysfs_remove_group(&client->dev.kobj, &lm85_group); + if (!data->has_vid5) + sysfs_remove_group(&client->dev.kobj, &lm85_group_in4); + if (data->type == emc6d100) + sysfs_remove_group(&client->dev.kobj, &lm85_group_in567); +} + static int lm85_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -1349,10 +1358,7 @@ static int lm85_probe(struct i2c_client *client, /* Error out and cleanup code */ err_remove_files: - sysfs_remove_group(&client->dev.kobj, &lm85_group); - sysfs_remove_group(&client->dev.kobj, &lm85_group_in4); - if (data->type == emc6d100) - sysfs_remove_group(&client->dev.kobj, &lm85_group_in567); + lm85_remove_files(client, data); err_kfree: kfree(data); return err; @@ -1362,10 +1368,7 @@ static int lm85_remove(struct i2c_client *client) { struct lm85_data *data = i2c_get_clientdata(client); hwmon_device_unregister(data->hwmon_dev); - sysfs_remove_group(&client->dev.kobj, &lm85_group); - sysfs_remove_group(&client->dev.kobj, &lm85_group_in4); - if (data->type == emc6d100) - sysfs_remove_group(&client->dev.kobj, &lm85_group_in567); + lm85_remove_files(client, data); kfree(data); return 0; } |