]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Input: elants_i2c - use device core to create driver-specific device attributes
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 29 Jul 2023 00:51:18 +0000 (17:51 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 6 Sep 2023 21:27:18 +0000 (14:27 -0700)
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230729005133.1095051-9-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/elants_i2c.c

index a1af3de9f3109ed6c6887d6b6575a33facf44669..365765d40e627880df9753cc27771345ff31a790 100644 (file)
@@ -1299,7 +1299,7 @@ static ELANTS_VERSION_ATTR(solution_version);
 static ELANTS_VERSION_ATTR(bc_version);
 static ELANTS_VERSION_ATTR(iap_version);
 
-static struct attribute *elants_attributes[] = {
+static struct attribute *elants_i2c_attrs[] = {
        &dev_attr_calibrate.attr,
        &dev_attr_update_fw.attr,
        &dev_attr_iap_mode.attr,
@@ -1313,10 +1313,7 @@ static struct attribute *elants_attributes[] = {
        &elants_ver_attr_iap_version.dattr.attr,
        NULL
 };
-
-static const struct attribute_group elants_attribute_group = {
-       .attrs = elants_attributes,
-};
+ATTRIBUTE_GROUPS(elants_i2c);
 
 static int elants_i2c_power_on(struct elants_data *ts)
 {
@@ -1552,13 +1549,6 @@ static int elants_i2c_probe(struct i2c_client *client)
                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;
 }
 
@@ -1667,6 +1657,7 @@ static struct i2c_driver elants_i2c_driver = {
        .id_table = elants_i2c_id,
        .driver = {
                .name = DEVICE_NAME,
+               .dev_groups = elants_i2c_groups,
                .pm = pm_sleep_ptr(&elants_i2c_pm_ops),
                .acpi_match_table = ACPI_PTR(elants_acpi_id),
                .of_match_table = of_match_ptr(elants_of_match),