Commit 9609b904 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: elan_i2c - switch to using devm_device_add_groups()

Instead of installing custom devm cleanup action to remove attribute
groups on failure, let's use the dedicated devm API.
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 3ccd63d3
...@@ -1138,13 +1138,6 @@ static void elan_disable_regulator(void *_data) ...@@ -1138,13 +1138,6 @@ static void elan_disable_regulator(void *_data)
regulator_disable(data->vcc); regulator_disable(data->vcc);
} }
static void elan_remove_sysfs_groups(void *_data)
{
struct elan_tp_data *data = _data;
sysfs_remove_groups(&data->client->dev.kobj, elan_sysfs_groups);
}
static int elan_probe(struct i2c_client *client, static int elan_probe(struct i2c_client *client,
const struct i2c_device_id *dev_id) const struct i2c_device_id *dev_id)
{ {
...@@ -1269,20 +1262,12 @@ static int elan_probe(struct i2c_client *client, ...@@ -1269,20 +1262,12 @@ static int elan_probe(struct i2c_client *client,
return error; return error;
} }
error = sysfs_create_groups(&dev->kobj, elan_sysfs_groups); error = devm_device_add_groups(dev, elan_sysfs_groups);
if (error) { if (error) {
dev_err(dev, "failed to create sysfs attributes: %d\n", error); dev_err(dev, "failed to create sysfs attributes: %d\n", error);
return error; return error;
} }
error = devm_add_action(dev, elan_remove_sysfs_groups, data);
if (error) {
elan_remove_sysfs_groups(data);
dev_err(dev, "Failed to add sysfs cleanup action: %d\n",
error);
return error;
}
error = input_register_device(data->input); error = input_register_device(data->input);
if (error) { if (error) {
dev_err(dev, "failed to register input device: %d\n", error); dev_err(dev, "failed to register input device: %d\n", error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment