summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2013-07-11 22:55:51 -0700
committerGuenter Roeck <linux@roeck-us.net>2013-10-13 16:16:28 -0700
commit0d36dce0f1d15a9ca55f893b3aa5ce7c297e11c8 (patch)
treedc42b1ee4a2a1a772b3db0ff22a27e8e75b8ff17
parenta150d95b7ce55fca87143f8ddce02f661e2fc6ec (diff)
downloadop-kernel-dev-0d36dce0f1d15a9ca55f893b3aa5ce7c297e11c8.zip
op-kernel-dev-0d36dce0f1d15a9ca55f893b3aa5ce7c297e11c8.tar.gz
hwmon: (ds1621) Convert to use devm_hwmon_device_register_with_groups
Also use new macro __ATTRIBUTE_GROUPS to declare attribute groups. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/ds1621.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c
index 595f4ef..5e398c9 100644
--- a/drivers/hwmon/ds1621.c
+++ b/drivers/hwmon/ds1621.c
@@ -354,11 +354,7 @@ static const struct attribute_group ds1621_group = {
.attrs = ds1621_attributes,
.is_visible = ds1621_attribute_visible
};
-
-static const struct attribute_group *ds1621_groups[] = {
- &ds1621_group,
- NULL
-};
+__ATTRIBUTE_GROUPS(ds1621);
static int ds1621_probe(struct i2c_client *client,
const struct i2c_device_id *id)
@@ -379,23 +375,12 @@ static int ds1621_probe(struct i2c_client *client,
/* Initialize the DS1621 chip */
ds1621_init_client(data, client);
- hwmon_dev = hwmon_device_register_with_groups(&client->dev,
- client->name, data,
- ds1621_groups);
+ hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev,
+ client->name, data,
+ ds1621_groups);
if (IS_ERR(hwmon_dev))
return PTR_ERR(hwmon_dev);
- i2c_set_clientdata(client, hwmon_dev);
-
- return 0;
-}
-
-static int ds1621_remove(struct i2c_client *client)
-{
- struct device *hwmon_dev = i2c_get_clientdata(client);
-
- hwmon_device_unregister(hwmon_dev);
-
return 0;
}
@@ -416,7 +401,6 @@ static struct i2c_driver ds1621_driver = {
.name = "ds1621",
},
.probe = ds1621_probe,
- .remove = ds1621_remove,
.id_table = ds1621_id,
};
OpenPOWER on IntegriCloud