[COMMON] cpufreq: acme: add online check about domain cpus.
authorSoohyun Kim <soohyuni.kim@samsung.com>
Tue, 27 Mar 2018 15:09:33 +0000 (00:09 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:33:06 +0000 (17:33 +0900)
Change-Id: Id7fc67da1f4c0500dac03f944e061a2844fc479f
Signed-off-by: Soohyun Kim <soohyuni.kim@samsung.com>
drivers/cpufreq/exynos-acme.c

index c65985026e154fe38fba3c16018e52d9c6978dfd..a8ef02ecb0bc8bdd0132d6c30002ee4c7f9ff256 100644 (file)
@@ -613,6 +613,8 @@ static int exynos_cpufreq_pm_qos_callback(struct notifier_block *nb,
 {
        int pm_qos_class = *((int *)v);
        struct exynos_cpufreq_domain *domain;
+       struct cpufreq_policy *policy;
+       struct cpumask mask;
        int ret;
 
        pr_debug("update PM QoS class %d to %ld kHz\n", pm_qos_class, val);
@@ -621,6 +623,14 @@ static int exynos_cpufreq_pm_qos_callback(struct notifier_block *nb,
        if (!domain)
                return NOTIFY_BAD;
 
+       cpumask_and(&mask, &domain->cpus, cpu_online_mask);
+       if (cpumask_empty(&mask))
+               return NOTIFY_BAD;
+
+       policy = cpufreq_cpu_get(cpumask_first(&mask));
+       if (!policy)
+               return NOTIFY_BAD;
+
        update_dm_constraint(domain, NULL);
 
        ret = need_update_freq(domain, pm_qos_class, val);