]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Input: ad7879 - use device core to create driver-specific device attributes
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 29 Jul 2023 00:51:15 +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.

Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230729005133.1095051-6-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/ad7879-i2c.c
drivers/input/touchscreen/ad7879-spi.c
drivers/input/touchscreen/ad7879.c
drivers/input/touchscreen/ad7879.h

index feaa6f8b01ed67baea5de8c8a9dc853b21e8da1e..5c094ab746989678df08d30170504b6d6aec7cc2 100644 (file)
@@ -58,9 +58,10 @@ MODULE_DEVICE_TABLE(of, ad7879_i2c_dt_ids);
 
 static struct i2c_driver ad7879_i2c_driver = {
        .driver = {
-               .name   = "ad7879",
-               .pm     = &ad7879_pm_ops,
-               .of_match_table = of_match_ptr(ad7879_i2c_dt_ids),
+               .name           = "ad7879",
+               .dev_groups     = ad7879_groups,
+               .pm             = &ad7879_pm_ops,
+               .of_match_table = of_match_ptr(ad7879_i2c_dt_ids),
        },
        .probe          = ad7879_i2c_probe,
        .id_table       = ad7879_id,
index 50e88984680032ab89ff6811ed65dabd325da7f0..064968fe57cfd54ff80ac3d927572ef4b7acc6a1 100644 (file)
@@ -56,9 +56,10 @@ MODULE_DEVICE_TABLE(of, ad7879_spi_dt_ids);
 
 static struct spi_driver ad7879_spi_driver = {
        .driver = {
-               .name   = "ad7879",
-               .pm     = &ad7879_pm_ops,
-               .of_match_table = of_match_ptr(ad7879_spi_dt_ids),
+               .name           = "ad7879",
+               .dev_groups     = ad7879_groups,
+               .pm             = &ad7879_pm_ops,
+               .of_match_table = of_match_ptr(ad7879_spi_dt_ids),
        },
        .probe          = ad7879_spi_probe,
 };
index e850853328f1b3bd9f13f46ab8644cfda1f45516..e5d69bf2276e0f9fb5424e7cda1983325c00c56a 100644 (file)
@@ -391,6 +391,12 @@ static const struct attribute_group ad7879_attr_group = {
        .attrs = ad7879_attributes,
 };
 
+const struct attribute_group *ad7879_groups[] = {
+       &ad7879_attr_group,
+       NULL
+};
+EXPORT_SYMBOL_GPL(ad7879_groups);
+
 #ifdef CONFIG_GPIOLIB
 static int ad7879_gpio_direction_input(struct gpio_chip *chip,
                                        unsigned gpio)
@@ -612,10 +618,6 @@ int ad7879_probe(struct device *dev, struct regmap *regmap,
 
        __ad7879_disable(ts);
 
-       err = devm_device_add_group(dev, &ad7879_attr_group);
-       if (err)
-               return err;
-
        err = ad7879_gpio_add(ts);
        if (err)
                return err;
index ae8aa1428e56b7de7ca2af89956ed7b677dd6ba0..d71a8e787290002037833732a3a410f71511a1a1 100644 (file)
@@ -8,11 +8,14 @@
 #ifndef _AD7879_H_
 #define _AD7879_H_
 
+#include <linux/pm.h>
 #include <linux/types.h>
 
+struct attribute_group;
 struct device;
 struct regmap;
 
+extern const struct attribute_group *ad7879_groups[];
 extern const struct dev_pm_ops ad7879_pm_ops;
 
 int ad7879_probe(struct device *dev, struct regmap *regmap,