arm64: dts: rockchip: enable pcie_phy for Sapphire board
[firefly-linux-kernel-4.4.55.git] / drivers / cpuidle / dt_idle_states.c
index 52f4d11bbf3f697e8466b82c6667e27e3e04c213..a5c111b67f377e2a1b8e008c9fa09a92bfcea051 100644 (file)
@@ -27,6 +27,7 @@ static int init_state_node(struct cpuidle_state *idle_state,
 {
        int err;
        const struct of_device_id *match_id;
+       const char *desc;
 
        match_id = of_match_node(matches, state_node);
        if (!match_id)
@@ -73,7 +74,11 @@ static int init_state_node(struct cpuidle_state *idle_state,
                return -EINVAL;
        }
 
-       idle_state->flags = CPUIDLE_FLAG_TIME_VALID;
+       err = of_property_read_string(state_node, "idle-state-name", &desc);
+       if (err)
+               desc = state_node->name;
+
+       idle_state->flags = 0;
        if (of_property_read_bool(state_node, "local-timer-stop"))
                idle_state->flags |= CPUIDLE_FLAG_TIMER_STOP;
        /*
@@ -82,7 +87,7 @@ static int init_state_node(struct cpuidle_state *idle_state,
         *      and desc become string pointers
         */
        strncpy(idle_state->name, state_node->name, CPUIDLE_NAME_LEN - 1);
-       strncpy(idle_state->desc, state_node->name, CPUIDLE_DESC_LEN - 1);
+       strncpy(idle_state->desc, desc, CPUIDLE_DESC_LEN - 1);
        return 0;
 }
 
@@ -169,6 +174,9 @@ int dt_init_idle_driver(struct cpuidle_driver *drv,
                if (!state_node)
                        break;
 
+               if (!of_device_is_available(state_node))
+                       continue;
+
                if (!idle_state_valid(state_node, i, cpumask)) {
                        pr_warn("%s idle state not valid, bailing out\n",
                                state_node->full_name);