Skip to content

Commit 9609b90

Browse files
committed
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: Dmitry Torokhov <[email protected]>
1 parent 3ccd63d commit 9609b90

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

drivers/input/mouse/elan_i2c_core.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,13 +1138,6 @@ static void elan_disable_regulator(void *_data)
11381138
regulator_disable(data->vcc);
11391139
}
11401140

1141-
static void elan_remove_sysfs_groups(void *_data)
1142-
{
1143-
struct elan_tp_data *data = _data;
1144-
1145-
sysfs_remove_groups(&data->client->dev.kobj, elan_sysfs_groups);
1146-
}
1147-
11481141
static int elan_probe(struct i2c_client *client,
11491142
const struct i2c_device_id *dev_id)
11501143
{
@@ -1269,20 +1262,12 @@ static int elan_probe(struct i2c_client *client,
12691262
return error;
12701263
}
12711264

1272-
error = sysfs_create_groups(&dev->kobj, elan_sysfs_groups);
1265+
error = devm_device_add_groups(dev, elan_sysfs_groups);
12731266
if (error) {
12741267
dev_err(dev, "failed to create sysfs attributes: %d\n", error);
12751268
return error;
12761269
}
12771270

1278-
error = devm_add_action(dev, elan_remove_sysfs_groups, data);
1279-
if (error) {
1280-
elan_remove_sysfs_groups(data);
1281-
dev_err(dev, "Failed to add sysfs cleanup action: %d\n",
1282-
error);
1283-
return error;
1284-
}
1285-
12861271
error = input_register_device(data->input);
12871272
if (error) {
12881273
dev_err(dev, "failed to register input device: %d\n", error);

0 commit comments

Comments
 (0)