Input: axp20x-pek - switch to using devm_device_add_group()
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 20 Jul 2017 00:24:36 +0000 (17:24 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Jul 2017 09:59:23 +0000 (11:59 +0200)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/input/misc/axp20x-pek.c

index 400869e61a0663be592e723f8f9de4f3596aaf3d..0932d3e5619912beb542a92fc76a1e1ba5a043fd 100644 (file)
@@ -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)
 {
@@ -310,22 +303,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;