From: Saravana Kannan <skannan@codeaurora.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Viresh Kumar <viresh.kumar@linaro.org>
Cc: Saravana Kannan <skannan@codeaurora.org>,
Rajendra Nayak <rjendra@codeaurora.org>,
Amit Kucheria <amit.kucheria@linaro.org>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] Revert "cpufreq: Remove policy create/remove notifiers"
Date: Fri, 18 May 2018 01:24:47 -0700 [thread overview]
Message-ID: <1526631889-5084-2-git-send-email-skannan@codeaurora.org> (raw)
In-Reply-To: <1526631889-5084-1-git-send-email-skannan@codeaurora.org>
This reverts commit f9f41e3ef99ac9d4e91b07634362e393fb929aad.
Change-Id: Iddde3ef56c9e5b14dcb14f8737899b85e56f5b43
---
drivers/cpufreq/cpufreq.c | 16 +++++++++++-----
include/linux/cpufreq.h | 3 +++
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 075d18f..f790686 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1129,11 +1129,15 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
return NULL;
}
-static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy)
+static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy, bool notify)
{
struct kobject *kobj;
struct completion *cmp;
+ if (notify)
+ blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
+ CPUFREQ_REMOVE_POLICY, policy);
+
down_write(&policy->rwsem);
cpufreq_stats_free_table(policy);
kobj = &policy->kobj;
@@ -1151,7 +1155,7 @@ static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy)
pr_debug("wait complete\n");
}
-static void cpufreq_policy_free(struct cpufreq_policy *policy)
+static void cpufreq_policy_free(struct cpufreq_policy *policy, bool notify)
{
unsigned long flags;
int cpu;
@@ -1164,7 +1168,7 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy)
per_cpu(cpufreq_cpu_data, cpu) = NULL;
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
- cpufreq_policy_put_kobj(policy);
+ cpufreq_policy_put_kobj(policy, notify);
free_cpumask_var(policy->real_cpus);
free_cpumask_var(policy->related_cpus);
free_cpumask_var(policy->cpus);
@@ -1296,6 +1300,8 @@ static int cpufreq_online(unsigned int cpu)
goto out_destroy_policy;
cpufreq_stats_create_table(policy);
+ blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
+ CPUFREQ_CREATE_POLICY, policy);
write_lock_irqsave(&cpufreq_driver_lock, flags);
list_add(&policy->policy_list, &cpufreq_policy_list);
@@ -1334,7 +1340,7 @@ static int cpufreq_online(unsigned int cpu)
cpufreq_driver->exit(policy);
out_free_policy:
- cpufreq_policy_free(policy);
+ cpufreq_policy_free(policy, !new_policy);
return ret;
}
@@ -1447,7 +1453,7 @@ static void cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
remove_cpu_dev_symlink(policy, dev);
if (cpumask_empty(policy->real_cpus))
- cpufreq_policy_free(policy);
+ cpufreq_policy_free(policy, true);
}
/**
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 87f48dd..b6209b3 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -437,6 +437,9 @@ static inline void cpufreq_resume(void) {}
/* Policy Notifiers */
#define CPUFREQ_ADJUST (0)
#define CPUFREQ_NOTIFY (1)
+#define CPUFREQ_START (2)
+#define CPUFREQ_CREATE_POLICY (3)
+#define CPUFREQ_REMOVE_POLICY (4)
#ifdef CONFIG_CPU_FREQ
int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2018-05-18 8:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-18 8:24 [PATCH 0/2] Adding support for scaling cache/memory based on CPU frequency Saravana Kannan
2018-05-18 8:24 ` Saravana Kannan [this message]
2018-05-18 8:29 ` [PATCH 1/2] Revert "cpufreq: Remove policy create/remove notifiers" Rafael J. Wysocki
2018-05-18 8:31 ` skannan
2018-05-18 8:33 ` Rafael J. Wysocki
2018-05-18 8:47 ` skannan
2018-05-18 8:59 ` Rafael J. Wysocki
2018-05-18 8:24 ` [PATCH 2/2] PM / devfreq: Generic cpufreq governor Saravana Kannan
2018-05-23 16:58 ` Rob Herring
2018-05-28 6:00 ` MyungJoo Ham
2018-06-05 23:26 ` Saravana Kannan
2018-05-31 21:53 ` Saravana Kannan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1526631889-5084-2-git-send-email-skannan@codeaurora.org \
--to=skannan@codeaurora.org \
--cc=amit.kucheria@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjendra@codeaurora.org \
--cc=rjw@rjwysocki.net \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox