Input: iqs269a - use device core to create driver-specific device attributes
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 29 Jul 2023 00:51:12 +0000 (17:51 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 6 Sep 2023 21:23:47 +0000 (14:23 -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: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Jeff LaBundy <jeff@labundy.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230729005133.1095051-3-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/iqs269a.c

index c0a08563987053effad40b29e51d75a8839320d0..3c636c75e8a1f1520ab2c5c3bec4004e023080c8 100644 (file)
@@ -1586,10 +1586,7 @@ static struct attribute *iqs269_attrs[] = {
        &dev_attr_ati_trigger.attr,
        NULL,
 };
-
-static const struct attribute_group iqs269_attr_group = {
-       .attrs = iqs269_attrs,
-};
+ATTRIBUTE_GROUPS(iqs269);
 
 static const struct regmap_config iqs269_regmap_config = {
        .reg_bits = 8,
@@ -1671,10 +1668,6 @@ static int iqs269_probe(struct i2c_client *client)
                return error;
        }
 
-       error = devm_device_add_group(&client->dev, &iqs269_attr_group);
-       if (error)
-               dev_err(&client->dev, "Failed to add attributes: %d\n", error);
-
        return error;
 }
 
@@ -1743,6 +1736,7 @@ MODULE_DEVICE_TABLE(of, iqs269_of_match);
 static struct i2c_driver iqs269_i2c_driver = {
        .driver = {
                .name = "iqs269a",
+               .dev_groups = iqs269_groups,
                .of_match_table = iqs269_of_match,
                .pm = pm_sleep_ptr(&iqs269_pm),
        },