Merge tag 'v5.1' into next
[sfrench/cifs-2.6.git] / drivers / input / keyboard / snvs_pwrkey.c
index effb63205d3d7783e8e4e598407332892ef6aae2..5342d8d45f811b399bb740ec4a0158d50c502c44 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
 
@@ -148,6 +149,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
                return error;
        }
 
+       pdata->input = input;
+       platform_set_drvdata(pdev, pdata);
+
        error = devm_request_irq(&pdev->dev, pdata->irq,
                               imx_snvs_pwrkey_interrupt,
                               0, pdev->name, pdev);
@@ -163,32 +167,10 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
                return error;
        }
 
-       pdata->input = input;
-       platform_set_drvdata(pdev, pdata);
-
        device_init_wakeup(&pdev->dev, pdata->wakeup);
-
-       return 0;
-}
-
-static int __maybe_unused imx_snvs_pwrkey_suspend(struct device *dev)
-{
-       struct platform_device *pdev = to_platform_device(dev);
-       struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
-
-       if (device_may_wakeup(&pdev->dev))
-               enable_irq_wake(pdata->irq);
-
-       return 0;
-}
-
-static int __maybe_unused imx_snvs_pwrkey_resume(struct device *dev)
-{
-       struct platform_device *pdev = to_platform_device(dev);
-       struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev);
-
-       if (device_may_wakeup(&pdev->dev))
-               disable_irq_wake(pdata->irq);
+       error = dev_pm_set_wake_irq(&pdev->dev, pdata->irq);
+       if (error)
+               dev_err(&pdev->dev, "irq wake enable failed.\n");
 
        return 0;
 }
@@ -199,13 +181,9 @@ static const struct of_device_id imx_snvs_pwrkey_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, imx_snvs_pwrkey_ids);
 
-static SIMPLE_DEV_PM_OPS(imx_snvs_pwrkey_pm_ops, imx_snvs_pwrkey_suspend,
-                               imx_snvs_pwrkey_resume);
-
 static struct platform_driver imx_snvs_pwrkey_driver = {
        .driver = {
                .name = "snvs_pwrkey",
-               .pm     = &imx_snvs_pwrkey_pm_ops,
                .of_match_table = imx_snvs_pwrkey_ids,
        },
        .probe = imx_snvs_pwrkey_probe,