dmaengine: shdmac: extend PM methods
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Tue, 20 Jan 2015 21:13:21 +0000 (00:13 +0300)
committerVinod Koul <vinod.koul@intel.com>
Thu, 12 Feb 2015 07:22:18 +0000 (12:52 +0530)
In order to make it possible to restore from hibernation not only in Linux but
also in e.g. U-Boot, we have to use sh_dmae_{suspend|resume}() for the {freeze|
thaw|restore}() PM methods. It's handy to achieve this with SIMPLE_DEV_PM_OPS()
macro; since  that macro doesn't do anything when CONFIG_PM_SLEEP  is undefined,
we don't need to #define sh_dmae_{suspend|resume} NULL anymore but we'll have to
enclose sh_dmae_{suspend|resume}() into the new #ifdef...

Based on original patch by Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/sh/shdmac.c

index 023344f7f78ee620aa96dc4be5d88c328d1ad138..b2431aa300331270fa949ea5c14c41602a6c8e69 100644 (file)
@@ -600,7 +600,9 @@ static int sh_dmae_runtime_resume(struct device *dev)
 
        return sh_dmae_rst(shdev);
 }
+#endif
 
+#ifdef CONFIG_PM_SLEEP
 static int sh_dmae_suspend(struct device *dev)
 {
        return 0;
@@ -632,14 +634,10 @@ static int sh_dmae_resume(struct device *dev)
 
        return 0;
 }
-#else
-#define sh_dmae_suspend NULL
-#define sh_dmae_resume NULL
 #endif
 
 static const struct dev_pm_ops sh_dmae_pm = {
-       .suspend                = sh_dmae_suspend,
-       .resume                 = sh_dmae_resume,
+       SET_SYSTEM_SLEEP_PM_OPS(sh_dmae_suspend, sh_dmae_resume)
        SET_RUNTIME_PM_OPS(sh_dmae_runtime_suspend, sh_dmae_runtime_resume,
                           NULL)
 };