Commit c9110729 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: elants_i2c - use device core to create driver-specific device attributes

Instead of creating driver-specific device attributes with
devm_device_add_group() have device core do this by setting up dev_groups
pointer in the driver structure.
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230729005133.1095051-9-dmitry.torokhov@gmail.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent a1bdf458
...@@ -1299,7 +1299,7 @@ static ELANTS_VERSION_ATTR(solution_version); ...@@ -1299,7 +1299,7 @@ static ELANTS_VERSION_ATTR(solution_version);
static ELANTS_VERSION_ATTR(bc_version); static ELANTS_VERSION_ATTR(bc_version);
static ELANTS_VERSION_ATTR(iap_version); static ELANTS_VERSION_ATTR(iap_version);
static struct attribute *elants_attributes[] = { static struct attribute *elants_i2c_attrs[] = {
&dev_attr_calibrate.attr, &dev_attr_calibrate.attr,
&dev_attr_update_fw.attr, &dev_attr_update_fw.attr,
&dev_attr_iap_mode.attr, &dev_attr_iap_mode.attr,
...@@ -1313,10 +1313,7 @@ static struct attribute *elants_attributes[] = { ...@@ -1313,10 +1313,7 @@ static struct attribute *elants_attributes[] = {
&elants_ver_attr_iap_version.dattr.attr, &elants_ver_attr_iap_version.dattr.attr,
NULL NULL
}; };
ATTRIBUTE_GROUPS(elants_i2c);
static const struct attribute_group elants_attribute_group = {
.attrs = elants_attributes,
};
static int elants_i2c_power_on(struct elants_data *ts) static int elants_i2c_power_on(struct elants_data *ts)
{ {
...@@ -1552,13 +1549,6 @@ static int elants_i2c_probe(struct i2c_client *client) ...@@ -1552,13 +1549,6 @@ static int elants_i2c_probe(struct i2c_client *client)
return error; return error;
} }
error = devm_device_add_group(&client->dev, &elants_attribute_group);
if (error) {
dev_err(&client->dev, "failed to create sysfs attributes: %d\n",
error);
return error;
}
return 0; return 0;
} }
...@@ -1667,6 +1657,7 @@ static struct i2c_driver elants_i2c_driver = { ...@@ -1667,6 +1657,7 @@ static struct i2c_driver elants_i2c_driver = {
.id_table = elants_i2c_id, .id_table = elants_i2c_id,
.driver = { .driver = {
.name = DEVICE_NAME, .name = DEVICE_NAME,
.dev_groups = elants_i2c_groups,
.pm = pm_sleep_ptr(&elants_i2c_pm_ops), .pm = pm_sleep_ptr(&elants_i2c_pm_ops),
.acpi_match_table = ACPI_PTR(elants_acpi_id), .acpi_match_table = ACPI_PTR(elants_acpi_id),
.of_match_table = of_match_ptr(elants_of_match), .of_match_table = of_match_ptr(elants_of_match),
......
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