diff mbox series

[19/22] Input: s6sy761 - use device core to create driver-specific device attributes

Message ID 20230729005133.1095051-19-dmitry.torokhov@gmail.com (mailing list archive)
State Mainlined
Commit 2ad952810861faac2cda65189c7e96c802c7a8f2
Headers show
Series [01/22] Input: cros_ec_keyb - use device core to create driver-specific device attributes | expand

Commit Message

Dmitry Torokhov July 29, 2023, 12:51 a.m. UTC
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(-)

Comments

Andi Shyti July 30, 2023, 1:02 p.m. UTC | #1
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
>
diff mbox series

Patch

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),
 	},