PM / Runtime: Convert pm_runtime_set_suspended() to return an int
authorUlf Hansson <ulf.hansson@linaro.org>
Mon, 17 Oct 2016 18:17:00 +0000 (20:17 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 21 Oct 2016 13:42:11 +0000 (15:42 +0200)
Because pm_runtime_set_suspended() invokes __pm_runtime_set_status(), which
can fail, pm_runtime_set_suspended() can also fail.

Instead of hiding a potential error, let's propagate it by converting
pm_runtime_set_suspended() from a void to return an int. In this way users
are able to check the error code and act accordingly.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
include/linux/pm_runtime.h

index 61ea5666c94c33f2532f7bc066ee4dbc074fb243..4957fc185ea99948a350fd3c56da4f901e0599d3 100644 (file)
@@ -258,9 +258,9 @@ static inline int pm_runtime_set_active(struct device *dev)
        return __pm_runtime_set_status(dev, RPM_ACTIVE);
 }
 
-static inline void pm_runtime_set_suspended(struct device *dev)
+static inline int pm_runtime_set_suspended(struct device *dev)
 {
-       __pm_runtime_set_status(dev, RPM_SUSPENDED);
+       return __pm_runtime_set_status(dev, RPM_SUSPENDED);
 }
 
 static inline void pm_runtime_disable(struct device *dev)