Skip to content

Commit

Permalink
dmaengine: shdmac: extend PM methods
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sergei Shtylyov authored and Vinod Koul committed Feb 12, 2015
1 parent 82bf90c commit bf44a41
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/dma/sh/shdmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
};
Expand Down

0 comments on commit bf44a41

Please sign in to comment.