Skip to content

Commit 5658439

Browse files
committed
Input: samsung-keypad - use devm to disable runtime PM
To make sure that runtime PM is disabled at the right time compared to all other devm-managed resources use devm_pm_runtime_enable(). Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 647fc2b commit 5658439

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

drivers/input/keyboard/samsung-keypad.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -420,27 +420,21 @@ static int samsung_keypad_probe(struct platform_device *pdev)
420420

421421
device_init_wakeup(&pdev->dev, pdata->wakeup);
422422
platform_set_drvdata(pdev, keypad);
423-
pm_runtime_enable(&pdev->dev);
423+
424+
error = devm_pm_runtime_enable(&pdev->dev);
425+
if (error)
426+
return error;
424427

425428
error = input_register_device(keypad->input_dev);
426429
if (error)
427-
goto err_disable_runtime_pm;
430+
return error;
428431

429432
if (pdev->dev.of_node) {
430433
devm_kfree(&pdev->dev, (void *)pdata->keymap_data->keymap);
431434
devm_kfree(&pdev->dev, (void *)pdata->keymap_data);
432435
devm_kfree(&pdev->dev, (void *)pdata);
433436
}
434437
return 0;
435-
436-
err_disable_runtime_pm:
437-
pm_runtime_disable(&pdev->dev);
438-
return error;
439-
}
440-
441-
static void samsung_keypad_remove(struct platform_device *pdev)
442-
{
443-
pm_runtime_disable(&pdev->dev);
444438
}
445439

446440
static int samsung_keypad_runtime_suspend(struct device *dev)
@@ -575,7 +569,6 @@ MODULE_DEVICE_TABLE(platform, samsung_keypad_driver_ids);
575569

576570
static struct platform_driver samsung_keypad_driver = {
577571
.probe = samsung_keypad_probe,
578-
.remove = samsung_keypad_remove,
579572
.driver = {
580573
.name = "samsung-keypad",
581574
.of_match_table = of_match_ptr(samsung_keypad_dt_match),

0 commit comments

Comments
 (0)