Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1692310 > unrolled thread

[PATCH v2 7/7] Input: axp20x-pek - switch to using devm_device_add_group()

Started byDmitry Torokhov <dmitry.torokhov@gmail.com>
First post2017-07-20 02:30 +0200
Last post2017-07-20 05:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 7/7] Input: axp20x-pek - switch to using devm_device_add_group() Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-07-20 02:30 +0200
    Re: [PATCH v2 7/7] Input: axp20x-pek - switch to using  devm_device_add_group() Guenter Roeck <linux@roeck-us.net> - 2017-07-20 05:30 +0200

#1692310 — [PATCH v2 7/7] Input: axp20x-pek - switch to using devm_device_add_group()

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2017-07-20 02:30 +0200
Subject[PATCH v2 7/7] Input: axp20x-pek - switch to using devm_device_add_group()
Message-ID<u57vQ-7Pa-15@gated-at.bofh.it>
Now that we have proper managed API to create device attributes, let's
use it instead of installing a custom devm action.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/misc/axp20x-pek.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
index 38c79ebff033..cfeb0e943de6 100644
--- a/drivers/input/misc/axp20x-pek.c
+++ b/drivers/input/misc/axp20x-pek.c
@@ -182,13 +182,6 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
 	return IRQ_HANDLED;
 }
 
-static void axp20x_remove_sysfs_group(void *_data)
-{
-	struct device *dev = _data;
-
-	sysfs_remove_group(&dev->kobj, &axp20x_attribute_group);
-}
-
 static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
 					 struct platform_device *pdev)
 {
@@ -313,22 +306,13 @@ static int axp20x_pek_probe(struct platform_device *pdev)
 			return error;
 	}
 
-	error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group);
+	error = devm_device_add_group(&pdev->dev, &axp20x_attribute_group);
 	if (error) {
 		dev_err(&pdev->dev, "Failed to create sysfs attributes: %d\n",
 			error);
 		return error;
 	}
 
-	error = devm_add_action(&pdev->dev,
-				axp20x_remove_sysfs_group, &pdev->dev);
-	if (error) {
-		axp20x_remove_sysfs_group(&pdev->dev);
-		dev_err(&pdev->dev, "Failed to add sysfs cleanup action: %d\n",
-			error);
-		return error;
-	}
-
 	platform_set_drvdata(pdev, axp20x_pek);
 
 	return 0;
-- 
2.14.0.rc0.284.gd933b75aa4-goog

[toc] | [next] | [standalone]


#1692374 — Re: [PATCH v2 7/7] Input: axp20x-pek - switch to using devm_device_add_group()

FromGuenter Roeck <linux@roeck-us.net>
Date2017-07-20 05:30 +0200
SubjectRe: [PATCH v2 7/7] Input: axp20x-pek - switch to using devm_device_add_group()
Message-ID<u5ak1-1ov-9@gated-at.bofh.it>
In reply to#1692310
On 07/19/2017 05:24 PM, Dmitry Torokhov wrote:
> Now that we have proper managed API to create device attributes, let's
> use it instead of installing a custom devm action.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/input/misc/axp20x-pek.c | 18 +-----------------
>   1 file changed, 1 insertion(+), 17 deletions(-)
> 
> diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
> index 38c79ebff033..cfeb0e943de6 100644
> --- a/drivers/input/misc/axp20x-pek.c
> +++ b/drivers/input/misc/axp20x-pek.c
> @@ -182,13 +182,6 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
>   	return IRQ_HANDLED;
>   }
>   
> -static void axp20x_remove_sysfs_group(void *_data)
> -{
> -	struct device *dev = _data;
> -
> -	sysfs_remove_group(&dev->kobj, &axp20x_attribute_group);
> -}
> -
>   static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
>   					 struct platform_device *pdev)
>   {
> @@ -313,22 +306,13 @@ static int axp20x_pek_probe(struct platform_device *pdev)
>   			return error;
>   	}
>   
> -	error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group);
> +	error = devm_device_add_group(&pdev->dev, &axp20x_attribute_group);
>   	if (error) {
>   		dev_err(&pdev->dev, "Failed to create sysfs attributes: %d\n",
>   			error);
>   		return error;
>   	}
>   
> -	error = devm_add_action(&pdev->dev,
> -				axp20x_remove_sysfs_group, &pdev->dev);
> -	if (error) {
> -		axp20x_remove_sysfs_group(&pdev->dev);
> -		dev_err(&pdev->dev, "Failed to add sysfs cleanup action: %d\n",
> -			error);
> -		return error;
> -	}
> -
>   	platform_set_drvdata(pdev, axp20x_pek);
>   
>   	return 0;
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web