video: tegra: nvavp: use dev_pm_ops
Mayuresh Kulkarni [Tue, 12 Feb 2013 09:25:16 +0000 (14:25 +0530)]
- this commit replaces the legacy suspend/resume calls
with the dev_pm_ops call-backs
- dev_pm_ops has many other call-backs related to
runtime pm and pm domains along with system
suspend/resume call-backs

Change-Id: I24d691672b3d9804a42561d8f7b78b99646a2f42
Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-on: http://git-master/r/199937
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Gajanan Bhat <gbhat@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/media/video/tegra/nvavp/nvavp_dev.c

index 5155c5a..9fba661 100644 (file)
@@ -1879,9 +1879,10 @@ static int tegra_nvavp_remove(struct platform_device *ndev)
 }
 
 #ifdef CONFIG_PM
-static int tegra_nvavp_suspend(struct platform_device *ndev, pm_message_t state)
+static int tegra_nvavp_suspend(struct device *dev)
 {
-       struct nvavp_info *nvavp = platform_get_drvdata(ndev);
+       struct platform_device *pdev = to_platform_device(dev);
+       struct nvavp_info *nvavp = platform_get_drvdata(pdev);
        int ret = 0;
 
        mutex_lock(&nvavp->open_lock);
@@ -1911,9 +1912,10 @@ static int tegra_nvavp_suspend(struct platform_device *ndev, pm_message_t state)
        return ret;
 }
 
-static int tegra_nvavp_resume(struct platform_device *ndev)
+static int tegra_nvavp_resume(struct device *dev)
 {
-       struct nvavp_info *nvavp = platform_get_drvdata(ndev);
+       struct platform_device *pdev = to_platform_device(dev);
+       struct nvavp_info *nvavp = platform_get_drvdata(pdev);
 
        mutex_lock(&nvavp->open_lock);
 
@@ -1927,19 +1929,28 @@ static int tegra_nvavp_resume(struct platform_device *ndev)
 
        return 0;
 }
-#endif
+
+static const struct dev_pm_ops nvavp_pm_ops = {
+       .suspend = tegra_nvavp_suspend,
+       .resume = tegra_nvavp_resume,
+};
+
+#define NVAVP_PM_OPS   (&nvavp_pm_ops)
+
+#else /* CONFIG_PM */
+
+#define NVAVP_PM_OPS   NULL
+
+#endif /* CONFIG_PM */
 
 static struct platform_driver tegra_nvavp_driver = {
        .driver = {
                .name   = TEGRA_NVAVP_NAME,
                .owner  = THIS_MODULE,
+               .pm     = NVAVP_PM_OPS,
        },
        .probe          = tegra_nvavp_probe,
        .remove         = tegra_nvavp_remove,
-#ifdef CONFIG_PM
-       .suspend        = tegra_nvavp_suspend,
-       .resume         = tegra_nvavp_resume,
-#endif
 };
 
 static int __init tegra_nvavp_init(void)