[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-backports
Subject:    [PATCH] backport: add pm_runtime_active() implementation for < 3.9 kernels
From:       Luca Coelho <luca () coelho ! fi>
Date:       2016-04-19 19:13:11
Message-ID: 1461093191-461-1-git-send-email-luca () coelho ! fi
[Download RAW message or body]

From: Luca Coelho <luciano.coelho@intel.com>

The pm_runtime_active() helper function was introduced in kernel 3.9.
In order to use it in earlier kernels, we need to add its
implementation to the backports.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 backport/backport-include/linux/pm_runtime.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 backport/backport-include/linux/pm_runtime.h

diff --git a/backport/backport-include/linux/pm_runtime.h b/backport/backport-include/linux/pm_runtime.h
new file mode 100644
index 0000000..bc0b109
--- /dev/null
+++ b/backport/backport-include/linux/pm_runtime.h
@@ -0,0 +1,19 @@
+#ifndef __BACKPORT_PM_RUNTIME_H
+#define __BACKPORT_PM_RUNTIME_H
+#include_next <linux/pm_runtime.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
+
+#ifdef CONFIG_PM
+static inline bool pm_runtime_active(struct device *dev)
+{
+	return dev->power.runtime_status == RPM_ACTIVE
+		|| dev->power.disable_depth;
+}
+#else
+static inline bool pm_runtime_active(struct device *dev) { return true; }
+#endif /* CONFIG_PM */
+
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) */
+
+#endif /* __BACKPORT_PM_RUNTIME_H */
-- 
2.8.0.rc3

--
To unsubscribe from this list: send the line "unsubscribe backports" in
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic