[15/22] Input: rb532_button - switch to using managed resources
diff mbox series

Message ID 20191017204217.106453-16-dmitry.torokhov@gmail.com
State Accepted
Commit 528c7d02c78bc78aab40ed843129418dc2d44250
Headers show
Series
  • Stop using input_polled_dev in polling drivers
Related show

Commit Message

Dmitry Torokhov Oct. 17, 2019, 8:42 p.m. UTC
Using devm API allows us to clean up error handling paths and drop the
remove() method.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---

 drivers/input/misc/rb532_button.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

Patch
diff mbox series

diff --git a/drivers/input/misc/rb532_button.c b/drivers/input/misc/rb532_button.c
index 4412055f8761..3c43024f4527 100644
--- a/drivers/input/misc/rb532_button.c
+++ b/drivers/input/misc/rb532_button.c
@@ -58,7 +58,7 @@  static int rb532_button_probe(struct platform_device *pdev)
 	struct input_polled_dev *poll_dev;
 	int error;
 
-	poll_dev = input_allocate_polled_device();
+	poll_dev = devm_input_allocate_polled_device(&pdev->dev);
 	if (!poll_dev)
 		return -ENOMEM;
 
@@ -68,34 +68,18 @@  static int rb532_button_probe(struct platform_device *pdev)
 	poll_dev->input->name = "rb532 button";
 	poll_dev->input->phys = "rb532/button0";
 	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);
 
 	error = input_register_polled_device(poll_dev);
-	if (error) {
-		input_free_polled_device(poll_dev);
+	if (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;
 }
 
 static struct platform_driver rb532_button_driver = {
 	.probe = rb532_button_probe,
-	.remove = rb532_button_remove,
 	.driver = {
 		.name = DRV_NAME,
 	},