Commit 528c7d02 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: rb532_button - switch to using managed resources

Using devm API allows us to clean up error handling paths and drop the
remove() method.

Link: https://lore.kernel.org/r/20191017204217.106453-16-dmitry.torokhov@gmail.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent aede7a1e
...@@ -58,7 +58,7 @@ static int rb532_button_probe(struct platform_device *pdev) ...@@ -58,7 +58,7 @@ static int rb532_button_probe(struct platform_device *pdev)
struct input_polled_dev *poll_dev; struct input_polled_dev *poll_dev;
int error; int error;
poll_dev = input_allocate_polled_device(); poll_dev = devm_input_allocate_polled_device(&pdev->dev);
if (!poll_dev) if (!poll_dev)
return -ENOMEM; return -ENOMEM;
...@@ -68,34 +68,18 @@ static int rb532_button_probe(struct platform_device *pdev) ...@@ -68,34 +68,18 @@ static int rb532_button_probe(struct platform_device *pdev)
poll_dev->input->name = "rb532 button"; poll_dev->input->name = "rb532 button";
poll_dev->input->phys = "rb532/button0"; poll_dev->input->phys = "rb532/button0";
poll_dev->input->id.bustype = BUS_HOST; poll_dev->input->id.bustype = BUS_HOST;
poll_dev->input->dev.parent = &pdev->dev;
dev_set_drvdata(&pdev->dev, poll_dev);
input_set_capability(poll_dev->input, EV_KEY, RB532_BTN_KSYM); input_set_capability(poll_dev->input, EV_KEY, RB532_BTN_KSYM);
error = input_register_polled_device(poll_dev); error = input_register_polled_device(poll_dev);
if (error) { if (error)
input_free_polled_device(poll_dev);
return error; return error;
}
return 0;
}
static int rb532_button_remove(struct platform_device *pdev)
{
struct input_polled_dev *poll_dev = dev_get_drvdata(&pdev->dev);
input_unregister_polled_device(poll_dev);
input_free_polled_device(poll_dev);
return 0; return 0;
} }
static struct platform_driver rb532_button_driver = { static struct platform_driver rb532_button_driver = {
.probe = rb532_button_probe, .probe = rb532_button_probe,
.remove = rb532_button_remove,
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment