Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: elants_i2c - use managed devm_device_add_group

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and
friends") has added the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the
action that cleans the sysfs file when exiting the driver.

Signed-off-by: Andi Shyti <andi@etezian.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Andi Shyti and committed by
Dmitry Torokhov
8db69a9a a4b0a58b

+1 -18
+1 -18
drivers/input/touchscreen/elants_i2c.c
··· 1070 1070 .attrs = elants_attributes, 1071 1071 }; 1072 1072 1073 - static void elants_i2c_remove_sysfs_group(void *_data) 1074 - { 1075 - struct elants_data *ts = _data; 1076 - 1077 - sysfs_remove_group(&ts->client->dev.kobj, &elants_attribute_group); 1078 - } 1079 - 1080 1073 static int elants_i2c_power_on(struct elants_data *ts) 1081 1074 { 1082 1075 int error; ··· 1282 1289 if (!client->dev.of_node) 1283 1290 device_init_wakeup(&client->dev, true); 1284 1291 1285 - error = sysfs_create_group(&client->dev.kobj, &elants_attribute_group); 1292 + error = devm_device_add_group(&client->dev, &elants_attribute_group); 1286 1293 if (error) { 1287 1294 dev_err(&client->dev, "failed to create sysfs attributes: %d\n", 1288 - error); 1289 - return error; 1290 - } 1291 - 1292 - error = devm_add_action(&client->dev, 1293 - elants_i2c_remove_sysfs_group, ts); 1294 - if (error) { 1295 - elants_i2c_remove_sysfs_group(ts); 1296 - dev_err(&client->dev, 1297 - "Failed to add sysfs cleanup action: %d\n", 1298 1295 error); 1299 1296 return error; 1300 1297 }