aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-07-19 20:24:36 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-07-22 05:59:23 -0400
commit072a7852338af900c302490474939e089f4bd4c4 (patch)
treedc2d015488e2cc6a0e4b9cbd26ad387ea0b902c8
parent36a44af5c176d619552d99697433261141dd1296 (diff)
Input: axp20x-pek - switch to using devm_device_add_group()
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>
-rw-r--r--drivers/input/misc/axp20x-pek.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
index 400869e61a06..0932d3e56199 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)
182 return IRQ_HANDLED; 182 return IRQ_HANDLED;
183} 183}
184 184
185static void axp20x_remove_sysfs_group(void *_data)
186{
187 struct device *dev = _data;
188
189 sysfs_remove_group(&dev->kobj, &axp20x_attribute_group);
190}
191
192static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek, 185static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
193 struct platform_device *pdev) 186 struct platform_device *pdev)
194{ 187{
@@ -310,22 +303,13 @@ static int axp20x_pek_probe(struct platform_device *pdev)
310 return error; 303 return error;
311 } 304 }
312 305
313 error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group); 306 error = devm_device_add_group(&pdev->dev, &axp20x_attribute_group);
314 if (error) { 307 if (error) {
315 dev_err(&pdev->dev, "Failed to create sysfs attributes: %d\n", 308 dev_err(&pdev->dev, "Failed to create sysfs attributes: %d\n",
316 error); 309 error);
317 return error; 310 return error;
318 } 311 }
319 312
320 error = devm_add_action(&pdev->dev,
321 axp20x_remove_sysfs_group, &pdev->dev);
322 if (error) {
323 axp20x_remove_sysfs_group(&pdev->dev);
324 dev_err(&pdev->dev, "Failed to add sysfs cleanup action: %d\n",
325 error);
326 return error;
327 }
328
329 platform_set_drvdata(pdev, axp20x_pek); 313 platform_set_drvdata(pdev, axp20x_pek);
330 314
331 return 0; 315 return 0;