public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* generic runtime pm callbacks
@ 2010-09-06 12:32 Ohad Ben-Cohen
  2010-09-06 13:22 ` [linux-pm] " Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Ohad Ben-Cohen @ 2010-09-06 12:32 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-mmc

I'm adding Runtime PM support to the SDIO subsystem, and was planning
to use the generic runtime pm handlers.

Those handlers return -EINVAL if the driver didn't explicitly define
the runtime pm handlers:

That may result in some drivers defining nop handlers, just to return
0 (in case there's nothing else they need to do).

Do we want that ?

Alternatively, we may want to allow drivers to enable Runtime PM (by
taking the appropriate action for their subsystem, e.g. calling
put_noidle in probe and get_noresume in remove), but still not define
any runtime pm handlers (implicitly always returning a success), with
something like:

diff --git a/drivers/base/power/generic_ops.c b/drivers/base/power/generic_ops.
index 304c831..531762a 100644
--- a/drivers/base/power/generic_ops.c
+++ b/drivers/base/power/generic_ops.c
@@ -49,7 +49,7 @@ int pm_generic_runtime_suspend(struct device *dev)
       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
       int ret;

-       ret = pm && pm->runtime_suspend ? pm->runtime_suspend(dev) : -EINVAL;
+       ret = pm && pm->runtime_suspend ? pm->runtime_suspend(dev) : 0;

       return ret;
 }
@@ -68,7 +68,7 @@ int pm_generic_runtime_resume(struct device *dev)
       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
       int ret;

-       ret = pm && pm->runtime_resume ? pm->runtime_resume(dev) : -EINVAL;
+       ret = pm && pm->runtime_resume ? pm->runtime_resume(dev) : 0;

       return ret;
 }

What do you think ?

Please note that the generic pm_generic_runtime_idle handler does
allow drivers not to explicitly define a runtime_idle handler.

Thanks,
Ohad.

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

end of thread, other threads:[~2010-09-06 19:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-06 12:32 generic runtime pm callbacks Ohad Ben-Cohen
2010-09-06 13:22 ` [linux-pm] " Mark Brown
2010-09-06 14:30   ` Alan Stern
2010-09-06 14:59     ` Mark Brown
2010-09-06 19:07   ` Rafael J. Wysocki

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