Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: ad7879 - 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.

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>

+17 -10
+4 -3
drivers/input/touchscreen/ad7879-i2c.c
··· 58 58 59 59 static struct i2c_driver ad7879_i2c_driver = { 60 60 .driver = { 61 - .name = "ad7879", 62 - .pm = &ad7879_pm_ops, 63 - .of_match_table = of_match_ptr(ad7879_i2c_dt_ids), 61 + .name = "ad7879", 62 + .dev_groups = ad7879_groups, 63 + .pm = &ad7879_pm_ops, 64 + .of_match_table = of_match_ptr(ad7879_i2c_dt_ids), 64 65 }, 65 66 .probe = ad7879_i2c_probe, 66 67 .id_table = ad7879_id,
+4 -3
drivers/input/touchscreen/ad7879-spi.c
··· 56 56 57 57 static struct spi_driver ad7879_spi_driver = { 58 58 .driver = { 59 - .name = "ad7879", 60 - .pm = &ad7879_pm_ops, 61 - .of_match_table = of_match_ptr(ad7879_spi_dt_ids), 59 + .name = "ad7879", 60 + .dev_groups = ad7879_groups, 61 + .pm = &ad7879_pm_ops, 62 + .of_match_table = of_match_ptr(ad7879_spi_dt_ids), 62 63 }, 63 64 .probe = ad7879_spi_probe, 64 65 };
+6 -4
drivers/input/touchscreen/ad7879.c
··· 391 391 .attrs = ad7879_attributes, 392 392 }; 393 393 394 + const struct attribute_group *ad7879_groups[] = { 395 + &ad7879_attr_group, 396 + NULL 397 + }; 398 + EXPORT_SYMBOL_GPL(ad7879_groups); 399 + 394 400 #ifdef CONFIG_GPIOLIB 395 401 static int ad7879_gpio_direction_input(struct gpio_chip *chip, 396 402 unsigned gpio) ··· 617 611 } 618 612 619 613 __ad7879_disable(ts); 620 - 621 - err = devm_device_add_group(dev, &ad7879_attr_group); 622 - if (err) 623 - return err; 624 614 625 615 err = ad7879_gpio_add(ts); 626 616 if (err)
+3
drivers/input/touchscreen/ad7879.h
··· 8 8 #ifndef _AD7879_H_ 9 9 #define _AD7879_H_ 10 10 11 + #include <linux/pm.h> 11 12 #include <linux/types.h> 12 13 14 + struct attribute_group; 13 15 struct device; 14 16 struct regmap; 15 17 18 + extern const struct attribute_group *ad7879_groups[]; 16 19 extern const struct dev_pm_ops ad7879_pm_ops; 17 20 18 21 int ad7879_probe(struct device *dev, struct regmap *regmap,