[RFC 3/6] cpuidle: Add device_node pointer in cpuidle_state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Store a pointer in the cpuidle_state structure to the Device Tree node
from which that state originated, if such a node exists.

This will allow plaform-specific components to extract extra idle state
information without duplicating the logic that finds the idle state
nodes.
---
 drivers/cpuidle/dt_idle_states.c |  3 +++
 include/linux/cpuidle.h          | 18 ++++++++++--------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c
index a5c111b..61a70ec 100644
--- a/drivers/cpuidle/dt_idle_states.c
+++ b/drivers/cpuidle/dt_idle_states.c
@@ -88,6 +88,9 @@ static int init_state_node(struct cpuidle_state *idle_state,
 	 */
 	strncpy(idle_state->name, state_node->name, CPUIDLE_NAME_LEN - 1);
 	strncpy(idle_state->desc, desc, CPUIDLE_DESC_LEN - 1);
+
+	idle_state->of_node = state_node;
+
 	return 0;
 }
 
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 8435577..d4ea1e4 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -14,6 +14,7 @@
 #include <linux/percpu.h>
 #include <linux/list.h>
 #include <linux/hrtimer.h>
+#include <linux/of.h>
 
 #define CPUIDLE_STATE_MAX	10
 #define CPUIDLE_NAME_LEN	16
@@ -36,14 +37,15 @@ struct cpuidle_state_usage {
 };
 
 struct cpuidle_state {
-	char		name[CPUIDLE_NAME_LEN];
-	char		desc[CPUIDLE_DESC_LEN];
-
-	unsigned int	flags;
-	unsigned int	exit_latency; /* in US */
-	int		power_usage; /* in mW */
-	unsigned int	target_residency; /* in US */
-	bool		disabled; /* disabled on all CPUs */
+	char			name[CPUIDLE_NAME_LEN];
+	char			desc[CPUIDLE_DESC_LEN];
+
+	unsigned int		flags;
+	unsigned int		exit_latency; /* in US */
+	int			power_usage; /* in mW */
+	unsigned int		target_residency; /* in US */
+	bool			disabled; /* disabled on all CPUs */
+	struct device_node	*of_node;
 
 	int (*enter)	(struct cpuidle_device *dev,
 			struct cpuidle_driver *drv,
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux