Skip to content

Commit 3184125

Browse files
dtorgregkh
authored andcommitted
Input: gpio_keys - use devm_device_add_group() for attributes
Now that we have proper managed API to create device attributes, let's start using it instead of the manual unwinding. Signed-off-by: Dmitry Torokhov <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 57b8ff0 commit 3184125

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

drivers/input/keyboard/gpio_keys.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ static int gpio_keys_probe(struct platform_device *pdev)
814814

815815
fwnode_handle_put(child);
816816

817-
error = sysfs_create_group(&dev->kobj, &gpio_keys_attr_group);
817+
error = devm_device_add_group(dev, &gpio_keys_attr_group);
818818
if (error) {
819819
dev_err(dev, "Unable to export keys/switches, error: %d\n",
820820
error);
@@ -825,22 +825,11 @@ static int gpio_keys_probe(struct platform_device *pdev)
825825
if (error) {
826826
dev_err(dev, "Unable to register input device, error: %d\n",
827827
error);
828-
goto err_remove_group;
828+
return error;
829829
}
830830

831831
device_init_wakeup(dev, wakeup);
832832

833-
return 0;
834-
835-
err_remove_group:
836-
sysfs_remove_group(&dev->kobj, &gpio_keys_attr_group);
837-
return error;
838-
}
839-
840-
static int gpio_keys_remove(struct platform_device *pdev)
841-
{
842-
sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group);
843-
844833
return 0;
845834
}
846835

@@ -897,7 +886,6 @@ static SIMPLE_DEV_PM_OPS(gpio_keys_pm_ops, gpio_keys_suspend, gpio_keys_resume);
897886

898887
static struct platform_driver gpio_keys_device_driver = {
899888
.probe = gpio_keys_probe,
900-
.remove = gpio_keys_remove,
901889
.driver = {
902890
.name = "gpio-keys",
903891
.pm = &gpio_keys_pm_ops,

0 commit comments

Comments
 (0)