public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sh: allow runtime pm without suspend/resume callbacks
@ 2009-12-03 12:31 Magnus Damm
  2009-12-03 13:08 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Magnus Damm @ 2009-12-03 12:31 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@opensource.se>

This patch updates the Runtime PM code for SuperH Mobile
to allow drivers to have NULL as pm or callback value.
With this in place there is no need for no-op functions.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 arch/sh/kernel/cpu/shmobile/pm_runtime.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

--- 0001/arch/sh/kernel/cpu/shmobile/pm_runtime.c
+++ work/arch/sh/kernel/cpu/shmobile/pm_runtime.c	2009-12-02 12:17:25.000000000 +0900
@@ -45,12 +45,14 @@ static int __platform_pm_runtime_resume(
 
 	dev_dbg(d, "__platform_pm_runtime_resume() [%d]\n", hwblk);
 
-	if (d->driver && d->driver->pm && d->driver->pm->runtime_resume) {
+	if (d->driver) {
 		hwblk_enable(hwblk_info, hwblk);
 		ret = 0;
 
 		if (test_bit(PDEV_ARCHDATA_FLAG_SUSP, &ad->flags)) {
-			ret = d->driver->pm->runtime_resume(d);
+			if (d->driver->pm && d->driver->pm->runtime_resume)
+				ret = d->driver->pm->runtime_resume(d);
+
 			if (!ret)
 				clear_bit(PDEV_ARCHDATA_FLAG_SUSP, &ad->flags);
 			else
@@ -73,12 +75,15 @@ static int __platform_pm_runtime_suspend
 
 	dev_dbg(d, "__platform_pm_runtime_suspend() [%d]\n", hwblk);
 
-	if (d->driver && d->driver->pm && d->driver->pm->runtime_suspend) {
+	if (d->driver) {
 		BUG_ON(!test_bit(PDEV_ARCHDATA_FLAG_IDLE, &ad->flags));
+		ret = 0;
 
-		hwblk_enable(hwblk_info, hwblk);
-		ret = d->driver->pm->runtime_suspend(d);
-		hwblk_disable(hwblk_info, hwblk);
+		if (d->driver->pm && d->driver->pm->runtime_suspend) {
+			hwblk_enable(hwblk_info, hwblk);
+			ret = d->driver->pm->runtime_suspend(d);
+			hwblk_disable(hwblk_info, hwblk);
+		}
 
 		if (!ret) {
 			set_bit(PDEV_ARCHDATA_FLAG_SUSP, &ad->flags);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] sh: allow runtime pm without suspend/resume callbacks
  2009-12-03 12:31 [PATCH] sh: allow runtime pm without suspend/resume callbacks Magnus Damm
@ 2009-12-03 13:08 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2009-12-03 13:08 UTC (permalink / raw)
  To: linux-sh

On Thu, Dec 03, 2009 at 09:31:45PM +0900, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
> 
> This patch updates the Runtime PM code for SuperH Mobile
> to allow drivers to have NULL as pm or callback value.
> With this in place there is no need for no-op functions.

Thanks for doing this.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-03 13:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-03 12:31 [PATCH] sh: allow runtime pm without suspend/resume callbacks Magnus Damm
2009-12-03 13:08 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox