[PATCH 4.4.y-cip 02/11] PM / OPP: Expose _of_get_opp_desc_node as dev_pm_opp API


Chen-Yu Tsai (Moxa) <wens@...>
 

From: Dave Gerlach <d-gerlach@ti.com>

commit 0764c604c8128f17fd740ff8b1701d0a1301eb7e upstream.

Rename _of_get_opp_desc_node to dev_pm_opp_of_get_opp_desc_node and add i=
t
to include/linux/pm_opp.h to allow other drivers, such as platform OPP
and cpufreq drivers, to make use of it.

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[wens@csie.org: backported to pre-OF-move files]
Signed-off-by: Chen-Yu Tsai (Moxa) <wens@csie.org>
---
drivers/base/power/opp/core.c | 5 +++--
drivers/base/power/opp/cpu.c | 4 ++--
include/linux/pm_opp.h | 6 ++++++
3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.=
c
index f983d5d30fa94..c41bf5f1a038d 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -1488,7 +1488,7 @@ unlock:
EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table);
=20
/* Returns opp descriptor node for a device, caller must do of_node_put(=
) */
-struct device_node *_of_get_opp_desc_node(struct device *dev)
+struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev)
{
/*
* TODO: Support for multiple OPP tables.
@@ -1499,6 +1499,7 @@ struct device_node *_of_get_opp_desc_node(struct de=
vice *dev)
=20
return of_parse_phandle(dev->of_node, "operating-points-v2", 0);
}
+EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_opp_desc_node);
=20
/* Initializes OPP tables based on new bindings */
static int _of_add_opp_table_v2(struct device *dev, struct device_node *=
opp_np)
@@ -1627,7 +1628,7 @@ int dev_pm_opp_of_add_table(struct device *dev)
* OPPs have two version of bindings now. The older one is deprecated,
* try for the new binding first.
*/
- opp_np =3D _of_get_opp_desc_node(dev);
+ opp_np =3D dev_pm_opp_of_get_opp_desc_node(dev);
if (!opp_np) {
/*
* Try old-deprecated bindings for backward compatibility with
diff --git a/drivers/base/power/opp/cpu.c b/drivers/base/power/opp/cpu.c
index a0db8b3575f38..29c5b42eff346 100644
--- a/drivers/base/power/opp/cpu.c
+++ b/drivers/base/power/opp/cpu.c
@@ -227,7 +227,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu=
_dev, cpumask_var_t cpumask
int cpu, ret =3D 0;
=20
/* Get OPP descriptor node */
- np =3D _of_get_opp_desc_node(cpu_dev);
+ np =3D dev_pm_opp_of_get_opp_desc_node(cpu_dev);
if (!np) {
dev_dbg(cpu_dev, "%s: Couldn't find cpu_dev node.\n", __func__);
return -ENOENT;
@@ -252,7 +252,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu=
_dev, cpumask_var_t cpumask
}
=20
/* Get OPP descriptor node */
- tmp_np =3D _of_get_opp_desc_node(tcpu_dev);
+ tmp_np =3D dev_pm_opp_of_get_opp_desc_node(tcpu_dev);
if (!tmp_np) {
dev_err(tcpu_dev, "%s: Couldn't find tcpu_dev node.\n",
__func__);
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index 95403d2ccaf56..4a8f5b33d7023 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -160,6 +160,7 @@ int dev_pm_opp_of_cpumask_add_table(cpumask_var_t cpu=
mask);
void dev_pm_opp_of_cpumask_remove_table(cpumask_var_t cpumask);
int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t=
cpumask);
int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, cpumask_var_t cp=
umask);
+struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev);
#else
static inline int dev_pm_opp_of_add_table(struct device *dev)
{
@@ -188,6 +189,11 @@ static inline int dev_pm_opp_set_sharing_cpus(struct=
device *cpu_dev, cpumask_va
{
return -ENOSYS;
}
+
+static inline struct device_node *dev_pm_opp_of_get_opp_desc_node(struct=
device *dev)
+{
+ return NULL;
+}
#endif
=20
#endif /* __LINUX_OPP_H__ */
--=20
2.28.0

Join cip-dev@lists.cip-project.org to automatically receive all group messages.