Skip to content

Commit a122a6f

Browse files
committed
Input: atmel_mxt_ts - use driver core to instantiate device attributes
Instead of manually creating driver-specific device attributes, set struct driver->dev_groups pointer to have the driver core do it. Reviewed-by: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 8c98ddd commit a122a6f

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

drivers/input/touchscreen/atmel_mxt_ts.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3069,9 +3069,7 @@ static struct attribute *mxt_attrs[] = {
30693069
NULL
30703070
};
30713071

3072-
static const struct attribute_group mxt_attr_group = {
3073-
.attrs = mxt_attrs,
3074-
};
3072+
ATTRIBUTE_GROUPS(mxt);
30753073

30763074
static void mxt_start(struct mxt_data *data)
30773075
{
@@ -3348,18 +3346,8 @@ static int mxt_probe(struct i2c_client *client)
33483346
if (error)
33493347
goto err_disable_regulators;
33503348

3351-
error = sysfs_create_group(&client->dev.kobj, &mxt_attr_group);
3352-
if (error) {
3353-
dev_err(&client->dev, "Failure %d creating sysfs group\n",
3354-
error);
3355-
goto err_free_object;
3356-
}
3357-
33583349
return 0;
33593350

3360-
err_free_object:
3361-
mxt_free_input_device(data);
3362-
mxt_free_object_table(data);
33633351
err_disable_regulators:
33643352
regulator_bulk_disable(ARRAY_SIZE(data->regulators),
33653353
data->regulators);
@@ -3371,7 +3359,6 @@ static void mxt_remove(struct i2c_client *client)
33713359
struct mxt_data *data = i2c_get_clientdata(client);
33723360

33733361
disable_irq(data->irq);
3374-
sysfs_remove_group(&client->dev.kobj, &mxt_attr_group);
33753362
mxt_free_input_device(data);
33763363
mxt_free_object_table(data);
33773364
regulator_bulk_disable(ARRAY_SIZE(data->regulators),
@@ -3455,6 +3442,7 @@ MODULE_DEVICE_TABLE(i2c, mxt_id);
34553442
static struct i2c_driver mxt_driver = {
34563443
.driver = {
34573444
.name = "atmel_mxt_ts",
3445+
.dev_groups = mxt_groups,
34583446
.of_match_table = mxt_of_match,
34593447
.acpi_match_table = ACPI_PTR(mxt_acpi_id),
34603448
.pm = pm_sleep_ptr(&mxt_pm_ops),

0 commit comments

Comments
 (0)