generic runtime pm callbacks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux