power management: implement pm_ops.valid for everybody
[firefly-linux-kernel-4.4.55.git] / kernel / power / main.c
index 053c0a7d7f5754095866e4e31236816d667a0eee..f94f4e20115a665ae8cb20c3f6a7f0c4c0c9cd0e 100644 (file)
@@ -48,6 +48,19 @@ void pm_set_ops(struct pm_ops * ops)
        mutex_unlock(&pm_mutex);
 }
 
+/**
+ * pm_valid_only_mem - generic memory-only valid callback
+ *
+ * pm_ops drivers that implement mem suspend only and only need
+ * to check for that in their .valid callback can use this instead
+ * of rolling their own .valid callback.
+ */
+int pm_valid_only_mem(suspend_state_t state)
+{
+       return state == PM_SUSPEND_MEM;
+}
+
+
 static inline void pm_finish(suspend_state_t state)
 {
        if (pm_ops->finish)