From: Ohad Ben-Cohen Date: Wed, 8 Sep 2010 22:46:16 +0000 (+0200) Subject: PM / Runtime: Lenient generic runtime pm callbacks X-Git-Tag: v2.6.37-rc1~185^2~25 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=05aa55dddb9ee4045c320661068bea78dad6a6e5;p=karo-tx-linux.git PM / Runtime: Lenient generic runtime pm callbacks Allow drivers, that belong to subsystems which use the generic runtime pm callbacks, not to define runtime pm suspend/resume handlers, by implicitly assuming success in such cases. This is needed to eliminate nop handlers that would otherwise be necessary by drivers which enable runtime pm, but don't need to do anything when their devices are runtime-suspended/resumed. Signed-off-by: Ohad Ben-Cohen Acked-by: Kevin Hilman Acked-by: Mark Brown Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/base/power/generic_ops.c b/drivers/base/power/generic_ops.c index 4b29d4981253..81f2c84697f4 100644 --- a/drivers/base/power/generic_ops.c +++ b/drivers/base/power/generic_ops.c @@ -46,7 +46,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; } @@ -65,7 +65,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; }