]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.16.3/powerpc-cpuidle-fix-parsing-of-idle-state-flags-from-device-tree.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.16.3 / powerpc-cpuidle-fix-parsing-of-idle-state-flags-from-device-tree.patch
1 From 95707d852856aec1cbdad1873ff2dc5161a5cb91 Mon Sep 17 00:00:00 2001
2 From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
3 Date: Sun, 3 Aug 2014 13:23:08 +0530
4 Subject: powerpc/cpuidle: Fix parsing of idle state flags from device-tree
5
6 From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
7
8 commit 95707d852856aec1cbdad1873ff2dc5161a5cb91 upstream.
9
10 Flags from device-tree need to be parsed with accessors for
11 interpreting correct value in little-endian.
12
13 Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
14 Reviewed-by: Preeti U. Murthy <preeti@linux.vnet.ibm.com>
15 Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17
18 ---
19 drivers/cpuidle/cpuidle-powernv.c | 16 ++++++++--------
20 1 file changed, 8 insertions(+), 8 deletions(-)
21
22 --- a/drivers/cpuidle/cpuidle-powernv.c
23 +++ b/drivers/cpuidle/cpuidle-powernv.c
24 @@ -160,10 +160,10 @@ static int powernv_cpuidle_driver_init(v
25 static int powernv_add_idle_states(void)
26 {
27 struct device_node *power_mgt;
28 - struct property *prop;
29 int nr_idle_states = 1; /* Snooze */
30 int dt_idle_states;
31 - u32 *flags;
32 + const __be32 *idle_state_flags;
33 + u32 len_flags, flags;
34 int i;
35
36 /* Currently we have snooze statically defined */
37 @@ -174,18 +174,18 @@ static int powernv_add_idle_states(void)
38 return nr_idle_states;
39 }
40
41 - prop = of_find_property(power_mgt, "ibm,cpu-idle-state-flags", NULL);
42 - if (!prop) {
43 + idle_state_flags = of_get_property(power_mgt, "ibm,cpu-idle-state-flags", &len_flags);
44 + if (!idle_state_flags) {
45 pr_warn("DT-PowerMgmt: missing ibm,cpu-idle-state-flags\n");
46 return nr_idle_states;
47 }
48
49 - dt_idle_states = prop->length / sizeof(u32);
50 - flags = (u32 *) prop->value;
51 + dt_idle_states = len_flags / sizeof(u32);
52
53 for (i = 0; i < dt_idle_states; i++) {
54
55 - if (flags[i] & IDLE_USE_INST_NAP) {
56 + flags = be32_to_cpu(idle_state_flags[i]);
57 + if (flags & IDLE_USE_INST_NAP) {
58 /* Add NAP state */
59 strcpy(powernv_states[nr_idle_states].name, "Nap");
60 strcpy(powernv_states[nr_idle_states].desc, "Nap");
61 @@ -196,7 +196,7 @@ static int powernv_add_idle_states(void)
62 nr_idle_states++;
63 }
64
65 - if (flags[i] & IDLE_USE_INST_SLEEP) {
66 + if (flags & IDLE_USE_INST_SLEEP) {
67 /* Add FASTSLEEP state */
68 strcpy(powernv_states[nr_idle_states].name, "FastSleep");
69 strcpy(powernv_states[nr_idle_states].desc, "FastSleep");