diff options
author | Guenter Roeck <linux@roeck-us.net> | 2014-02-02 14:12:40 -0800 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2014-03-03 08:01:04 -0800 |
commit | 94c42cf9a109b70486733669b79a5875f55b6684 (patch) | |
tree | df1bf8b743aaa524e693da4078653fbf6fe52c1d | |
parent | 5230551a26f9f4ab41929b81bf4de96a37eb0ae5 (diff) | |
download | op-kernel-dev-94c42cf9a109b70486733669b79a5875f55b6684.zip op-kernel-dev-94c42cf9a109b70486733669b79a5875f55b6684.tar.gz |
hwmon: (ltc4245) Use device managed function to register hwmon device
This simplifies the code and reduces code size.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
-rw-r--r-- | drivers/hwmon/ltc4245.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/drivers/hwmon/ltc4245.c b/drivers/hwmon/ltc4245.c index d4172933..2c6da5d 100644 --- a/drivers/hwmon/ltc4245.c +++ b/drivers/hwmon/ltc4245.c @@ -512,24 +512,10 @@ static int ltc4245_probe(struct i2c_client *client, /* Add sysfs hooks */ ltc4245_sysfs_add_groups(data); - hwmon_dev = hwmon_device_register_with_groups(&client->dev, - client->name, data, - data->groups); - if (IS_ERR(hwmon_dev)) - return PTR_ERR(hwmon_dev); - - i2c_set_clientdata(client, hwmon_dev); - - return 0; -} - -static int ltc4245_remove(struct i2c_client *client) -{ - struct device *hwmon_dev = i2c_get_clientdata(client); - - hwmon_device_unregister(hwmon_dev); - - return 0; + hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev, + client->name, data, + data->groups); + return PTR_ERR_OR_ZERO(hwmon_dev); } static const struct i2c_device_id ltc4245_id[] = { @@ -544,7 +530,6 @@ static struct i2c_driver ltc4245_driver = { .name = "ltc4245", }, .probe = ltc4245_probe, - .remove = ltc4245_remove, .id_table = ltc4245_id, }; |