summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/cpuidle/cpuidle-psci.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
index ee35ac816321..40f378c1dc9f 100644
--- a/drivers/cpuidle/cpuidle-psci.c
+++ b/drivers/cpuidle/cpuidle-psci.c
@@ -438,10 +438,29 @@ static struct faux_device_ops psci_cpuidle_ops = {
.probe = psci_cpuidle_probe,
};
+static bool __init dt_idle_state_present(void)
+{
+ struct device_node *cpu_node __free(device_node);
+ struct device_node *state_node __free(device_node);
+
+ cpu_node = of_cpu_device_node_get(cpumask_first(cpu_possible_mask));
+ if (!cpu_node)
+ return false;
+
+ state_node = of_get_cpu_state_node(cpu_node, 0);
+ if (!state_node)
+ return false;
+
+ return !!of_match_node(psci_idle_state_match, state_node);
+}
+
static int __init psci_idle_init(void)
{
struct faux_device *fdev;
+ if (!dt_idle_state_present())
+ return 0;
+
fdev = faux_device_create("psci-cpuidle", NULL, &psci_cpuidle_ops);
if (!fdev) {
pr_err("Failed to create psci-cpuidle device\n");