Skip to content

Commit

Permalink
Input: gpio_keys - use devm_device_add_group() for attributes
Browse files Browse the repository at this point in the history
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 <dmitry.torokhov@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dmitry Torokhov authored and Greg Kroah-Hartman committed Jul 22, 2017
1 parent 57b8ff0 commit 3184125
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions drivers/input/keyboard/gpio_keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ static int gpio_keys_probe(struct platform_device *pdev)

fwnode_handle_put(child);

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

device_init_wakeup(dev, wakeup);

return 0;

err_remove_group:
sysfs_remove_group(&dev->kobj, &gpio_keys_attr_group);
return error;
}

static int gpio_keys_remove(struct platform_device *pdev)
{
sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group);

return 0;
}

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

static struct platform_driver gpio_keys_device_driver = {
.probe = gpio_keys_probe,
.remove = gpio_keys_remove,
.driver = {
.name = "gpio-keys",
.pm = &gpio_keys_pm_ops,
Expand Down

0 comments on commit 3184125

Please sign in to comment.