Skip to contentSkip to conversation

use managed devm_device_add_group for all touchscreen drivers

PATCH Applied Andi Shyti 3 participants 26 messages Sep 29, 2017 – Oct 27, 2017

Subsystems (5)
lore
Share & tools
lore

Andi Shyti

author
#0 lore raw

cover use managed devm_device_add_group for all touchscreen drivers

Hi,

this patch series uses Dmitry's patch

57b8ff070f98 driver core: add devm_device_add_group() and friends

each of the 12 patches replaces the sysfs_create_group() function with its managed version devm_device_add_group.

Andi

Andi Shyti (12):
Input: ad7897 - use managed devm_device_add_group
Input: ad7879 - use managed devm_device_add_group
Input: ads7846 - use managed devm_device_add_group
Input: atmel_mxt_ts - use managed devm_device_add_group
Input: edt-ft5x06 - use managed devm_device_add_group
Input: elants_i2c - use managed devm_device_add_group
Input: ili210x - use managed devm_device_add_group
Input: melfas_mip4 - use managed devm_device_add_group
Input: raydium_i2c_ts - use managed devm_device_add_group
Input: rohm_bu21023 - use managed devm_device_add_group
Input: tsc200x-core - use managed devm_device_add_group
Input: wdt87xx_i2c - use managed devm_device_add_group

 drivers/input/touchscreen/ad7877.c         |  8 ++------
 drivers/input/touchscreen/ad7879.c         | 13 +------------
 drivers/input/touchscreen/ads7846.c        |  8 ++------
 drivers/input/touchscreen/atmel_mxt_ts.c   |  3 +--
 drivers/input/touchscreen/edt-ft5x06.c     |  9 ++-------
 drivers/input/touchscreen/elants_i2c.c     | 19 +------------------
 drivers/input/touchscreen/ili210x.c        |  7 ++-----
 drivers/input/touchscreen/melfas_mip4.c    | 17 +----------------
 drivers/input/touchscreen/raydium_i2c_ts.c | 18 +-----------------
 drivers/input/touchscreen/rohm_bu21023.c   | 17 +----------------
 drivers/input/touchscreen/tsc200x-core.c   |  8 ++------
 drivers/input/touchscreen/wdt87xx_i2c.c    |  4 +---
 12 files changed, 17 insertions(+), 114 deletions(-)
Signature · 1 line
2.14.2
author
#1 lore raw

PATCH 1/12 Input: ad7897 - use managed devm_device_add_group

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the relative sysfs_remove_group and goto label.

CC Michael Hennerich <[email protected]>
---
 drivers/input/touchscreen/ad7877.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/input/touchscreen/ad7877.c +2 -6
index 9c250ae780d9..677ba38b4d1c 100644
@@ -783,18 +783,16 @@ static int ad7877_probe(struct spi_device *spi)
 		goto err_free_mem;
 	}
 
-	err = sysfs_create_group(&spi->dev.kobj, &ad7877_attr_group);
+	err = devm_device_add_group(&spi->dev, &ad7877_attr_group);
 	if (err)
 		goto err_free_irq;
 
 	err = input_register_device(input_dev);
 	if (err)
-		goto err_remove_attr_group;
+		goto err_free_irq;
 
 	return 0;
 
-err_remove_attr_group:
-	sysfs_remove_group(&spi->dev.kobj, &ad7877_attr_group);
 err_free_irq:
 	free_irq(spi->irq, ts);
 err_free_mem:
@@ -807,8 +805,6 @@ static int ad7877_remove(struct spi_device *spi)
 {
 	struct ad7877 *ts = spi_get_drvdata(spi);
 
-	sysfs_remove_group(&spi->dev.kobj, &ad7877_attr_group);
-
 	ad7877_disable(ts);
 	free_irq(ts->spi->irq, ts);
 
Signature · 1 line
2.14.2
maintainer
#2 lore raw

Re: [PATCH 01/12] Input: ad7897 - use managed devm_device_add_group

Hi Andi,

Quoted 18 lines · Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the relative sysfs_remove_group and goto label.

CC Michael Hennerich <[email protected]>
---
 drivers/input/touchscreen/ad7877.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/input/touchscreen/ad7877.c +0 -0
index 9c250ae780d9..677ba38b4d1c 100644

drivers/input/touchscreen/ad7877.c static int ad7877_probe(struct spi_device *spi) · line 786

Quoted 5 lines
drivers/input/touchscreen/ad7877.c +1 -1
@@ -783,18 +783,16 @@ static int ad7877_probe(struct spi_device *spi)
 		goto err_free_mem;
 	}
 
-	err = sysfs_create_group(&spi->dev.kobj, &ad7877_attr_group);
+	err = devm_device_add_group(&spi->dev, &ad7877_attr_group);

This changes order of operations and ultimately may cause use-after-free as memory for ad7877 structure will be freed before we remove attributes.

Quoted 27 lines
drivers/input/touchscreen/ad7877.c +1 -5
 	if (err)
 		goto err_free_irq;
 
 	err = input_register_device(input_dev);
 	if (err)
-		goto err_remove_attr_group;
+		goto err_free_irq;
 
 	return 0;
 
-err_remove_attr_group:
-	sysfs_remove_group(&spi->dev.kobj, &ad7877_attr_group);
 err_free_irq:
 	free_irq(spi->irq, ts);
 err_free_mem:
@@ -807,8 +805,6 @@ static int ad7877_remove(struct spi_device *spi)
 {
 	struct ad7877 *ts = spi_get_drvdata(spi);
 
-	sysfs_remove_group(&spi->dev.kobj, &ad7877_attr_group);
-
 	ad7877_disable(ts);
 	free_irq(ts->spi->irq, ts);
 
Signature · 1 line
2.14.2

Thanks.

Signature · 1 line
Dmitry
#3 lore raw

Re: [PATCH 01/12] Input: ad7897 - use managed devm_device_add_group

Hi Dmitry,

Quoted 21 lines
Quoted 21 lines

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the relative sysfs_remove_group and goto label.

CC Michael Hennerich <[email protected]>
---
 drivers/input/touchscreen/ad7877.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/input/touchscreen/ad7877.c +0 -0
index 9c250ae780d9..677ba38b4d1c 100644
@@ -783,18 +783,16 @@ static int ad7877_probe(struct spi_device *spi)
 		goto err_free_mem;
 	}
 
Quoted 6 lines

drivers/input/touchscreen/ad7877.c static int ad7877_probe(struct spi_device *spi) · line 786

Quoted 2 lines
drivers/input/touchscreen/ad7877.c +1 -1
-	err = sysfs_create_group(&spi->dev.kobj, &ad7877_attr_group);
+	err = devm_device_add_group(&spi->dev, &ad7877_attr_group);

This changes order of operations and ultimately may cause use-after-free as memory for ad7877 structure will be freed before we remove attributes.

yes, right... sorry... was too fast at making these patches :) I'll send a second version over the weekend.

Andi

author
#4 lore raw

PATCH 2/12 Input: ad7879 - use managed devm_device_add_group

In reply to Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the action that cleans the sysfs file when exiting the driver.

CC Michael Hennerich <[email protected]>
---
 drivers/input/touchscreen/ad7879.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/input/touchscreen/ad7879.c +1 -12
index 196028c45210..7d74a0ae2c94 100644
@@ -524,13 +524,6 @@ static int ad7879_parse_dt(struct device *dev, struct ad7879 *ts)
 	return 0;
 }
 
-static void ad7879_cleanup_sysfs(void *_ts)
-{
-	struct ad7879 *ts = _ts;
-
-	sysfs_remove_group(&ts->dev->kobj, &ad7879_attr_group);
-}
-
 int ad7879_probe(struct device *dev, struct regmap *regmap,
 		 int irq, u16 bustype, u8 devid)
 {
@@ -658,11 +651,7 @@ int ad7879_probe(struct device *dev, struct regmap *regmap,
 
 	__ad7879_disable(ts);
 
-	err = sysfs_create_group(&dev->kobj, &ad7879_attr_group);
-	if (err)
-		return err;
-
-	err = devm_add_action_or_reset(dev, ad7879_cleanup_sysfs, ts);
+	err = devm_device_add_group(dev, &ad7879_attr_group);
 	if (err)
 		return err;
 
Signature · 1 line
2.14.2
maintainer Applied
#5 lore raw

Re: [PATCH 02/12] Input: ad7879 - use managed devm_device_add_group

Quoted 10 lines · Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the action that cleans the sysfs file when exiting the driver.

CC Michael Hennerich <[email protected]>

Applied, thank you.

Quoted 38 lines
---
 drivers/input/touchscreen/ad7879.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/input/touchscreen/ad7879.c +1 -12
index 196028c45210..7d74a0ae2c94 100644
@@ -524,13 +524,6 @@ static int ad7879_parse_dt(struct device *dev, struct ad7879 *ts)
 	return 0;
 }
 
-static void ad7879_cleanup_sysfs(void *_ts)
-{
-	struct ad7879 *ts = _ts;
-
-	sysfs_remove_group(&ts->dev->kobj, &ad7879_attr_group);
-}
-
 int ad7879_probe(struct device *dev, struct regmap *regmap,
 		 int irq, u16 bustype, u8 devid)
 {
@@ -658,11 +651,7 @@ int ad7879_probe(struct device *dev, struct regmap *regmap,
 
 	__ad7879_disable(ts);
 
-	err = sysfs_create_group(&dev->kobj, &ad7879_attr_group);
-	if (err)
-		return err;
-
-	err = devm_add_action_or_reset(dev, ad7879_cleanup_sysfs, ts);
+	err = devm_device_add_group(dev, &ad7879_attr_group);
 	if (err)
 		return err;
 
Signature · 1 line
2.14.2
Signature · 1 line
Dmitry
author
#6 lore raw

PATCH 3/12 Input: ads7846 - use managed devm_device_add_group

In reply to Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the relative sysfs_remove_group and goto label.

---
 drivers/input/touchscreen/ads7846.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/input/touchscreen/ads7846.c +2 -6
index a2f45aefce08..597f4a2cca42 100644
@@ -1416,13 +1416,13 @@ static int ads7846_probe(struct spi_device *spi)
 	else
 		(void) ads7846_read12_ser(&spi->dev, READ_12BIT_SER(vaux));
 
-	err = sysfs_create_group(&spi->dev.kobj, &ads784x_attr_group);
+	err = devm_device_add_group(&spi->dev, &ads784x_attr_group);
 	if (err)
 		goto err_remove_hwmon;
 
 	err = input_register_device(input_dev);
 	if (err)
-		goto err_remove_attr_group;
+		goto err_remove_hwmon;
 
 	device_init_wakeup(&spi->dev, pdata->wakeup);
 
@@ -1435,8 +1435,6 @@ static int ads7846_probe(struct spi_device *spi)
 
 	return 0;
 
- err_remove_attr_group:
-	sysfs_remove_group(&spi->dev.kobj, &ads784x_attr_group);
  err_remove_hwmon:
 	ads784x_hwmon_unregister(spi, ts);
  err_free_irq:
@@ -1462,8 +1460,6 @@ static int ads7846_remove(struct spi_device *spi)
 {
 	struct ads7846 *ts = spi_get_drvdata(spi);
 
-	sysfs_remove_group(&spi->dev.kobj, &ads784x_attr_group);
-
 	ads7846_disable(ts);
 	free_irq(ts->spi->irq, ts);
 
Signature · 1 line
2.14.2
maintainer
#7 lore raw

Re: [PATCH 03/12] Input: ads7846 - use managed devm_device_add_group

Quoted 42 lines · Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the relative sysfs_remove_group and goto label.

---
 drivers/input/touchscreen/ads7846.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/input/touchscreen/ads7846.c +2 -4
index a2f45aefce08..597f4a2cca42 100644
@@ -1416,13 +1416,13 @@ static int ads7846_probe(struct spi_device *spi)
 	else
 		(void) ads7846_read12_ser(&spi->dev, READ_12BIT_SER(vaux));
 
-	err = sysfs_create_group(&spi->dev.kobj, &ads784x_attr_group);
+	err = devm_device_add_group(&spi->dev, &ads784x_attr_group);
 	if (err)
 		goto err_remove_hwmon;
 
 	err = input_register_device(input_dev);
 	if (err)
-		goto err_remove_attr_group;
+		goto err_remove_hwmon;
 
 	device_init_wakeup(&spi->dev, pdata->wakeup);
 
@@ -1435,8 +1435,6 @@ static int ads7846_probe(struct spi_device *spi)
 
 	return 0;
 
- err_remove_attr_group:
-	sysfs_remove_group(&spi->dev.kobj, &ads784x_attr_group);
  err_remove_hwmon:
 	ads784x_hwmon_unregister(spi, ts);
  err_free_irq:

drivers/input/touchscreen/ads7846.c static int ads7846_remove(struct spi_device *spi) · line 1466

Quoted 5 lines
drivers/input/touchscreen/ads7846.c +0 -2
@@ -1462,8 +1460,6 @@ static int ads7846_remove(struct spi_device *spi)
 {
 	struct ads7846 *ts = spi_get_drvdata(spi);
 
-	sysfs_remove_group(&spi->dev.kobj, &ads784x_attr_group);
-

Wrong ordering.

Quoted 6 lines
drivers/input/touchscreen/ads7846.c +0 -0
 	ads7846_disable(ts);
 	free_irq(ts->spi->irq, ts);
 
Signature · 1 line
2.14.2
Signature · 1 line
Dmitry
author
#8 lore raw

PATCH 4/12 Input: atmel_mxt_ts - use managed devm_device_add_group

In reply to Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group.

---
 drivers/input/touchscreen/atmel_mxt_ts.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +1 -2
index 7659bc48f1db..e5968f136f08 100644
@@ -3170,7 +3170,7 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	if (error)
 		return error;
 
-	error = sysfs_create_group(&client->dev.kobj, &mxt_attr_group);
+	error = devm_device_add_group(&client->dev, &mxt_attr_group);
 	if (error) {
 		dev_err(&client->dev, "Failure %d creating sysfs group\n",
 			error);
@@ -3190,7 +3190,6 @@ static int mxt_remove(struct i2c_client *client)
 	struct mxt_data *data = i2c_get_clientdata(client);
 
 	disable_irq(data->irq);
-	sysfs_remove_group(&client->dev.kobj, &mxt_attr_group);
 	mxt_free_input_device(data);
 	mxt_free_object_table(data);
 
Signature · 1 line
2.14.2
maintainer
#9 lore raw

Re: [PATCH 04/12] Input: atmel_mxt_ts - use managed devm_device_add_group

Quoted 26 lines · Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group.

---
 drivers/input/touchscreen/atmel_mxt_ts.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +1 -1
index 7659bc48f1db..e5968f136f08 100644
@@ -3170,7 +3170,7 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	if (error)
 		return error;
 
-	error = sysfs_create_group(&client->dev.kobj, &mxt_attr_group);
+	error = devm_device_add_group(&client->dev, &mxt_attr_group);
 	if (error) {
 		dev_err(&client->dev, "Failure %d creating sysfs group\n",
 			error);

drivers/input/touchscreen/atmel_mxt_ts.c static int mxt_remove(struct i2c_client *client) · line 3193

Quoted 4 lines
drivers/input/touchscreen/atmel_mxt_ts.c +0 -1
@@ -3190,7 +3190,6 @@ static int mxt_remove(struct i2c_client *client)
 	struct mxt_data *data = i2c_get_clientdata(client);
 
 	disable_irq(data->irq);
-	sysfs_remove_group(&client->dev.kobj, &mxt_attr_group);

Wrong ordering.

Quoted 6 lines
drivers/input/touchscreen/atmel_mxt_ts.c +0 -0
 	mxt_free_input_device(data);
 	mxt_free_object_table(data);
 
Signature · 1 line
2.14.2
Signature · 1 line
Dmitry
author
#10 lore raw

PATCH 5/12 Input: edt-ft5x06 - use managed devm_device_add_group

In reply to Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the relative sysfs_remove_group and goto label.

---
 drivers/input/touchscreen/edt-ft5x06.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/input/touchscreen/edt-ft5x06.c +2 -7
index 5bf63f76ddda..f879d14f7ffc 100644
@@ -998,13 +998,13 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 		return error;
 	}
 
-	error = sysfs_create_group(&client->dev.kobj, &edt_ft5x06_attr_group);
+	error = devm_device_add_group(&client->dev, &edt_ft5x06_attr_group);
 	if (error)
 		return error;
 
 	error = input_register_device(input);
 	if (error)
-		goto err_remove_attrs;
+		return error;
 
 	edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev));
 	device_init_wakeup(&client->dev, 1);
@@ -1016,10 +1016,6 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 		tsdata->reset_gpio ? desc_to_gpio(tsdata->reset_gpio) : -1);
 
 	return 0;
-
-err_remove_attrs:
-	sysfs_remove_group(&client->dev.kobj, &edt_ft5x06_attr_group);
-	return error;
 }
 
 static int edt_ft5x06_ts_remove(struct i2c_client *client)
@@ -1027,7 +1023,6 @@ static int edt_ft5x06_ts_remove(struct i2c_client *client)
 	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
 
 	edt_ft5x06_ts_teardown_debugfs(tsdata);
-	sysfs_remove_group(&client->dev.kobj, &edt_ft5x06_attr_group);
 
 	return 0;
 }
Signature · 1 line
2.14.2
maintainer Applied
#11 lore raw

Re: [PATCH 05/12] Input: edt-ft5x06 - use managed devm_device_add_group

Quoted 8 lines · Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the relative sysfs_remove_group and goto label.

Applied, thank you.

Quoted 46 lines
---
 drivers/input/touchscreen/edt-ft5x06.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/input/touchscreen/edt-ft5x06.c +2 -7
index 5bf63f76ddda..f879d14f7ffc 100644
@@ -998,13 +998,13 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 		return error;
 	}
 
-	error = sysfs_create_group(&client->dev.kobj, &edt_ft5x06_attr_group);
+	error = devm_device_add_group(&client->dev, &edt_ft5x06_attr_group);
 	if (error)
 		return error;
 
 	error = input_register_device(input);
 	if (error)
-		goto err_remove_attrs;
+		return error;
 
 	edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev));
 	device_init_wakeup(&client->dev, 1);
@@ -1016,10 +1016,6 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 		tsdata->reset_gpio ? desc_to_gpio(tsdata->reset_gpio) : -1);
 
 	return 0;
-
-err_remove_attrs:
-	sysfs_remove_group(&client->dev.kobj, &edt_ft5x06_attr_group);
-	return error;
 }
 
 static int edt_ft5x06_ts_remove(struct i2c_client *client)
@@ -1027,7 +1023,6 @@ static int edt_ft5x06_ts_remove(struct i2c_client *client)
 	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
 
 	edt_ft5x06_ts_teardown_debugfs(tsdata);
-	sysfs_remove_group(&client->dev.kobj, &edt_ft5x06_attr_group);
 
 	return 0;
 }
Signature · 1 line
2.14.2
Signature · 1 line
Dmitry
author
#12 lore raw

PATCH 6/12 Input: elants_i2c - use managed devm_device_add_group

In reply to Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the action that cleans the sysfs file when exiting the driver.

---
 drivers/input/touchscreen/elants_i2c.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
drivers/input/touchscreen/elants_i2c.c +1 -18
index 0f4cda7282a2..e102d7764bc2 100644
@@ -1070,13 +1070,6 @@ static const struct attribute_group elants_attribute_group = {
 	.attrs = elants_attributes,
 };
 
-static void elants_i2c_remove_sysfs_group(void *_data)
-{
-	struct elants_data *ts = _data;
-
-	sysfs_remove_group(&ts->client->dev.kobj, &elants_attribute_group);
-}
-
 static int elants_i2c_power_on(struct elants_data *ts)
 {
 	int error;
@@ -1289,23 +1282,13 @@ static int elants_i2c_probe(struct i2c_client *client,
 	if (!client->dev.of_node)
 		device_init_wakeup(&client->dev, true);
 
-	error = sysfs_create_group(&client->dev.kobj, &elants_attribute_group);
+	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;
 	}
 
-	error = devm_add_action(&client->dev,
-				elants_i2c_remove_sysfs_group, ts);
-	if (error) {
-		elants_i2c_remove_sysfs_group(ts);
-		dev_err(&client->dev,
-			"Failed to add sysfs cleanup action: %d\n",
-			error);
-		return error;
-	}
-
 	return 0;
 }
 
Signature · 1 line
2.14.2
maintainer Applied
#13 lore raw

Re: [PATCH 06/12] Input: elants_i2c - use managed devm_device_add_group

Quoted 9 lines · Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the action that cleans the sysfs file when exiting the driver.

Applied, thank you.

Quoted 50 lines
---
 drivers/input/touchscreen/elants_i2c.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
drivers/input/touchscreen/elants_i2c.c +1 -18
index 0f4cda7282a2..e102d7764bc2 100644
@@ -1070,13 +1070,6 @@ static const struct attribute_group elants_attribute_group = {
 	.attrs = elants_attributes,
 };
 
-static void elants_i2c_remove_sysfs_group(void *_data)
-{
-	struct elants_data *ts = _data;
-
-	sysfs_remove_group(&ts->client->dev.kobj, &elants_attribute_group);
-}
-
 static int elants_i2c_power_on(struct elants_data *ts)
 {
 	int error;
@@ -1289,23 +1282,13 @@ static int elants_i2c_probe(struct i2c_client *client,
 	if (!client->dev.of_node)
 		device_init_wakeup(&client->dev, true);
 
-	error = sysfs_create_group(&client->dev.kobj, &elants_attribute_group);
+	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;
 	}
 
-	error = devm_add_action(&client->dev,
-				elants_i2c_remove_sysfs_group, ts);
-	if (error) {
-		elants_i2c_remove_sysfs_group(ts);
-		dev_err(&client->dev,
-			"Failed to add sysfs cleanup action: %d\n",
-			error);
-		return error;
-	}
-
 	return 0;
 }
 
Signature · 1 line
2.14.2
Signature · 1 line
Dmitry
author
#14 lore raw

PATCH 7/12 Input: ili210x - use managed devm_device_add_group

In reply to Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the relative sysfs_remove_group and goto label.

---
 drivers/input/touchscreen/ili210x.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/input/touchscreen/ili210x.c +2 -5
index 6f76eeedf465..03a6aca2941f 100644
@@ -266,7 +266,7 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 		goto err_free_mem;
 	}
 
-	error = sysfs_create_group(&dev->kobj, &ili210x_attr_group);
+	error = devm_device_add_group(dev, &ili210x_attr_group);
 	if (error) {
 		dev_err(dev, "Unable to create sysfs attributes, err: %d\n",
 			error);
@@ -276,7 +276,7 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 	error = input_register_device(priv->input);
 	if (error) {
 		dev_err(dev, "Cannot register input device, err: %d\n", error);
-		goto err_remove_sysfs;
+		goto err_free_irq;
 	}
 
 	device_init_wakeup(dev, 1);
@@ -287,8 +287,6 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 
 	return 0;
 
-err_remove_sysfs:
-	sysfs_remove_group(&dev->kobj, &ili210x_attr_group);
 err_free_irq:
 	free_irq(client->irq, priv);
 err_free_mem:
@@ -301,7 +299,6 @@ static int ili210x_i2c_remove(struct i2c_client *client)
 {
 	struct ili210x *priv = i2c_get_clientdata(client);
 
-	sysfs_remove_group(&client->dev.kobj, &ili210x_attr_group);
 	free_irq(priv->client->irq, priv);
 	cancel_delayed_work_sync(&priv->dwork);
 	input_unregister_device(priv->input);
Signature · 1 line
2.14.2
maintainer
#15 lore raw

Re: [PATCH 07/12] Input: ili210x - use managed devm_device_add_group

Quoted 44 lines · Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the relative sysfs_remove_group and goto label.

---
 drivers/input/touchscreen/ili210x.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/input/touchscreen/ili210x.c +2 -4
index 6f76eeedf465..03a6aca2941f 100644
@@ -266,7 +266,7 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 		goto err_free_mem;
 	}
 
-	error = sysfs_create_group(&dev->kobj, &ili210x_attr_group);
+	error = devm_device_add_group(dev, &ili210x_attr_group);
 	if (error) {
 		dev_err(dev, "Unable to create sysfs attributes, err: %d\n",
 			error);
@@ -276,7 +276,7 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 	error = input_register_device(priv->input);
 	if (error) {
 		dev_err(dev, "Cannot register input device, err: %d\n", error);
-		goto err_remove_sysfs;
+		goto err_free_irq;
 	}
 
 	device_init_wakeup(dev, 1);
@@ -287,8 +287,6 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 
 	return 0;
 
-err_remove_sysfs:
-	sysfs_remove_group(&dev->kobj, &ili210x_attr_group);
 err_free_irq:
 	free_irq(client->irq, priv);
 err_free_mem:

drivers/input/touchscreen/ili210x.c static int ili210x_i2c_remove(struct i2c_client *client) · line 304

Quoted 4 lines
drivers/input/touchscreen/ili210x.c +0 -1
@@ -301,7 +299,6 @@ static int ili210x_i2c_remove(struct i2c_client *client)
 {
 	struct ili210x *priv = i2c_get_clientdata(client);
 
-	sysfs_remove_group(&client->dev.kobj, &ili210x_attr_group);

Wrong ordering, the sysfs attributes will be removed only after device has been town down.

Quoted 6 lines
drivers/input/touchscreen/ili210x.c +0 -0
 	free_irq(priv->client->irq, priv);
 	cancel_delayed_work_sync(&priv->dwork);
 	input_unregister_device(priv->input);
Signature · 1 line
2.14.2
Signature · 1 line
Dmitry
author
#16 lore raw

PATCH 8/12 Input: melfas_mip4 - use managed devm_device_add_group

In reply to Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the action that cleans the sysfs file when exiting the driver.

---
 drivers/input/touchscreen/melfas_mip4.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
drivers/input/touchscreen/melfas_mip4.c +1 -16
index 05108c2fea93..6892f0e28918 100644
@@ -1433,13 +1433,6 @@ static const struct attribute_group mip4_attr_group = {
 	.attrs = mip4_attrs,
 };
 
-static void mip4_sysfs_remove(void *_data)
-{
-	struct mip4_ts *ts = _data;
-
-	sysfs_remove_group(&ts->client->dev.kobj, &mip4_attr_group);
-}
-
 static int mip4_probe(struct i2c_client *client, const struct i2c_device_id *id)
 {
 	struct mip4_ts *ts;
@@ -1535,21 +1528,13 @@ static int mip4_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		return error;
 	}
 
-	error = sysfs_create_group(&client->dev.kobj, &mip4_attr_group);
+	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;
 	}
 
-	error = devm_add_action(&client->dev, mip4_sysfs_remove, ts);
-	if (error) {
-		mip4_sysfs_remove(ts);
-		dev_err(&client->dev,
-			"Failed to install sysfs remoce action: %d\n", error);
-		return error;
-	}
-
 	return 0;
 }
 
Signature · 1 line
2.14.2
maintainer Applied
#17 lore raw

Re: [PATCH 08/12] Input: melfas_mip4 - use managed devm_device_add_group

Quoted 10 lines · Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the action that cleans the sysfs file when exiting the driver.

Applied, thank you.

Quoted 48 lines
---
 drivers/input/touchscreen/melfas_mip4.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
drivers/input/touchscreen/melfas_mip4.c +1 -16
index 05108c2fea93..6892f0e28918 100644
@@ -1433,13 +1433,6 @@ static const struct attribute_group mip4_attr_group = {
 	.attrs = mip4_attrs,
 };
 
-static void mip4_sysfs_remove(void *_data)
-{
-	struct mip4_ts *ts = _data;
-
-	sysfs_remove_group(&ts->client->dev.kobj, &mip4_attr_group);
-}
-
 static int mip4_probe(struct i2c_client *client, const struct i2c_device_id *id)
 {
 	struct mip4_ts *ts;
@@ -1535,21 +1528,13 @@ static int mip4_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		return error;
 	}
 
-	error = sysfs_create_group(&client->dev.kobj, &mip4_attr_group);
+	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;
 	}
 
-	error = devm_add_action(&client->dev, mip4_sysfs_remove, ts);
-	if (error) {
-		mip4_sysfs_remove(ts);
-		dev_err(&client->dev,
-			"Failed to install sysfs remoce action: %d\n", error);
-		return error;
-	}
-
 	return 0;
 }
 
Signature · 1 line
2.14.2
Signature · 1 line
Dmitry
author
#18 lore raw

PATCH 9/12 Input: raydium_i2c_ts - use managed devm_device_add_group

In reply to Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the action that cleans the sysfs file when exiting the driver.

---
 drivers/input/touchscreen/raydium_i2c_ts.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/input/touchscreen/raydium_i2c_ts.c +1 -17
index 4f1d3fd5d412..100538d64fff 100644
@@ -943,13 +943,6 @@ static const struct attribute_group raydium_i2c_attribute_group = {
 	.attrs = raydium_i2c_attributes,
 };
 
-static void raydium_i2c_remove_sysfs_group(void *_data)
-{
-	struct raydium_data *ts = _data;
-
-	sysfs_remove_group(&ts->client->dev.kobj, &raydium_i2c_attribute_group);
-}
-
 static int raydium_i2c_power_on(struct raydium_data *ts)
 {
 	int error;
@@ -1120,7 +1113,7 @@ static int raydium_i2c_probe(struct i2c_client *client,
 		return error;
 	}
 
-	error = sysfs_create_group(&client->dev.kobj,
+	error = devm_device_add_group(&client->dev,
 				   &raydium_i2c_attribute_group);
 	if (error) {
 		dev_err(&client->dev, "failed to create sysfs attributes: %d\n",
@@ -1128,15 +1121,6 @@ static int raydium_i2c_probe(struct i2c_client *client,
 		return error;
 	}
 
-	error = devm_add_action(&client->dev,
-				raydium_i2c_remove_sysfs_group, ts);
-	if (error) {
-		raydium_i2c_remove_sysfs_group(ts);
-		dev_err(&client->dev,
-			"Failed to add sysfs cleanup action: %d\n", error);
-		return error;
-	}
-
 	return 0;
 }
 
Signature · 1 line
2.14.2
maintainer Applied
#19 lore raw

Re: [PATCH 09/12] Input: raydium_i2c_ts - use managed devm_device_add_group

Quoted 9 lines · Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the action that cleans the sysfs file when exiting the driver.

Applied, thank you.

Quoted 50 lines
---
 drivers/input/touchscreen/raydium_i2c_ts.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/input/touchscreen/raydium_i2c_ts.c +1 -17
index 4f1d3fd5d412..100538d64fff 100644
@@ -943,13 +943,6 @@ static const struct attribute_group raydium_i2c_attribute_group = {
 	.attrs = raydium_i2c_attributes,
 };
 
-static void raydium_i2c_remove_sysfs_group(void *_data)
-{
-	struct raydium_data *ts = _data;
-
-	sysfs_remove_group(&ts->client->dev.kobj, &raydium_i2c_attribute_group);
-}
-
 static int raydium_i2c_power_on(struct raydium_data *ts)
 {
 	int error;
@@ -1120,7 +1113,7 @@ static int raydium_i2c_probe(struct i2c_client *client,
 		return error;
 	}
 
-	error = sysfs_create_group(&client->dev.kobj,
+	error = devm_device_add_group(&client->dev,
 				   &raydium_i2c_attribute_group);
 	if (error) {
 		dev_err(&client->dev, "failed to create sysfs attributes: %d\n",
@@ -1128,15 +1121,6 @@ static int raydium_i2c_probe(struct i2c_client *client,
 		return error;
 	}
 
-	error = devm_add_action(&client->dev,
-				raydium_i2c_remove_sysfs_group, ts);
-	if (error) {
-		raydium_i2c_remove_sysfs_group(ts);
-		dev_err(&client->dev,
-			"Failed to add sysfs cleanup action: %d\n", error);
-		return error;
-	}
-
 	return 0;
 }
 
Signature · 1 line
2.14.2
Signature · 1 line
Dmitry
author
#20 lore raw

PATCH 10/12 Input: rohm_bu21023 - use managed devm_device_add_group

In reply to Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the action that cleans the sysfs file when exiting the driver.

---
 drivers/input/touchscreen/rohm_bu21023.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
drivers/input/touchscreen/rohm_bu21023.c +1 -16
index eeaf6ff03597..bda0500c9b57 100644
@@ -1103,13 +1103,6 @@ static void rohm_ts_close(struct input_dev *input_dev)
 	ts->initialized = false;
 }
 
-static void rohm_ts_remove_sysfs_group(void *_dev)
-{
-	struct device *dev = _dev;
-
-	sysfs_remove_group(&dev->kobj, &rohm_ts_attr_group);
-}
-
 static int rohm_bu21023_i2c_probe(struct i2c_client *client,
 				  const struct i2c_device_id *id)
 {
@@ -1180,20 +1173,12 @@ static int rohm_bu21023_i2c_probe(struct i2c_client *client,
 		return error;
 	}
 
-	error = sysfs_create_group(&dev->kobj, &rohm_ts_attr_group);
+	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;
 	}
 
-	error = devm_add_action(dev, rohm_ts_remove_sysfs_group, dev);
-	if (error) {
-		rohm_ts_remove_sysfs_group(dev);
-		dev_err(dev, "Failed to add sysfs cleanup action: %d\n",
-			error);
-		return error;
-	}
-
 	return error;
 }
 
Signature · 1 line
2.14.2
maintainer Applied
#21 lore raw

Re: [PATCH 10/12] Input: rohm_bu21023 - use managed devm_device_add_group

Quoted 9 lines · Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the action that cleans the sysfs file when exiting the driver.

Applied, thank you.

Quoted 47 lines
---
 drivers/input/touchscreen/rohm_bu21023.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
drivers/input/touchscreen/rohm_bu21023.c +1 -16
index eeaf6ff03597..bda0500c9b57 100644
@@ -1103,13 +1103,6 @@ static void rohm_ts_close(struct input_dev *input_dev)
 	ts->initialized = false;
 }
 
-static void rohm_ts_remove_sysfs_group(void *_dev)
-{
-	struct device *dev = _dev;
-
-	sysfs_remove_group(&dev->kobj, &rohm_ts_attr_group);
-}
-
 static int rohm_bu21023_i2c_probe(struct i2c_client *client,
 				  const struct i2c_device_id *id)
 {
@@ -1180,20 +1173,12 @@ static int rohm_bu21023_i2c_probe(struct i2c_client *client,
 		return error;
 	}
 
-	error = sysfs_create_group(&dev->kobj, &rohm_ts_attr_group);
+	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;
 	}
 
-	error = devm_add_action(dev, rohm_ts_remove_sysfs_group, dev);
-	if (error) {
-		rohm_ts_remove_sysfs_group(dev);
-		dev_err(dev, "Failed to add sysfs cleanup action: %d\n",
-			error);
-		return error;
-	}
-
 	return error;
 }
 
Signature · 1 line
2.14.2
Signature · 1 line
Dmitry
author
#22 lore raw

PATCH 11/12 Input: tsc200x-core - use managed devm_device_add_group

In reply to Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the relative sysfs_remove_group and goto label.

---
 drivers/input/touchscreen/tsc200x-core.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/input/touchscreen/tsc200x-core.c +2 -6
index 88ea5e1b72ae..caec24265d78 100644
@@ -559,7 +559,7 @@ 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);
+	error = devm_device_add_group(dev, &tsc200x_attr_group);
 	if (error) {
 		dev_err(dev,
 			"Failed to create sysfs attributes, err: %d\n", error);
@@ -570,14 +570,12 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
 	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;
@@ -588,8 +586,6 @@ int tsc200x_remove(struct device *dev)
 {
 	struct tsc200x *ts = dev_get_drvdata(dev);
 
-	sysfs_remove_group(&dev->kobj, &tsc200x_attr_group);
-
 	regulator_disable(ts->vio);
 
 	return 0;
Signature · 1 line
2.14.2
maintainer
#23 lore raw

Re: [PATCH 11/12] Input: tsc200x-core - use managed devm_device_add_group

Quoted 42 lines · Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the relative sysfs_remove_group and goto label.

---
 drivers/input/touchscreen/tsc200x-core.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/input/touchscreen/tsc200x-core.c +2 -4
index 88ea5e1b72ae..caec24265d78 100644
@@ -559,7 +559,7 @@ 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);
+	error = devm_device_add_group(dev, &tsc200x_attr_group);
 	if (error) {
 		dev_err(dev,
 			"Failed to create sysfs attributes, err: %d\n", error);
@@ -570,14 +570,12 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
 	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;

drivers/input/touchscreen/tsc200x-core.c int tsc200x_remove(struct device *dev) · line 592

Quoted 5 lines
drivers/input/touchscreen/tsc200x-core.c +0 -2
@@ -588,8 +586,6 @@ int tsc200x_remove(struct device *dev)
 {
 	struct tsc200x *ts = dev_get_drvdata(dev);
 
-	sysfs_remove_group(&dev->kobj, &tsc200x_attr_group);
-

Wrong ordering now, you do not want to be accessing the device when it is powered down.

Quoted 6 lines
drivers/input/touchscreen/tsc200x-core.c +0 -0
 	regulator_disable(ts->vio);
 
 	return 0;
Signature · 1 line
2.14.2

Thanks.

Signature · 1 line
Dmitry
author
#24 lore raw

PATCH 12/12 Input: wdt87xx_i2c - use managed devm_device_add_group

In reply to Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the relative sysfs_remove_group.

---
 drivers/input/touchscreen/wdt87xx_i2c.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/input/touchscreen/wdt87xx_i2c.c +1 -3
index a9132603ab34..b866cc88d942 100644
@@ -1106,7 +1106,7 @@ static int wdt87xx_ts_probe(struct i2c_client *client,
 		return error;
 	}
 
-	error = sysfs_create_group(&client->dev.kobj, &wdt87xx_attr_group);
+	error = devm_device_add_group(&client->dev, &wdt87xx_attr_group);
 	if (error) {
 		dev_err(&client->dev, "create sysfs failed: %d\n", error);
 		return error;
@@ -1117,8 +1117,6 @@ static int wdt87xx_ts_probe(struct i2c_client *client,
 
 static int wdt87xx_ts_remove(struct i2c_client *client)
 {
-	sysfs_remove_group(&client->dev.kobj, &wdt87xx_attr_group);
-
 	return 0;
 }
 
Signature · 1 line
2.14.2
maintainer Applied
#25 lore raw

Re: [PATCH 12/12] Input: wdt87xx_i2c - use managed devm_device_add_group

Quoted 8 lines · Andi Shyti

Commit 57b8ff070f98 ("driver core: add devm_device_add_group() and friends") has added the the managed version for creating sysfs group files.

Use devm_device_add_group instead of sysfs_create_group and remove the relative sysfs_remove_group.

Applied, thank you.

Quoted 29 lines
---
 drivers/input/touchscreen/wdt87xx_i2c.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/input/touchscreen/wdt87xx_i2c.c +1 -3
index a9132603ab34..b866cc88d942 100644
@@ -1106,7 +1106,7 @@ static int wdt87xx_ts_probe(struct i2c_client *client,
 		return error;
 	}
 
-	error = sysfs_create_group(&client->dev.kobj, &wdt87xx_attr_group);
+	error = devm_device_add_group(&client->dev, &wdt87xx_attr_group);
 	if (error) {
 		dev_err(&client->dev, "create sysfs failed: %d\n", error);
 		return error;
@@ -1117,8 +1117,6 @@ static int wdt87xx_ts_probe(struct i2c_client *client,
 
 static int wdt87xx_ts_remove(struct i2c_client *client)
 {
-	sysfs_remove_group(&client->dev.kobj, &wdt87xx_attr_group);
-
 	return 0;
 }
 
Signature · 1 line
2.14.2
Signature · 1 line
Dmitry