]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Input: samsung-keypad - use devm to disable runtime PM
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 24 Jul 2024 21:23:16 +0000 (14:23 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 1 Jul 2025 21:30:34 +0000 (14:30 -0700)
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/20240819045813.2154642-6-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/keyboard/samsung-keypad.c

index e3a1b0db7ec8019b3893565858d7c7e8178a9bd0..d8eda10d63ee2b6cacfb64f038da6b1231614c18 100644 (file)
@@ -420,11 +420,14 @@ static int samsung_keypad_probe(struct platform_device *pdev)
 
        device_init_wakeup(&pdev->dev, pdata->wakeup);
        platform_set_drvdata(pdev, keypad);
-       pm_runtime_enable(&pdev->dev);
+
+       error = devm_pm_runtime_enable(&pdev->dev);
+       if (error)
+               return error;
 
        error = input_register_device(keypad->input_dev);
        if (error)
-               goto err_disable_runtime_pm;
+               return error;
 
        if (pdev->dev.of_node) {
                devm_kfree(&pdev->dev, (void *)pdata->keymap_data->keymap);
@@ -432,15 +435,6 @@ static int samsung_keypad_probe(struct platform_device *pdev)
                devm_kfree(&pdev->dev, (void *)pdata);
        }
        return 0;
-
-err_disable_runtime_pm:
-       pm_runtime_disable(&pdev->dev);
-       return error;
-}
-
-static void samsung_keypad_remove(struct platform_device *pdev)
-{
-       pm_runtime_disable(&pdev->dev);
 }
 
 static int samsung_keypad_runtime_suspend(struct device *dev)
@@ -575,7 +569,6 @@ MODULE_DEVICE_TABLE(platform, samsung_keypad_driver_ids);
 
 static struct platform_driver samsung_keypad_driver = {
        .probe          = samsung_keypad_probe,
-       .remove         = samsung_keypad_remove,
        .driver         = {
                .name   = "samsung-keypad",
                .of_match_table = of_match_ptr(samsung_keypad_dt_match),