Commit 4b31db8a16fa0d4d6a0fa42d044e7a4f4dad3641

Authored by Rafael J. Wysocki
1 parent 5c1a07ab3e

PM / Runtime: Generic resume shouldn't set RPM_ACTIVE unconditionally

The __pm_generic_resume() function changes the given device's runtime
PM status to RPM_ACTIVE if its driver's callback returns 0, but it
only should do that if the rumtime PM is enabled for the device.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Showing 2 changed files with 7 additions and 1 deletions Side-by-side Diff

drivers/base/power/generic_ops.c
... ... @@ -185,7 +185,7 @@
185 185 return 0;
186 186  
187 187 ret = callback(dev);
188   - if (!ret) {
  188 + if (!ret && pm_runtime_enabled(dev)) {
189 189 pm_runtime_disable(dev);
190 190 pm_runtime_set_active(dev);
191 191 pm_runtime_enable(dev);
include/linux/pm_runtime.h
... ... @@ -82,6 +82,11 @@
82 82 && !dev->power.disable_depth;
83 83 }
84 84  
  85 +static inline bool pm_runtime_enabled(struct device *dev)
  86 +{
  87 + return !dev->power.disable_depth;
  88 +}
  89 +
85 90 static inline void pm_runtime_mark_last_busy(struct device *dev)
86 91 {
87 92 ACCESS_ONCE(dev->power.last_busy) = jiffies;
... ... @@ -120,6 +125,7 @@
120 125 static inline bool device_run_wake(struct device *dev) { return false; }
121 126 static inline void device_set_run_wake(struct device *dev, bool enable) {}
122 127 static inline bool pm_runtime_suspended(struct device *dev) { return false; }
  128 +static inline bool pm_runtime_enabled(struct device *dev) { return false; }
123 129  
124 130 static inline int pm_generic_runtime_idle(struct device *dev) { return 0; }
125 131 static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }