Skip to content

Commit 072a785

Browse files
dtorgregkh
authored andcommitted
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 <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 36a44af commit 072a785

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

drivers/input/misc/axp20x-pek.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,6 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
182182
return IRQ_HANDLED;
183183
}
184184

185-
static 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-
192185
static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
193186
struct platform_device *pdev)
194187
{
@@ -310,22 +303,13 @@ static int axp20x_pek_probe(struct platform_device *pdev)
310303
return error;
311304
}
312305

313-
error = sysfs_create_group(&pdev->dev.kobj, &axp20x_attribute_group);
306+
error = devm_device_add_group(&pdev->dev, &axp20x_attribute_group);
314307
if (error) {
315308
dev_err(&pdev->dev, "Failed to create sysfs attributes: %d\n",
316309
error);
317310
return error;
318311
}
319312

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-
329313
platform_set_drvdata(pdev, axp20x_pek);
330314

331315
return 0;

0 commit comments

Comments
 (0)