All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes
@ 2023-07-29  0:51 Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 02/22] Input: cyapa " Dmitry Torokhov
                   ` (22 more replies)
  0 siblings, 23 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input
  Cc: linux-kernel, Greg Kroah-Hartman, Benson Leung, Guenter Roeck,
	chrome-platform

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/keyboard/cros_ec_keyb.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
index e7ecfca838df..313b7a69dd69 100644
--- a/drivers/input/keyboard/cros_ec_keyb.c
+++ b/drivers/input/keyboard/cros_ec_keyb.c
@@ -686,10 +686,11 @@ static umode_t cros_ec_keyb_attr_is_visible(struct kobject *kobj,
 	return attr->mode;
 }
 
-static const struct attribute_group cros_ec_keyb_attr_group = {
+static const struct attribute_group cros_ec_keyb_group = {
 	.is_visible = cros_ec_keyb_attr_is_visible,
 	.attrs = cros_ec_keyb_attrs,
 };
+__ATTRIBUTE_GROUPS(cros_ec_keyb);
 
 static int cros_ec_keyb_probe(struct platform_device *pdev)
 {
@@ -730,12 +731,6 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	err = devm_device_add_group(dev, &cros_ec_keyb_attr_group);
-	if (err) {
-		dev_err(dev, "failed to create attributes: %d\n", err);
-		return err;
-	}
-
 	ckdev->notifier.notifier_call = cros_ec_keyb_work;
 	err = blocking_notifier_chain_register(&ckdev->ec->event_notifier,
 					       &ckdev->notifier);
@@ -782,6 +777,7 @@ static struct platform_driver cros_ec_keyb_driver = {
 	.remove = cros_ec_keyb_remove,
 	.driver = {
 		.name = "cros-ec-keyb",
+		.dev_groups = cros_ec_keyb_groups,
 		.of_match_table = of_match_ptr(cros_ec_keyb_of_match),
 		.acpi_match_table = ACPI_PTR(cros_ec_keyb_acpi_match),
 		.pm = pm_sleep_ptr(&cros_ec_keyb_pm_ops),
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 02/22] Input: cyapa - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 03/22] Input: iqs269a " Dmitry Torokhov
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/mouse/cyapa.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
index 6a876ba617ef..f9b4a7458b4e 100644
--- a/drivers/input/mouse/cyapa.c
+++ b/drivers/input/mouse/cyapa.c
@@ -1225,7 +1225,7 @@ static DEVICE_ATTR(baseline, S_IRUGO, cyapa_show_baseline, NULL);
 static DEVICE_ATTR(calibrate, S_IWUSR, NULL, cyapa_calibrate_store);
 static DEVICE_ATTR(mode, S_IRUGO, cyapa_show_mode, NULL);
 
-static struct attribute *cyapa_sysfs_entries[] = {
+static struct attribute *cyapa_attrs[] = {
 	&dev_attr_firmware_version.attr,
 	&dev_attr_product_id.attr,
 	&dev_attr_update_fw.attr,
@@ -1234,10 +1234,7 @@ static struct attribute *cyapa_sysfs_entries[] = {
 	&dev_attr_mode.attr,
 	NULL,
 };
-
-static const struct attribute_group cyapa_sysfs_group = {
-	.attrs = cyapa_sysfs_entries,
-};
+ATTRIBUTE_GROUPS(cyapa);
 
 static void cyapa_disable_regulator(void *data)
 {
@@ -1304,12 +1301,6 @@ static int cyapa_probe(struct i2c_client *client)
 		return error;
 	}
 
-	error = devm_device_add_group(dev, &cyapa_sysfs_group);
-	if (error) {
-		dev_err(dev, "failed to create sysfs entries: %d\n", error);
-		return error;
-	}
-
 	error = cyapa_prepare_wakeup_controls(cyapa);
 	if (error) {
 		dev_err(dev, "failed to prepare wakeup controls: %d\n", error);
@@ -1486,6 +1477,7 @@ MODULE_DEVICE_TABLE(of, cyapa_of_match);
 static struct i2c_driver cyapa_driver = {
 	.driver = {
 		.name = "cyapa",
+		.dev_groups = cyapa_groups,
 		.pm = pm_ptr(&cyapa_pm_ops),
 		.acpi_match_table = ACPI_PTR(cyapa_acpi_id),
 		.of_match_table = of_match_ptr(cyapa_of_match),
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 03/22] Input: iqs269a - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 02/22] Input: cyapa " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-31 15:41   ` Jeff LaBundy
  2023-08-02 13:01   ` Mattijs Korpershoek
  2023-07-29  0:51 ` [PATCH 04/22] Input: kxtj9 " Dmitry Torokhov
                   ` (20 subsequent siblings)
  22 siblings, 2 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input
  Cc: linux-kernel, Greg Kroah-Hartman, Jeff LaBundy, Mattijs Korpershoek

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/misc/iqs269a.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/input/misc/iqs269a.c b/drivers/input/misc/iqs269a.c
index c0a085639870..3c636c75e8a1 100644
--- a/drivers/input/misc/iqs269a.c
+++ b/drivers/input/misc/iqs269a.c
@@ -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),
 	},
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 04/22] Input: kxtj9 - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 02/22] Input: cyapa " Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 03/22] Input: iqs269a " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 05/22] Input: ad7877 " Dmitry Torokhov
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/misc/kxtj9.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/input/misc/kxtj9.c b/drivers/input/misc/kxtj9.c
index 912e614d039d..d47269b10e9a 100644
--- a/drivers/input/misc/kxtj9.c
+++ b/drivers/input/misc/kxtj9.c
@@ -334,14 +334,25 @@ static ssize_t kxtj9_set_poll(struct device *dev, struct device_attribute *attr,
 
 static DEVICE_ATTR(poll, S_IRUGO|S_IWUSR, kxtj9_get_poll, kxtj9_set_poll);
 
-static struct attribute *kxtj9_attributes[] = {
+static struct attribute *kxtj9_attrs[] = {
 	&dev_attr_poll.attr,
 	NULL
 };
 
-static struct attribute_group kxtj9_attribute_group = {
-	.attrs = kxtj9_attributes
+static umode_t kxtj9_attr_is_visible(struct kobject *kobj,
+				     struct attribute *attr, int n)
+{
+	struct device *dev = kobj_to_dev(kobj);
+	struct i2c_client *client = to_i2c_client(dev);
+
+	return client->irq ? attr->mode : 0;
+}
+
+static struct attribute_group kxtj9_group = {
+	.attrs = kxtj9_attrs,
+	.is_visible = kxtj9_attr_is_visible,
 };
+__ATTRIBUTE_GROUPS(kxtj9);
 
 static void kxtj9_poll(struct input_dev *input)
 {
@@ -482,13 +493,6 @@ static int kxtj9_probe(struct i2c_client *client)
 			dev_err(&client->dev, "request irq failed: %d\n", err);
 			return err;
 		}
-
-		err = devm_device_add_group(&client->dev,
-					    &kxtj9_attribute_group);
-		if (err) {
-			dev_err(&client->dev, "sysfs create failed: %d\n", err);
-			return err;
-		}
 	}
 
 	return 0;
@@ -535,8 +539,9 @@ MODULE_DEVICE_TABLE(i2c, kxtj9_id);
 
 static struct i2c_driver kxtj9_driver = {
 	.driver = {
-		.name	= NAME,
-		.pm	= pm_sleep_ptr(&kxtj9_pm_ops),
+		.name		= NAME,
+		.dev_groups	= kxtj9_groups,
+		.pm		= pm_sleep_ptr(&kxtj9_pm_ops),
 	},
 	.probe		= kxtj9_probe,
 	.id_table	= kxtj9_id,
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 05/22] Input: ad7877 - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (2 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 04/22] Input: kxtj9 " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-31  5:23   ` Hennerich, Michael
  2023-07-29  0:51 ` [PATCH 06/22] Input: ad7879 " Dmitry Torokhov
                   ` (18 subsequent siblings)
  22 siblings, 1 reply; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman, Michael Hennerich

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/ad7877.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index edb36d663f22..a0598e9c7aff 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -612,10 +612,11 @@ static umode_t ad7877_attr_is_visible(struct kobject *kobj,
 	return mode;
 }
 
-static const struct attribute_group ad7877_attr_group = {
+static const struct attribute_group ad7877_group = {
 	.is_visible	= ad7877_attr_is_visible,
 	.attrs		= ad7877_attributes,
 };
+__ATTRIBUTE_GROUPS(ad7877);
 
 static void ad7877_setup_ts_def_msg(struct spi_device *spi, struct ad7877 *ts)
 {
@@ -777,10 +778,6 @@ static int ad7877_probe(struct spi_device *spi)
 		return err;
 	}
 
-	err = devm_device_add_group(&spi->dev, &ad7877_attr_group);
-	if (err)
-		return err;
-
 	err = input_register_device(input_dev);
 	if (err)
 		return err;
@@ -810,8 +807,9 @@ static DEFINE_SIMPLE_DEV_PM_OPS(ad7877_pm, ad7877_suspend, ad7877_resume);
 
 static struct spi_driver ad7877_driver = {
 	.driver = {
-		.name	= "ad7877",
-		.pm	= pm_sleep_ptr(&ad7877_pm),
+		.name		= "ad7877",
+		.dev_groups	= ad7877_groups,
+		.pm		= pm_sleep_ptr(&ad7877_pm),
 	},
 	.probe		= ad7877_probe,
 };
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 06/22] Input: ad7879 - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (3 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 05/22] Input: ad7877 " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-31  5:23   ` Hennerich, Michael
  2023-07-29  0:51 ` [PATCH 07/22] Input: ads7846 " Dmitry Torokhov
                   ` (17 subsequent siblings)
  22 siblings, 1 reply; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman, Michael Hennerich

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/ad7879-i2c.c |  7 ++++---
 drivers/input/touchscreen/ad7879-spi.c |  7 ++++---
 drivers/input/touchscreen/ad7879.c     | 10 ++++++----
 drivers/input/touchscreen/ad7879.h     |  3 +++
 4 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/input/touchscreen/ad7879-i2c.c b/drivers/input/touchscreen/ad7879-i2c.c
index feaa6f8b01ed..5c094ab74698 100644
--- a/drivers/input/touchscreen/ad7879-i2c.c
+++ b/drivers/input/touchscreen/ad7879-i2c.c
@@ -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,
diff --git a/drivers/input/touchscreen/ad7879-spi.c b/drivers/input/touchscreen/ad7879-spi.c
index 50e889846800..064968fe57cf 100644
--- a/drivers/input/touchscreen/ad7879-spi.c
+++ b/drivers/input/touchscreen/ad7879-spi.c
@@ -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,
 };
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index e850853328f1..e5d69bf2276e 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -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;
diff --git a/drivers/input/touchscreen/ad7879.h b/drivers/input/touchscreen/ad7879.h
index ae8aa1428e56..d71a8e787290 100644
--- a/drivers/input/touchscreen/ad7879.h
+++ b/drivers/input/touchscreen/ad7879.h
@@ -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,
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 07/22] Input: ads7846 - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (4 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 06/22] Input: ad7879 " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 08/22] Input: edt-ft5x06 " Dmitry Torokhov
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/ads7846.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index bb1058b1e7fd..5601ceb7e26b 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -628,15 +628,12 @@ static ssize_t ads7846_disable_store(struct device *dev,
 
 static DEVICE_ATTR(disable, 0664, ads7846_disable_show, ads7846_disable_store);
 
-static struct attribute *ads784x_attributes[] = {
+static struct attribute *ads784x_attrs[] = {
 	&dev_attr_pen_down.attr,
 	&dev_attr_disable.attr,
 	NULL,
 };
-
-static const struct attribute_group ads784x_attr_group = {
-	.attrs = ads784x_attributes,
-};
+ATTRIBUTE_GROUPS(ads784x);
 
 /*--------------------------------------------------------------------------*/
 
@@ -1395,10 +1392,6 @@ static int ads7846_probe(struct spi_device *spi)
 	else
 		(void) ads7846_read12_ser(dev, READ_12BIT_SER(vaux));
 
-	err = devm_device_add_group(dev, &ads784x_attr_group);
-	if (err)
-		return err;
-
 	err = input_register_device(input_dev);
 	if (err)
 		return err;
@@ -1424,9 +1417,10 @@ static void ads7846_remove(struct spi_device *spi)
 
 static struct spi_driver ads7846_driver = {
 	.driver = {
-		.name	= "ads7846",
-		.pm	= pm_sleep_ptr(&ads7846_pm),
-		.of_match_table = of_match_ptr(ads7846_dt_ids),
+		.name		= "ads7846",
+		.dev_groups	= ads784x_groups,
+		.pm		= pm_sleep_ptr(&ads7846_pm),
+		.of_match_table	= of_match_ptr(ads7846_dt_ids),
 	},
 	.probe		= ads7846_probe,
 	.remove		= ads7846_remove,
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 08/22] Input: edt-ft5x06 - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (5 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 07/22] Input: ads7846 " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 09/22] Input: elants_i2c " Dmitry Torokhov
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/edt-ft5x06.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 457d53337fbb..3e102bcc4a1c 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -580,10 +580,7 @@ static struct attribute *edt_ft5x06_attrs[] = {
 	&dev_attr_crc_errors.attr,
 	NULL
 };
-
-static const struct attribute_group edt_ft5x06_attr_group = {
-	.attrs = edt_ft5x06_attrs,
-};
+ATTRIBUTE_GROUPS(edt_ft5x06);
 
 static void edt_ft5x06_restore_reg_parameters(struct edt_ft5x06_ts_data *tsdata)
 {
@@ -1330,10 +1327,6 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client)
 		return error;
 	}
 
-	error = devm_device_add_group(&client->dev, &edt_ft5x06_attr_group);
-	if (error)
-		return error;
-
 	error = input_register_device(input);
 	if (error)
 		return error;
@@ -1502,6 +1495,7 @@ MODULE_DEVICE_TABLE(of, edt_ft5x06_of_match);
 static struct i2c_driver edt_ft5x06_ts_driver = {
 	.driver = {
 		.name = "edt_ft5x06",
+		.dev_groups = edt_ft5x06_groups,
 		.of_match_table = edt_ft5x06_of_match,
 		.pm = pm_sleep_ptr(&edt_ft5x06_ts_pm_ops),
 		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 09/22] Input: elants_i2c - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (6 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 08/22] Input: edt-ft5x06 " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 10/22] Input: exc3000 " Dmitry Torokhov
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input
  Cc: linux-kernel, Greg Kroah-Hartman, Douglas Anderson, Raul E Rangel

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/elants_i2c.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index a1af3de9f310..365765d40e62 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -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),
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 10/22] Input: exc3000 - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (7 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 09/22] Input: elants_i2c " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 11/22] Input: hideep " Dmitry Torokhov
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/exc3000.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/input/touchscreen/exc3000.c b/drivers/input/touchscreen/exc3000.c
index 4c0d99aae9e0..a4030cc9ff60 100644
--- a/drivers/input/touchscreen/exc3000.c
+++ b/drivers/input/touchscreen/exc3000.c
@@ -325,16 +325,13 @@ static ssize_t type_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(type);
 
-static struct attribute *sysfs_attrs[] = {
+static struct attribute *exc3000_attrs[] = {
 	&dev_attr_fw_version.attr,
 	&dev_attr_model.attr,
 	&dev_attr_type.attr,
 	NULL
 };
-
-static struct attribute_group exc3000_attribute_group = {
-	.attrs = sysfs_attrs
-};
+ATTRIBUTE_GROUPS(exc3000);
 
 static int exc3000_probe(struct i2c_client *client)
 {
@@ -437,10 +434,6 @@ static int exc3000_probe(struct i2c_client *client)
 
 	i2c_set_clientdata(client, data);
 
-	error = devm_device_add_group(&client->dev, &exc3000_attribute_group);
-	if (error)
-		return error;
-
 	return 0;
 }
 
@@ -473,6 +466,7 @@ MODULE_DEVICE_TABLE(acpi, exc3000_acpi_match);
 static struct i2c_driver exc3000_driver = {
 	.driver = {
 		.name	= "exc3000",
+		.dev_groups = exc3000_groups,
 		.of_match_table = of_match_ptr(exc3000_of_match),
 		.acpi_match_table = ACPI_PTR(exc3000_acpi_match),
 	},
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 11/22] Input: hideep - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (8 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 10/22] Input: exc3000 " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 12/22] Input: hycon-hy46xx " Dmitry Torokhov
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/hideep.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/input/touchscreen/hideep.c b/drivers/input/touchscreen/hideep.c
index 404153338df7..0f58258306bf 100644
--- a/drivers/input/touchscreen/hideep.c
+++ b/drivers/input/touchscreen/hideep.c
@@ -954,16 +954,13 @@ static DEVICE_ATTR(version, 0664, hideep_fw_version_show, NULL);
 static DEVICE_ATTR(product_id, 0664, hideep_product_id_show, NULL);
 static DEVICE_ATTR(update_fw, 0664, NULL, hideep_update_fw);
 
-static struct attribute *hideep_ts_sysfs_entries[] = {
+static struct attribute *hideep_ts_attrs[] = {
 	&dev_attr_version.attr,
 	&dev_attr_product_id.attr,
 	&dev_attr_update_fw.attr,
 	NULL,
 };
-
-static const struct attribute_group hideep_ts_attr_group = {
-	.attrs = hideep_ts_sysfs_entries,
-};
+ATTRIBUTE_GROUPS(hideep_ts);
 
 static void hideep_set_work_mode(struct hideep_ts *ts)
 {
@@ -1096,13 +1093,6 @@ static int hideep_probe(struct i2c_client *client)
 		return error;
 	}
 
-	error = devm_device_add_group(&client->dev, &hideep_ts_attr_group);
-	if (error) {
-		dev_err(&client->dev,
-			"failed to add sysfs attributes: %d\n", error);
-		return error;
-	}
-
 	return 0;
 }
 
@@ -1131,6 +1121,7 @@ MODULE_DEVICE_TABLE(of, hideep_match_table);
 static struct i2c_driver hideep_driver = {
 	.driver = {
 		.name			= HIDEEP_I2C_NAME,
+		.dev_groups		= hideep_ts_groups,
 		.of_match_table		= of_match_ptr(hideep_match_table),
 		.acpi_match_table	= ACPI_PTR(hideep_acpi_id),
 		.pm			= pm_sleep_ptr(&hideep_pm_ops),
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 12/22] Input: hycon-hy46xx - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (9 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 11/22] Input: hideep " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 13/22] Input: ili210x " Dmitry Torokhov
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman, Giulio Benetti

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/hycon-hy46xx.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/input/touchscreen/hycon-hy46xx.c b/drivers/input/touchscreen/hycon-hy46xx.c
index 2450cfa14de9..d0f257989fd6 100644
--- a/drivers/input/touchscreen/hycon-hy46xx.c
+++ b/drivers/input/touchscreen/hycon-hy46xx.c
@@ -274,10 +274,7 @@ static struct attribute *hycon_hy46xx_attrs[] = {
 	&hycon_hy46xx_attr_bootloader_version.dattr.attr,
 	NULL
 };
-
-static const struct attribute_group hycon_hy46xx_attr_group = {
-	.attrs = hycon_hy46xx_attrs,
-};
+ATTRIBUTE_GROUPS(hycon_hy46xx);
 
 static void hycon_hy46xx_get_defaults(struct device *dev, struct hycon_hy46xx_data *tsdata)
 {
@@ -535,10 +532,6 @@ static int hycon_hy46xx_probe(struct i2c_client *client)
 		return error;
 	}
 
-	error = devm_device_add_group(&client->dev, &hycon_hy46xx_attr_group);
-	if (error)
-		return error;
-
 	error = input_register_device(input);
 	if (error)
 		return error;
@@ -576,6 +569,7 @@ MODULE_DEVICE_TABLE(of, hycon_hy46xx_of_match);
 static struct i2c_driver hycon_hy46xx_driver = {
 	.driver = {
 		.name = "hycon_hy46xx",
+		.dev_groups = hycon_hy46xx_groups,
 		.of_match_table = hycon_hy46xx_of_match,
 		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 	},
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 13/22] Input: ili210x - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (10 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 12/22] Input: hycon-hy46xx " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29 15:07   ` Marek Vasut
  2023-07-29  0:51 ` [PATCH 14/22] Input: ilitek_ts_i2c " Dmitry Torokhov
                   ` (10 subsequent siblings)
  22 siblings, 1 reply; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman, Marek Vasut

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/ili210x.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
index ad6828e4f2e2..31ffdc2a93f3 100644
--- a/drivers/input/touchscreen/ili210x.c
+++ b/drivers/input/touchscreen/ili210x.c
@@ -876,7 +876,7 @@ static ssize_t ili210x_firmware_update_store(struct device *dev,
 
 static DEVICE_ATTR(firmware_update, 0200, NULL, ili210x_firmware_update_store);
 
-static struct attribute *ili210x_attributes[] = {
+static struct attribute *ili210x_attrs[] = {
 	&dev_attr_calibrate.attr,
 	&dev_attr_firmware_update.attr,
 	&dev_attr_firmware_version.attr,
@@ -904,10 +904,11 @@ static umode_t ili210x_attributes_visible(struct kobject *kobj,
 	return attr->mode;
 }
 
-static const struct attribute_group ili210x_attr_group = {
-	.attrs = ili210x_attributes,
+static const struct attribute_group ili210x_group = {
+	.attrs = ili210x_attrs,
 	.is_visible = ili210x_attributes_visible,
 };
+__ATTRIBUTE_GROUPS(ili210x);
 
 static void ili210x_power_down(void *data)
 {
@@ -1013,13 +1014,6 @@ static int ili210x_i2c_probe(struct i2c_client *client)
 	if (error)
 		return error;
 
-	error = devm_device_add_group(dev, &ili210x_attr_group);
-	if (error) {
-		dev_err(dev, "Unable to create sysfs attributes, err: %d\n",
-			error);
-		return error;
-	}
-
 	error = input_register_device(priv->input);
 	if (error) {
 		dev_err(dev, "Cannot register input device, err: %d\n", error);
@@ -1050,6 +1044,7 @@ MODULE_DEVICE_TABLE(of, ili210x_dt_ids);
 static struct i2c_driver ili210x_ts_driver = {
 	.driver = {
 		.name = "ili210x_i2c",
+		.dev_groups = ili210x_groups,
 		.of_match_table = ili210x_dt_ids,
 	},
 	.id_table = ili210x_i2c_id,
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 14/22] Input: ilitek_ts_i2c - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (11 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 13/22] Input: ili210x " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 15/22] Input: iqs5xx " Dmitry Torokhov
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman, Joe Hung

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/ilitek_ts_i2c.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/input/touchscreen/ilitek_ts_i2c.c b/drivers/input/touchscreen/ilitek_ts_i2c.c
index 2f872e95fbba..90c4934e750a 100644
--- a/drivers/input/touchscreen/ilitek_ts_i2c.c
+++ b/drivers/input/touchscreen/ilitek_ts_i2c.c
@@ -537,10 +537,7 @@ static struct attribute *ilitek_sysfs_attrs[] = {
 	&dev_attr_product_id.attr,
 	NULL
 };
-
-static struct attribute_group ilitek_attrs_group = {
-	.attrs = ilitek_sysfs_attrs,
-};
+ATTRIBUTE_GROUPS(ilitek_sysfs);
 
 static int ilitek_ts_i2c_probe(struct i2c_client *client)
 {
@@ -595,12 +592,6 @@ static int ilitek_ts_i2c_probe(struct i2c_client *client)
 		return error;
 	}
 
-	error = devm_device_add_group(dev, &ilitek_attrs_group);
-	if (error) {
-		dev_err(dev, "sysfs create group failed: %d\n", error);
-		return error;
-	}
-
 	return 0;
 }
 
@@ -675,6 +666,7 @@ MODULE_DEVICE_TABLE(of, ilitek_ts_i2c_match);
 static struct i2c_driver ilitek_ts_i2c_driver = {
 	.driver = {
 		.name = ILITEK_TS_NAME,
+		.dev_groups = ilitek_sysfs_groups,
 		.pm = pm_sleep_ptr(&ilitek_pm_ops),
 		.of_match_table = of_match_ptr(ilitek_ts_i2c_match),
 		.acpi_match_table = ACPI_PTR(ilitekts_acpi_id),
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 15/22] Input: iqs5xx - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (12 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 14/22] Input: ilitek_ts_i2c " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-31 15:43   ` Jeff LaBundy
  2023-07-29  0:51 ` [PATCH 16/22] Input: melfas-mip4 " Dmitry Torokhov
                   ` (8 subsequent siblings)
  22 siblings, 1 reply; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman, Jeff LaBundy

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/iqs5xx.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/input/touchscreen/iqs5xx.c b/drivers/input/touchscreen/iqs5xx.c
index b4768b66eb10..a3f4fb85bee5 100644
--- a/drivers/input/touchscreen/iqs5xx.c
+++ b/drivers/input/touchscreen/iqs5xx.c
@@ -974,10 +974,11 @@ static umode_t iqs5xx_attr_is_visible(struct kobject *kobj,
 	return attr->mode;
 }
 
-static const struct attribute_group iqs5xx_attr_group = {
+static const struct attribute_group iqs5xx_group = {
 	.is_visible = iqs5xx_attr_is_visible,
 	.attrs = iqs5xx_attrs,
 };
+__ATTRIBUTE_GROUPS(iqs5xx);
 
 static int iqs5xx_suspend(struct device *dev)
 {
@@ -1053,12 +1054,6 @@ static int iqs5xx_probe(struct i2c_client *client)
 		return error;
 	}
 
-	error = devm_device_add_group(&client->dev, &iqs5xx_attr_group);
-	if (error) {
-		dev_err(&client->dev, "Failed to add attributes: %d\n", error);
-		return error;
-	}
-
 	if (iqs5xx->input) {
 		error = input_register_device(iqs5xx->input);
 		if (error)
@@ -1089,6 +1084,7 @@ MODULE_DEVICE_TABLE(of, iqs5xx_of_match);
 static struct i2c_driver iqs5xx_i2c_driver = {
 	.driver = {
 		.name		= "iqs5xx",
+		.dev_groups	= iqs5xx_groups,
 		.of_match_table	= iqs5xx_of_match,
 		.pm		= pm_sleep_ptr(&iqs5xx_pm),
 	},
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 16/22] Input: melfas-mip4 - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (13 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 15/22] Input: iqs5xx " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 17/22] Input: raydium_i2c_ts " Dmitry Torokhov
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman, JungHoon Hyun

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/melfas_mip4.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c
index 2ac4483fbc25..aa325486f618 100644
--- a/drivers/input/touchscreen/melfas_mip4.c
+++ b/drivers/input/touchscreen/melfas_mip4.c
@@ -1419,10 +1419,7 @@ static struct attribute *mip4_attrs[] = {
 	&dev_attr_update_fw.attr,
 	NULL,
 };
-
-static const struct attribute_group mip4_attr_group = {
-	.attrs = mip4_attrs,
-};
+ATTRIBUTE_GROUPS(mip4);
 
 static int mip4_probe(struct i2c_client *client)
 {
@@ -1514,13 +1511,6 @@ static int mip4_probe(struct i2c_client *client)
 		return error;
 	}
 
-	error = devm_device_add_group(&client->dev, &mip4_attr_group);
-	if (error) {
-		dev_err(&client->dev,
-			"Failed to create sysfs attribute group: %d\n", error);
-		return error;
-	}
-
 	return 0;
 }
 
@@ -1589,6 +1579,7 @@ static struct i2c_driver mip4_driver = {
 	.probe = mip4_probe,
 	.driver = {
 		.name = MIP4_DEVICE_NAME,
+		.dev_groups = mip4_groups,
 		.of_match_table = of_match_ptr(mip4_of_match),
 		.acpi_match_table = ACPI_PTR(mip4_acpi_match),
 		.pm = pm_sleep_ptr(&mip4_pm_ops),
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 17/22] Input: raydium_i2c_ts - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (14 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 16/22] Input: melfas-mip4 " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 18/22] Input: rohm_bu21023 " Dmitry Torokhov
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman, Raul E Rangel

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/raydium_i2c_ts.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c
index 78dd3059d585..13c500e776f6 100644
--- a/drivers/input/touchscreen/raydium_i2c_ts.c
+++ b/drivers/input/touchscreen/raydium_i2c_ts.c
@@ -1004,7 +1004,7 @@ static DEVICE_ATTR(boot_mode, S_IRUGO, raydium_i2c_boot_mode_show, NULL);
 static DEVICE_ATTR(update_fw, S_IWUSR, NULL, raydium_i2c_update_fw_store);
 static DEVICE_ATTR(calibrate, S_IWUSR, NULL, raydium_i2c_calibrate_store);
 
-static struct attribute *raydium_i2c_attributes[] = {
+static struct attribute *raydium_i2c_attrs[] = {
 	&dev_attr_update_fw.attr,
 	&dev_attr_boot_mode.attr,
 	&dev_attr_fw_version.attr,
@@ -1012,10 +1012,7 @@ static struct attribute *raydium_i2c_attributes[] = {
 	&dev_attr_calibrate.attr,
 	NULL
 };
-
-static const struct attribute_group raydium_i2c_attribute_group = {
-	.attrs = raydium_i2c_attributes,
-};
+ATTRIBUTE_GROUPS(raydium_i2c);
 
 static int raydium_i2c_power_on(struct raydium_data *ts)
 {
@@ -1174,14 +1171,6 @@ static int raydium_i2c_probe(struct i2c_client *client)
 		return error;
 	}
 
-	error = devm_device_add_group(&client->dev,
-				   &raydium_i2c_attribute_group);
-	if (error) {
-		dev_err(&client->dev, "failed to create sysfs attributes: %d\n",
-			error);
-		return error;
-	}
-
 	return 0;
 }
 
@@ -1265,6 +1254,7 @@ static struct i2c_driver raydium_i2c_driver = {
 	.id_table = raydium_i2c_id,
 	.driver = {
 		.name = "raydium_ts",
+		.dev_groups = raydium_i2c_groups,
 		.pm = pm_sleep_ptr(&raydium_i2c_pm_ops),
 		.acpi_match_table = ACPI_PTR(raydium_acpi_id),
 		.of_match_table = of_match_ptr(raydium_of_match),
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 18/22] Input: rohm_bu21023 - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (15 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 17/22] Input: raydium_i2c_ts " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 19/22] Input: s6sy761 " Dmitry Torokhov
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/rohm_bu21023.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/input/touchscreen/rohm_bu21023.c b/drivers/input/touchscreen/rohm_bu21023.c
index 240424f06b98..4493ad0c9322 100644
--- a/drivers/input/touchscreen/rohm_bu21023.c
+++ b/drivers/input/touchscreen/rohm_bu21023.c
@@ -854,10 +854,7 @@ static struct attribute *rohm_ts_attrs[] = {
 	&dev_attr_inv_y.attr,
 	NULL,
 };
-
-static const struct attribute_group rohm_ts_attr_group = {
-	.attrs = rohm_ts_attrs,
-};
+ATTRIBUTE_GROUPS(rohm_ts);
 
 static int rohm_ts_device_init(struct i2c_client *client, u8 setup2)
 {
@@ -1164,12 +1161,6 @@ static int rohm_bu21023_i2c_probe(struct i2c_client *client)
 		return error;
 	}
 
-	error = devm_device_add_group(dev, &rohm_ts_attr_group);
-	if (error) {
-		dev_err(dev, "failed to create sysfs group: %d\n", error);
-		return error;
-	}
-
 	return error;
 }
 
@@ -1182,6 +1173,7 @@ MODULE_DEVICE_TABLE(i2c, rohm_bu21023_i2c_id);
 static struct i2c_driver rohm_bu21023_i2c_driver = {
 	.driver = {
 		.name = BU21023_NAME,
+		.dev_groups = rohm_ts_groups,
 	},
 	.probe = rohm_bu21023_i2c_probe,
 	.id_table = rohm_bu21023_i2c_id,
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 19/22] Input: s6sy761 - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (16 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 18/22] Input: rohm_bu21023 " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-30 13:02   ` Andi Shyti
  2023-07-29  0:51 ` [PATCH 20/22] Input: stmfts " Dmitry Torokhov
                   ` (4 subsequent siblings)
  22 siblings, 1 reply; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman, Andi Shyti

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/s6sy761.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/input/touchscreen/s6sy761.c b/drivers/input/touchscreen/s6sy761.c
index 998d99d18911..149cc2c4925e 100644
--- a/drivers/input/touchscreen/s6sy761.c
+++ b/drivers/input/touchscreen/s6sy761.c
@@ -286,10 +286,7 @@ static struct attribute *s6sy761_sysfs_attrs[] = {
 	&dev_attr_devid.attr,
 	NULL
 };
-
-static struct attribute_group s6sy761_attribute_group = {
-	.attrs = s6sy761_sysfs_attrs
-};
+ATTRIBUTE_GROUPS(s6sy761_sysfs);
 
 static int s6sy761_power_on(struct s6sy761_data *sdata)
 {
@@ -465,10 +462,6 @@ static int s6sy761_probe(struct i2c_client *client)
 	if (err)
 		return err;
 
-	err = devm_device_add_group(&client->dev, &s6sy761_attribute_group);
-	if (err)
-		return err;
-
 	pm_runtime_enable(&client->dev);
 
 	return 0;
@@ -535,6 +528,7 @@ MODULE_DEVICE_TABLE(i2c, s6sy761_id);
 static struct i2c_driver s6sy761_driver = {
 	.driver = {
 		.name = S6SY761_DEV_NAME,
+		.dev_groups = s6sy761_sysfs_groups,
 		.of_match_table = of_match_ptr(s6sy761_of_match),
 		.pm = pm_ptr(&s6sy761_pm_ops),
 	},
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 20/22] Input: stmfts - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (17 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 19/22] Input: s6sy761 " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-30 13:02   ` Andi Shyti
  2023-07-29  0:51 ` [PATCH 21/22] Input: tsc2004/5 " Dmitry Torokhov
                   ` (3 subsequent siblings)
  22 siblings, 1 reply; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input
  Cc: linux-kernel, Greg Kroah-Hartman, Maxime Coquelin, Alexandre Torgue

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/stmfts.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c
index 56e371fd88fa..85010fa07908 100644
--- a/drivers/input/touchscreen/stmfts.c
+++ b/drivers/input/touchscreen/stmfts.c
@@ -517,10 +517,7 @@ static struct attribute *stmfts_sysfs_attrs[] = {
 	&dev_attr_hover_enable.attr,
 	NULL
 };
-
-static struct attribute_group stmfts_attribute_group = {
-	.attrs = stmfts_sysfs_attrs
-};
+ATTRIBUTE_GROUPS(stmfts_sysfs);
 
 static int stmfts_power_on(struct stmfts_data *sdata)
 {
@@ -727,10 +724,6 @@ static int stmfts_probe(struct i2c_client *client)
 		}
 	}
 
-	err = devm_device_add_group(&client->dev, &stmfts_attribute_group);
-	if (err)
-		return err;
-
 	pm_runtime_enable(&client->dev);
 	device_enable_async_suspend(&client->dev);
 
@@ -804,6 +797,7 @@ MODULE_DEVICE_TABLE(i2c, stmfts_id);
 static struct i2c_driver stmfts_driver = {
 	.driver = {
 		.name = STMFTS_DEV_NAME,
+		.dev_groups = stmfts_sysfs_groups,
 		.of_match_table = of_match_ptr(stmfts_of_match),
 		.pm = pm_ptr(&stmfts_pm_ops),
 		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 21/22] Input: tsc2004/5 - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (18 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 20/22] Input: stmfts " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29  0:51 ` [PATCH 22/22] Input: wdt87xx_i2c " Dmitry Torokhov
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman

Instead of creating driver-specific device attributes with
sysfs_create_group() have device core do this by setting up dev_groups
pointer in the driver structure.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/tsc2004.c      |  7 ++++---
 drivers/input/touchscreen/tsc2005.c      |  7 ++++---
 drivers/input/touchscreen/tsc200x-core.c | 18 +++++++-----------
 drivers/input/touchscreen/tsc200x-core.h |  1 +
 4 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2004.c b/drivers/input/touchscreen/tsc2004.c
index b5e904c5b7c4..89c5248f66f6 100644
--- a/drivers/input/touchscreen/tsc2004.c
+++ b/drivers/input/touchscreen/tsc2004.c
@@ -63,9 +63,10 @@ MODULE_DEVICE_TABLE(of, tsc2004_of_match);
 
 static struct i2c_driver tsc2004_driver = {
 	.driver = {
-		.name   = "tsc2004",
-		.of_match_table = of_match_ptr(tsc2004_of_match),
-		.pm     = pm_sleep_ptr(&tsc200x_pm_ops),
+		.name		= "tsc2004",
+		.dev_groups	= tsc200x_groups,
+		.of_match_table	= of_match_ptr(tsc2004_of_match),
+		.pm		= pm_sleep_ptr(&tsc200x_pm_ops),
 	},
 	.id_table       = tsc2004_idtable,
 	.probe          = tsc2004_probe,
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index b6dfbcfc8c19..1b40ce0ca1b9 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -79,9 +79,10 @@ MODULE_DEVICE_TABLE(of, tsc2005_of_match);
 
 static struct spi_driver tsc2005_driver = {
 	.driver	= {
-		.name	= "tsc2005",
-		.of_match_table = of_match_ptr(tsc2005_of_match),
-		.pm	= pm_sleep_ptr(&tsc200x_pm_ops),
+		.name		= "tsc2005",
+		.dev_groups	= tsc200x_groups,
+		.of_match_table	= of_match_ptr(tsc2005_of_match),
+		.pm		= pm_sleep_ptr(&tsc200x_pm_ops),
 	},
 	.probe	= tsc2005_probe,
 	.remove	= tsc2005_remove,
diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c
index b799f26fcf8f..a4c0e9db9bb9 100644
--- a/drivers/input/touchscreen/tsc200x-core.c
+++ b/drivers/input/touchscreen/tsc200x-core.c
@@ -356,6 +356,12 @@ static const struct attribute_group tsc200x_attr_group = {
 	.attrs		= tsc200x_attrs,
 };
 
+const struct attribute_group *tsc200x_groups[] = {
+	&tsc200x_attr_group,
+	NULL
+};
+EXPORT_SYMBOL_GPL(tsc200x_groups);
+
 static void tsc200x_esd_work(struct work_struct *work)
 {
 	struct tsc200x *ts = container_of(work, struct tsc200x, esd_work.work);
@@ -553,25 +559,17 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
 		return error;
 
 	dev_set_drvdata(dev, ts);
-	error = sysfs_create_group(&dev->kobj, &tsc200x_attr_group);
-	if (error) {
-		dev_err(dev,
-			"Failed to create sysfs attributes, err: %d\n", error);
-		goto disable_regulator;
-	}
 
 	error = input_register_device(ts->idev);
 	if (error) {
 		dev_err(dev,
 			"Failed to register input device, err: %d\n", error);
-		goto err_remove_sysfs;
+		goto disable_regulator;
 	}
 
 	irq_set_irq_wake(irq, 1);
 	return 0;
 
-err_remove_sysfs:
-	sysfs_remove_group(&dev->kobj, &tsc200x_attr_group);
 disable_regulator:
 	regulator_disable(ts->vio);
 	return error;
@@ -582,8 +580,6 @@ void tsc200x_remove(struct device *dev)
 {
 	struct tsc200x *ts = dev_get_drvdata(dev);
 
-	sysfs_remove_group(&dev->kobj, &tsc200x_attr_group);
-
 	regulator_disable(ts->vio);
 }
 EXPORT_SYMBOL_GPL(tsc200x_remove);
diff --git a/drivers/input/touchscreen/tsc200x-core.h b/drivers/input/touchscreen/tsc200x-core.h
index 4ded34425b21..37de91efd78e 100644
--- a/drivers/input/touchscreen/tsc200x-core.h
+++ b/drivers/input/touchscreen/tsc200x-core.h
@@ -70,6 +70,7 @@
 
 extern const struct regmap_config tsc200x_regmap_config;
 extern const struct dev_pm_ops tsc200x_pm_ops;
+extern const struct attribute_group *tsc200x_groups[];
 
 int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
 		  struct regmap *regmap,
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 22/22] Input: wdt87xx_i2c - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (19 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 21/22] Input: tsc2004/5 " Dmitry Torokhov
@ 2023-07-29  0:51 ` Dmitry Torokhov
  2023-07-29  2:40 ` [PATCH 01/22] Input: cros_ec_keyb " Guenter Roeck
  2023-07-30 11:39 ` Greg Kroah-Hartman
  22 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-29  0:51 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel, Greg Kroah-Hartman

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.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/wdt87xx_i2c.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/input/touchscreen/wdt87xx_i2c.c b/drivers/input/touchscreen/wdt87xx_i2c.c
index cbc4750c53f9..128341a6696b 100644
--- a/drivers/input/touchscreen/wdt87xx_i2c.c
+++ b/drivers/input/touchscreen/wdt87xx_i2c.c
@@ -944,10 +944,7 @@ static struct attribute *wdt87xx_attrs[] = {
 	&dev_attr_update_fw.attr,
 	NULL
 };
-
-static const struct attribute_group wdt87xx_attr_group = {
-	.attrs = wdt87xx_attrs,
-};
+ATTRIBUTE_GROUPS(wdt87xx);
 
 static void wdt87xx_report_contact(struct input_dev *input,
 				   struct wdt87xx_sys_param *param,
@@ -1104,12 +1101,6 @@ static int wdt87xx_ts_probe(struct i2c_client *client)
 		return error;
 	}
 
-	error = devm_device_add_group(&client->dev, &wdt87xx_attr_group);
-	if (error) {
-		dev_err(&client->dev, "create sysfs failed: %d\n", error);
-		return error;
-	}
-
 	return 0;
 }
 
@@ -1172,8 +1163,9 @@ static struct i2c_driver wdt87xx_driver = {
 	.probe		= wdt87xx_ts_probe,
 	.id_table	= wdt87xx_dev_id,
 	.driver	= {
-		.name	= WDT87XX_NAME,
-		.pm     = pm_sleep_ptr(&wdt87xx_pm_ops),
+		.name = WDT87XX_NAME,
+		.dev_groups = wdt87xx_groups,
+		.pm = pm_sleep_ptr(&wdt87xx_pm_ops),
 		.acpi_match_table = ACPI_PTR(wdt87xx_acpi_id),
 	},
 };
-- 
2.41.0.487.g6d72f3e995-goog


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (20 preceding siblings ...)
  2023-07-29  0:51 ` [PATCH 22/22] Input: wdt87xx_i2c " Dmitry Torokhov
@ 2023-07-29  2:40 ` Guenter Roeck
  2023-07-30 11:39 ` Greg Kroah-Hartman
  22 siblings, 0 replies; 34+ messages in thread
From: Guenter Roeck @ 2023-07-29  2:40 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-kernel, Greg Kroah-Hartman, Benson Leung,
	Guenter Roeck, chrome-platform

On Fri, Jul 28, 2023 at 5:51 PM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>
> 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.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Reviewed-by: Guenter Roeck <groeck@chromium.org>

> ---
>  drivers/input/keyboard/cros_ec_keyb.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
> index e7ecfca838df..313b7a69dd69 100644
> --- a/drivers/input/keyboard/cros_ec_keyb.c
> +++ b/drivers/input/keyboard/cros_ec_keyb.c
> @@ -686,10 +686,11 @@ static umode_t cros_ec_keyb_attr_is_visible(struct kobject *kobj,
>         return attr->mode;
>  }
>
> -static const struct attribute_group cros_ec_keyb_attr_group = {
> +static const struct attribute_group cros_ec_keyb_group = {
>         .is_visible = cros_ec_keyb_attr_is_visible,
>         .attrs = cros_ec_keyb_attrs,
>  };
> +__ATTRIBUTE_GROUPS(cros_ec_keyb);
>
>  static int cros_ec_keyb_probe(struct platform_device *pdev)
>  {
> @@ -730,12 +731,6 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
>                 return err;
>         }
>
> -       err = devm_device_add_group(dev, &cros_ec_keyb_attr_group);
> -       if (err) {
> -               dev_err(dev, "failed to create attributes: %d\n", err);
> -               return err;
> -       }
> -
>         ckdev->notifier.notifier_call = cros_ec_keyb_work;
>         err = blocking_notifier_chain_register(&ckdev->ec->event_notifier,
>                                                &ckdev->notifier);
> @@ -782,6 +777,7 @@ static struct platform_driver cros_ec_keyb_driver = {
>         .remove = cros_ec_keyb_remove,
>         .driver = {
>                 .name = "cros-ec-keyb",
> +               .dev_groups = cros_ec_keyb_groups,
>                 .of_match_table = of_match_ptr(cros_ec_keyb_of_match),
>                 .acpi_match_table = ACPI_PTR(cros_ec_keyb_acpi_match),
>                 .pm = pm_sleep_ptr(&cros_ec_keyb_pm_ops),
> --
> 2.41.0.487.g6d72f3e995-goog
>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 13/22] Input: ili210x - use device core to create driver-specific device attributes
  2023-07-29  0:51 ` [PATCH 13/22] Input: ili210x " Dmitry Torokhov
@ 2023-07-29 15:07   ` Marek Vasut
  2023-07-30 11:38     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 34+ messages in thread
From: Marek Vasut @ 2023-07-29 15:07 UTC (permalink / raw)
  To: Dmitry Torokhov, linux-input; +Cc: linux-kernel, Greg Kroah-Hartman

On 7/29/23 02:51, Dmitry Torokhov wrote:
> 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.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>   drivers/input/touchscreen/ili210x.c | 15 +++++----------
>   1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
> index ad6828e4f2e2..31ffdc2a93f3 100644
> --- a/drivers/input/touchscreen/ili210x.c
> +++ b/drivers/input/touchscreen/ili210x.c
> @@ -876,7 +876,7 @@ static ssize_t ili210x_firmware_update_store(struct device *dev,
>   
>   static DEVICE_ATTR(firmware_update, 0200, NULL, ili210x_firmware_update_store);
>   
> -static struct attribute *ili210x_attributes[] = {
> +static struct attribute *ili210x_attrs[] = {
>   	&dev_attr_calibrate.attr,
>   	&dev_attr_firmware_update.attr,
>   	&dev_attr_firmware_version.attr,
> @@ -904,10 +904,11 @@ static umode_t ili210x_attributes_visible(struct kobject *kobj,
>   	return attr->mode;
>   }
>   
> -static const struct attribute_group ili210x_attr_group = {
> -	.attrs = ili210x_attributes,
> +static const struct attribute_group ili210x_group = {
> +	.attrs = ili210x_attrs,

Is all the renaming really necessary and relevant to this patch ?

btw since I have your attention, could you also look at discussion
[PATCH] Input: pwm-beeper - Support volume setting via sysfs
? I've been waiting for any maintainer input for over two months now.

Thanks

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 13/22] Input: ili210x - use device core to create driver-specific device attributes
  2023-07-29 15:07   ` Marek Vasut
@ 2023-07-30 11:38     ` Greg Kroah-Hartman
  2023-07-30 12:24       ` Marek Vasut
  0 siblings, 1 reply; 34+ messages in thread
From: Greg Kroah-Hartman @ 2023-07-30 11:38 UTC (permalink / raw)
  To: Marek Vasut; +Cc: Dmitry Torokhov, linux-input, linux-kernel

On Sat, Jul 29, 2023 at 05:07:17PM +0200, Marek Vasut wrote:
> On 7/29/23 02:51, Dmitry Torokhov wrote:
> > 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.
> > 
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > ---
> >   drivers/input/touchscreen/ili210x.c | 15 +++++----------
> >   1 file changed, 5 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
> > index ad6828e4f2e2..31ffdc2a93f3 100644
> > --- a/drivers/input/touchscreen/ili210x.c
> > +++ b/drivers/input/touchscreen/ili210x.c
> > @@ -876,7 +876,7 @@ static ssize_t ili210x_firmware_update_store(struct device *dev,
> >   static DEVICE_ATTR(firmware_update, 0200, NULL, ili210x_firmware_update_store);
> > -static struct attribute *ili210x_attributes[] = {
> > +static struct attribute *ili210x_attrs[] = {
> >   	&dev_attr_calibrate.attr,
> >   	&dev_attr_firmware_update.attr,
> >   	&dev_attr_firmware_version.attr,
> > @@ -904,10 +904,11 @@ static umode_t ili210x_attributes_visible(struct kobject *kobj,
> >   	return attr->mode;
> >   }
> > -static const struct attribute_group ili210x_attr_group = {
> > -	.attrs = ili210x_attributes,
> > +static const struct attribute_group ili210x_group = {
> > +	.attrs = ili210x_attrs,
> 
> Is all the renaming really necessary and relevant to this patch ?

Yes, it's needed for the __ATTRIBUTE_GROUPS() macro.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes
  2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
                   ` (21 preceding siblings ...)
  2023-07-29  2:40 ` [PATCH 01/22] Input: cros_ec_keyb " Guenter Roeck
@ 2023-07-30 11:39 ` Greg Kroah-Hartman
  22 siblings, 0 replies; 34+ messages in thread
From: Greg Kroah-Hartman @ 2023-07-30 11:39 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-kernel, Benson Leung, Guenter Roeck, chrome-platform

On Fri, Jul 28, 2023 at 05:51:10PM -0700, Dmitry Torokhov wrote:
> 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.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/input/keyboard/cros_ec_keyb.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)

All of these look great, thanks for doing them:

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 13/22] Input: ili210x - use device core to create driver-specific device attributes
  2023-07-30 11:38     ` Greg Kroah-Hartman
@ 2023-07-30 12:24       ` Marek Vasut
  0 siblings, 0 replies; 34+ messages in thread
From: Marek Vasut @ 2023-07-30 12:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Dmitry Torokhov, linux-input, linux-kernel

On 7/30/23 13:38, Greg Kroah-Hartman wrote:
> On Sat, Jul 29, 2023 at 05:07:17PM +0200, Marek Vasut wrote:
>> On 7/29/23 02:51, Dmitry Torokhov wrote:
>>> 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.
>>>
>>> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>>> ---
>>>    drivers/input/touchscreen/ili210x.c | 15 +++++----------
>>>    1 file changed, 5 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
>>> index ad6828e4f2e2..31ffdc2a93f3 100644
>>> --- a/drivers/input/touchscreen/ili210x.c
>>> +++ b/drivers/input/touchscreen/ili210x.c
>>> @@ -876,7 +876,7 @@ static ssize_t ili210x_firmware_update_store(struct device *dev,
>>>    static DEVICE_ATTR(firmware_update, 0200, NULL, ili210x_firmware_update_store);
>>> -static struct attribute *ili210x_attributes[] = {
>>> +static struct attribute *ili210x_attrs[] = {
>>>    	&dev_attr_calibrate.attr,
>>>    	&dev_attr_firmware_update.attr,
>>>    	&dev_attr_firmware_version.attr,
>>> @@ -904,10 +904,11 @@ static umode_t ili210x_attributes_visible(struct kobject *kobj,
>>>    	return attr->mode;
>>>    }
>>> -static const struct attribute_group ili210x_attr_group = {
>>> -	.attrs = ili210x_attributes,
>>> +static const struct attribute_group ili210x_group = {
>>> +	.attrs = ili210x_attrs,
>>
>> Is all the renaming really necessary and relevant to this patch ?
> 
> Yes, it's needed for the __ATTRIBUTE_GROUPS() macro.

Ah ok

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 20/22] Input: stmfts - use device core to create driver-specific device attributes
  2023-07-29  0:51 ` [PATCH 20/22] Input: stmfts " Dmitry Torokhov
@ 2023-07-30 13:02   ` Andi Shyti
  0 siblings, 0 replies; 34+ messages in thread
From: Andi Shyti @ 2023-07-30 13:02 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-kernel, Greg Kroah-Hartman, Maxime Coquelin,
	Alexandre Torgue

Hi Dmitry,

On Fri, Jul 28, 2023 at 05:51:29PM -0700, Dmitry Torokhov wrote:
> 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.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Reviewed-by: Andi Shyti <andi.shyti@kernel.org> 

Andi

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 19/22] Input: s6sy761 - use device core to create driver-specific device attributes
  2023-07-29  0:51 ` [PATCH 19/22] Input: s6sy761 " Dmitry Torokhov
@ 2023-07-30 13:02   ` Andi Shyti
  0 siblings, 0 replies; 34+ messages in thread
From: Andi Shyti @ 2023-07-30 13:02 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, Greg Kroah-Hartman

Hi Dmitry,

On Fri, Jul 28, 2023 at 05:51:28PM -0700, Dmitry Torokhov wrote:
> 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.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Reviewed-by: Andi Shyti <andi.shyti@kernel.org> 

Andi

> ---
>  drivers/input/touchscreen/s6sy761.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/s6sy761.c b/drivers/input/touchscreen/s6sy761.c
> index 998d99d18911..149cc2c4925e 100644
> --- a/drivers/input/touchscreen/s6sy761.c
> +++ b/drivers/input/touchscreen/s6sy761.c
> @@ -286,10 +286,7 @@ static struct attribute *s6sy761_sysfs_attrs[] = {
>  	&dev_attr_devid.attr,
>  	NULL
>  };
> -
> -static struct attribute_group s6sy761_attribute_group = {
> -	.attrs = s6sy761_sysfs_attrs
> -};
> +ATTRIBUTE_GROUPS(s6sy761_sysfs);
>  
>  static int s6sy761_power_on(struct s6sy761_data *sdata)
>  {
> @@ -465,10 +462,6 @@ static int s6sy761_probe(struct i2c_client *client)
>  	if (err)
>  		return err;
>  
> -	err = devm_device_add_group(&client->dev, &s6sy761_attribute_group);
> -	if (err)
> -		return err;
> -
>  	pm_runtime_enable(&client->dev);
>  
>  	return 0;
> @@ -535,6 +528,7 @@ MODULE_DEVICE_TABLE(i2c, s6sy761_id);
>  static struct i2c_driver s6sy761_driver = {
>  	.driver = {
>  		.name = S6SY761_DEV_NAME,
> +		.dev_groups = s6sy761_sysfs_groups,
>  		.of_match_table = of_match_ptr(s6sy761_of_match),
>  		.pm = pm_ptr(&s6sy761_pm_ops),
>  	},
> -- 
> 2.41.0.487.g6d72f3e995-goog
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* RE: [PATCH 05/22] Input: ad7877 - use device core to create driver-specific device attributes
  2023-07-29  0:51 ` [PATCH 05/22] Input: ad7877 " Dmitry Torokhov
@ 2023-07-31  5:23   ` Hennerich, Michael
  0 siblings, 0 replies; 34+ messages in thread
From: Hennerich, Michael @ 2023-07-31  5:23 UTC (permalink / raw)
  To: Dmitry Torokhov, linux-input; +Cc: linux-kernel, Greg Kroah-Hartman



> -----Original Message-----
> From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Sent: Samstag, 29. Juli 2023 02:51
> To: linux-input@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; Greg Kroah-Hartman
> <gregkh@linuxfoundation.org>; Hennerich, Michael
> <Michael.Hennerich@analog.com>
> Subject: [PATCH 05/22] Input: ad7877 - 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.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Acked-by: Michael Hennerich <michael.hennerich@analog.com>

> ---
>  drivers/input/touchscreen/ad7877.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/ad7877.c
> b/drivers/input/touchscreen/ad7877.c
> index edb36d663f22..a0598e9c7aff 100644
> --- a/drivers/input/touchscreen/ad7877.c
> +++ b/drivers/input/touchscreen/ad7877.c
> @@ -612,10 +612,11 @@ static umode_t ad7877_attr_is_visible(struct
> kobject *kobj,
>  	return mode;
>  }
> 
> -static const struct attribute_group ad7877_attr_group = {
> +static const struct attribute_group ad7877_group = {
>  	.is_visible	= ad7877_attr_is_visible,
>  	.attrs		= ad7877_attributes,
>  };
> +__ATTRIBUTE_GROUPS(ad7877);
> 
>  static void ad7877_setup_ts_def_msg(struct spi_device *spi, struct ad7877
> *ts)  { @@ -777,10 +778,6 @@ static int ad7877_probe(struct spi_device
> *spi)
>  		return err;
>  	}
> 
> -	err = devm_device_add_group(&spi->dev, &ad7877_attr_group);
> -	if (err)
> -		return err;
> -
>  	err = input_register_device(input_dev);
>  	if (err)
>  		return err;
> @@ -810,8 +807,9 @@ static DEFINE_SIMPLE_DEV_PM_OPS(ad7877_pm,
> ad7877_suspend, ad7877_resume);
> 
>  static struct spi_driver ad7877_driver = {
>  	.driver = {
> -		.name	= "ad7877",
> -		.pm	= pm_sleep_ptr(&ad7877_pm),
> +		.name		= "ad7877",
> +		.dev_groups	= ad7877_groups,
> +		.pm		= pm_sleep_ptr(&ad7877_pm),
>  	},
>  	.probe		= ad7877_probe,
>  };
> --
> 2.41.0.487.g6d72f3e995-goog


^ permalink raw reply	[flat|nested] 34+ messages in thread

* RE: [PATCH 06/22] Input: ad7879 - use device core to create driver-specific device attributes
  2023-07-29  0:51 ` [PATCH 06/22] Input: ad7879 " Dmitry Torokhov
@ 2023-07-31  5:23   ` Hennerich, Michael
  0 siblings, 0 replies; 34+ messages in thread
From: Hennerich, Michael @ 2023-07-31  5:23 UTC (permalink / raw)
  To: Dmitry Torokhov, linux-input; +Cc: linux-kernel, Greg Kroah-Hartman



> -----Original Message-----
> From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Sent: Samstag, 29. Juli 2023 02:51
> To: linux-input@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; Greg Kroah-Hartman
> <gregkh@linuxfoundation.org>; Hennerich, Michael
> <Michael.Hennerich@analog.com>
> Subject: [PATCH 06/22] 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.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Acked-by: Michael Hennerich <michael.hennerich@analog.com>

> ---
>  drivers/input/touchscreen/ad7879-i2c.c |  7 ++++---
> drivers/input/touchscreen/ad7879-spi.c |  7 ++++---
>  drivers/input/touchscreen/ad7879.c     | 10 ++++++----
>  drivers/input/touchscreen/ad7879.h     |  3 +++
>  4 files changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/ad7879-i2c.c
> b/drivers/input/touchscreen/ad7879-i2c.c
> index feaa6f8b01ed..5c094ab74698 100644
> --- a/drivers/input/touchscreen/ad7879-i2c.c
> +++ b/drivers/input/touchscreen/ad7879-i2c.c
> @@ -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,
> diff --git a/drivers/input/touchscreen/ad7879-spi.c
> b/drivers/input/touchscreen/ad7879-spi.c
> index 50e889846800..064968fe57cf 100644
> --- a/drivers/input/touchscreen/ad7879-spi.c
> +++ b/drivers/input/touchscreen/ad7879-spi.c
> @@ -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,
>  };
> diff --git a/drivers/input/touchscreen/ad7879.c
> b/drivers/input/touchscreen/ad7879.c
> index e850853328f1..e5d69bf2276e 100644
> --- a/drivers/input/touchscreen/ad7879.c
> +++ b/drivers/input/touchscreen/ad7879.c
> @@ -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;
> diff --git a/drivers/input/touchscreen/ad7879.h
> b/drivers/input/touchscreen/ad7879.h
> index ae8aa1428e56..d71a8e787290 100644
> --- a/drivers/input/touchscreen/ad7879.h
> +++ b/drivers/input/touchscreen/ad7879.h
> @@ -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,
> --
> 2.41.0.487.g6d72f3e995-goog


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 03/22] Input: iqs269a - use device core to create driver-specific device attributes
  2023-07-29  0:51 ` [PATCH 03/22] Input: iqs269a " Dmitry Torokhov
@ 2023-07-31 15:41   ` Jeff LaBundy
  2023-08-02 13:01   ` Mattijs Korpershoek
  1 sibling, 0 replies; 34+ messages in thread
From: Jeff LaBundy @ 2023-07-31 15:41 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, linux-kernel, Greg Kroah-Hartman, Mattijs Korpershoek

On Fri, Jul 28, 2023 at 05:51:12PM -0700, Dmitry Torokhov wrote:
> 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.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Reviewed-by: Jeff LaBundy <jeff@labundy.com>

> ---
>  drivers/input/misc/iqs269a.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/input/misc/iqs269a.c b/drivers/input/misc/iqs269a.c
> index c0a085639870..3c636c75e8a1 100644
> --- a/drivers/input/misc/iqs269a.c
> +++ b/drivers/input/misc/iqs269a.c
> @@ -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),
>  	},
> -- 
> 2.41.0.487.g6d72f3e995-goog
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 15/22] Input: iqs5xx - use device core to create driver-specific device attributes
  2023-07-29  0:51 ` [PATCH 15/22] Input: iqs5xx " Dmitry Torokhov
@ 2023-07-31 15:43   ` Jeff LaBundy
  0 siblings, 0 replies; 34+ messages in thread
From: Jeff LaBundy @ 2023-07-31 15:43 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, Greg Kroah-Hartman

On Fri, Jul 28, 2023 at 05:51:24PM -0700, Dmitry Torokhov wrote:
> 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.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Reviewed-by: Jeff LaBundy <jeff@labundy.com>

> ---
>  drivers/input/touchscreen/iqs5xx.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/iqs5xx.c b/drivers/input/touchscreen/iqs5xx.c
> index b4768b66eb10..a3f4fb85bee5 100644
> --- a/drivers/input/touchscreen/iqs5xx.c
> +++ b/drivers/input/touchscreen/iqs5xx.c
> @@ -974,10 +974,11 @@ static umode_t iqs5xx_attr_is_visible(struct kobject *kobj,
>  	return attr->mode;
>  }
>  
> -static const struct attribute_group iqs5xx_attr_group = {
> +static const struct attribute_group iqs5xx_group = {
>  	.is_visible = iqs5xx_attr_is_visible,
>  	.attrs = iqs5xx_attrs,
>  };
> +__ATTRIBUTE_GROUPS(iqs5xx);
>  
>  static int iqs5xx_suspend(struct device *dev)
>  {
> @@ -1053,12 +1054,6 @@ static int iqs5xx_probe(struct i2c_client *client)
>  		return error;
>  	}
>  
> -	error = devm_device_add_group(&client->dev, &iqs5xx_attr_group);
> -	if (error) {
> -		dev_err(&client->dev, "Failed to add attributes: %d\n", error);
> -		return error;
> -	}
> -
>  	if (iqs5xx->input) {
>  		error = input_register_device(iqs5xx->input);
>  		if (error)
> @@ -1089,6 +1084,7 @@ MODULE_DEVICE_TABLE(of, iqs5xx_of_match);
>  static struct i2c_driver iqs5xx_i2c_driver = {
>  	.driver = {
>  		.name		= "iqs5xx",
> +		.dev_groups	= iqs5xx_groups,
>  		.of_match_table	= iqs5xx_of_match,
>  		.pm		= pm_sleep_ptr(&iqs5xx_pm),
>  	},
> -- 
> 2.41.0.487.g6d72f3e995-goog
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 03/22] Input: iqs269a - use device core to create driver-specific device attributes
  2023-07-29  0:51 ` [PATCH 03/22] Input: iqs269a " Dmitry Torokhov
  2023-07-31 15:41   ` Jeff LaBundy
@ 2023-08-02 13:01   ` Mattijs Korpershoek
  1 sibling, 0 replies; 34+ messages in thread
From: Mattijs Korpershoek @ 2023-08-02 13:01 UTC (permalink / raw)
  To: Dmitry Torokhov, linux-input
  Cc: linux-kernel, Greg Kroah-Hartman, Jeff LaBundy

On ven., juil. 28, 2023 at 17:51, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:

> 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.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
>  drivers/input/misc/iqs269a.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/input/misc/iqs269a.c b/drivers/input/misc/iqs269a.c
> index c0a085639870..3c636c75e8a1 100644
> --- a/drivers/input/misc/iqs269a.c
> +++ b/drivers/input/misc/iqs269a.c
> @@ -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),
>  	},
> -- 
> 2.41.0.487.g6d72f3e995-goog

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2023-08-02 13:01 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-29  0:51 [PATCH 01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes Dmitry Torokhov
2023-07-29  0:51 ` [PATCH 02/22] Input: cyapa " Dmitry Torokhov
2023-07-29  0:51 ` [PATCH 03/22] Input: iqs269a " Dmitry Torokhov
2023-07-31 15:41   ` Jeff LaBundy
2023-08-02 13:01   ` Mattijs Korpershoek
2023-07-29  0:51 ` [PATCH 04/22] Input: kxtj9 " Dmitry Torokhov
2023-07-29  0:51 ` [PATCH 05/22] Input: ad7877 " Dmitry Torokhov
2023-07-31  5:23   ` Hennerich, Michael
2023-07-29  0:51 ` [PATCH 06/22] Input: ad7879 " Dmitry Torokhov
2023-07-31  5:23   ` Hennerich, Michael
2023-07-29  0:51 ` [PATCH 07/22] Input: ads7846 " Dmitry Torokhov
2023-07-29  0:51 ` [PATCH 08/22] Input: edt-ft5x06 " Dmitry Torokhov
2023-07-29  0:51 ` [PATCH 09/22] Input: elants_i2c " Dmitry Torokhov
2023-07-29  0:51 ` [PATCH 10/22] Input: exc3000 " Dmitry Torokhov
2023-07-29  0:51 ` [PATCH 11/22] Input: hideep " Dmitry Torokhov
2023-07-29  0:51 ` [PATCH 12/22] Input: hycon-hy46xx " Dmitry Torokhov
2023-07-29  0:51 ` [PATCH 13/22] Input: ili210x " Dmitry Torokhov
2023-07-29 15:07   ` Marek Vasut
2023-07-30 11:38     ` Greg Kroah-Hartman
2023-07-30 12:24       ` Marek Vasut
2023-07-29  0:51 ` [PATCH 14/22] Input: ilitek_ts_i2c " Dmitry Torokhov
2023-07-29  0:51 ` [PATCH 15/22] Input: iqs5xx " Dmitry Torokhov
2023-07-31 15:43   ` Jeff LaBundy
2023-07-29  0:51 ` [PATCH 16/22] Input: melfas-mip4 " Dmitry Torokhov
2023-07-29  0:51 ` [PATCH 17/22] Input: raydium_i2c_ts " Dmitry Torokhov
2023-07-29  0:51 ` [PATCH 18/22] Input: rohm_bu21023 " Dmitry Torokhov
2023-07-29  0:51 ` [PATCH 19/22] Input: s6sy761 " Dmitry Torokhov
2023-07-30 13:02   ` Andi Shyti
2023-07-29  0:51 ` [PATCH 20/22] Input: stmfts " Dmitry Torokhov
2023-07-30 13:02   ` Andi Shyti
2023-07-29  0:51 ` [PATCH 21/22] Input: tsc2004/5 " Dmitry Torokhov
2023-07-29  0:51 ` [PATCH 22/22] Input: wdt87xx_i2c " Dmitry Torokhov
2023-07-29  2:40 ` [PATCH 01/22] Input: cros_ec_keyb " Guenter Roeck
2023-07-30 11:39 ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.