Commit f0489a5e authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki

PM / OPP: Rename opp init/free table routines

free-table routines are opposite of init-table ones, and must be named
to make that clear. Opposite of 'init' is 'exit', but those doesn't suit
really well.

Replace 'init' with 'add' and 'free' with 'remove'.
Reported-by: default avatarPavel Machek <pavel@ucw.cz>
Reviewed-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Acked-by: default avatarShawn Guo <shawnguo@kernel.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 1840995c
...@@ -350,7 +350,7 @@ static void __init imx6q_opp_init(void) ...@@ -350,7 +350,7 @@ static void __init imx6q_opp_init(void)
return; return;
} }
if (of_init_opp_table(cpu_dev)) { if (of_add_opp_table(cpu_dev)) {
pr_warn("failed to init OPP table\n"); pr_warn("failed to init OPP table\n");
goto put_node; goto put_node;
} }
......
...@@ -828,8 +828,8 @@ static int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, ...@@ -828,8 +828,8 @@ static int _opp_add(struct device *dev, struct dev_pm_opp *new_opp,
* The opp is made available by default and it can be controlled using * The opp is made available by default and it can be controlled using
* dev_pm_opp_enable/disable functions and may be removed by dev_pm_opp_remove. * dev_pm_opp_enable/disable functions and may be removed by dev_pm_opp_remove.
* *
* NOTE: "dynamic" parameter impacts OPPs added by the of_init_opp_table and * NOTE: "dynamic" parameter impacts OPPs added by the of_add_opp_table and
* freed by of_free_opp_table. * freed by of_remove_opp_table.
* *
* Locking: The internal device_opp and opp structures are RCU protected. * Locking: The internal device_opp and opp structures are RCU protected.
* Hence this function internally uses RCU updater strategy with mutex locks * Hence this function internally uses RCU updater strategy with mutex locks
...@@ -1213,7 +1213,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier); ...@@ -1213,7 +1213,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier);
#ifdef CONFIG_OF #ifdef CONFIG_OF
/** /**
* of_free_opp_table() - Free OPP table entries created from static DT entries * of_remove_opp_table() - Free OPP table entries created from static DT entries
* @dev: device pointer used to lookup device OPPs. * @dev: device pointer used to lookup device OPPs.
* *
* Free OPPs created using static entries present in DT. * Free OPPs created using static entries present in DT.
...@@ -1224,7 +1224,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier); ...@@ -1224,7 +1224,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier);
* that this function is *NOT* called under RCU protection or in contexts where * that this function is *NOT* called under RCU protection or in contexts where
* mutex cannot be locked. * mutex cannot be locked.
*/ */
void of_free_opp_table(struct device *dev) void of_remove_opp_table(struct device *dev)
{ {
struct device_opp *dev_opp; struct device_opp *dev_opp;
struct dev_pm_opp *opp, *tmp; struct dev_pm_opp *opp, *tmp;
...@@ -1259,9 +1259,9 @@ void of_free_opp_table(struct device *dev) ...@@ -1259,9 +1259,9 @@ void of_free_opp_table(struct device *dev)
unlock: unlock:
mutex_unlock(&dev_opp_list_lock); mutex_unlock(&dev_opp_list_lock);
} }
EXPORT_SYMBOL_GPL(of_free_opp_table); EXPORT_SYMBOL_GPL(of_remove_opp_table);
void of_cpumask_free_opp_table(cpumask_var_t cpumask) void of_cpumask_remove_opp_table(cpumask_var_t cpumask)
{ {
struct device *cpu_dev; struct device *cpu_dev;
int cpu; int cpu;
...@@ -1276,10 +1276,10 @@ void of_cpumask_free_opp_table(cpumask_var_t cpumask) ...@@ -1276,10 +1276,10 @@ void of_cpumask_free_opp_table(cpumask_var_t cpumask)
continue; continue;
} }
of_free_opp_table(cpu_dev); of_remove_opp_table(cpu_dev);
} }
} }
EXPORT_SYMBOL_GPL(of_cpumask_free_opp_table); EXPORT_SYMBOL_GPL(of_cpumask_remove_opp_table);
/* Returns opp descriptor node for a device, caller must do of_node_put() */ /* Returns opp descriptor node for a device, caller must do of_node_put() */
static struct device_node *_of_get_opp_desc_node(struct device *dev) static struct device_node *_of_get_opp_desc_node(struct device *dev)
...@@ -1295,8 +1295,7 @@ static struct device_node *_of_get_opp_desc_node(struct device *dev) ...@@ -1295,8 +1295,7 @@ static struct device_node *_of_get_opp_desc_node(struct device *dev)
} }
/* Initializes OPP tables based on new bindings */ /* Initializes OPP tables based on new bindings */
static int _of_init_opp_table_v2(struct device *dev, static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np)
struct device_node *opp_np)
{ {
struct device_node *np; struct device_node *np;
struct device_opp *dev_opp; struct device_opp *dev_opp;
...@@ -1338,13 +1337,13 @@ static int _of_init_opp_table_v2(struct device *dev, ...@@ -1338,13 +1337,13 @@ static int _of_init_opp_table_v2(struct device *dev,
return 0; return 0;
free_table: free_table:
of_free_opp_table(dev); of_remove_opp_table(dev);
return ret; return ret;
} }
/* Initializes OPP tables based on old-deprecated bindings */ /* Initializes OPP tables based on old-deprecated bindings */
static int _of_init_opp_table_v1(struct device *dev) static int _of_add_opp_table_v1(struct device *dev)
{ {
const struct property *prop; const struct property *prop;
const __be32 *val; const __be32 *val;
...@@ -1381,7 +1380,7 @@ static int _of_init_opp_table_v1(struct device *dev) ...@@ -1381,7 +1380,7 @@ static int _of_init_opp_table_v1(struct device *dev)
} }
/** /**
* of_init_opp_table() - Initialize opp table from device tree * of_add_opp_table() - Initialize opp table from device tree
* @dev: device pointer used to lookup device OPPs. * @dev: device pointer used to lookup device OPPs.
* *
* Register the initial OPP table with the OPP library for given device. * Register the initial OPP table with the OPP library for given device.
...@@ -1403,7 +1402,7 @@ static int _of_init_opp_table_v1(struct device *dev) ...@@ -1403,7 +1402,7 @@ static int _of_init_opp_table_v1(struct device *dev)
* -ENODATA when empty 'operating-points' property is found * -ENODATA when empty 'operating-points' property is found
* -EINVAL when invalid entries are found in opp-v2 table * -EINVAL when invalid entries are found in opp-v2 table
*/ */
int of_init_opp_table(struct device *dev) int of_add_opp_table(struct device *dev)
{ {
struct device_node *opp_np; struct device_node *opp_np;
int ret; int ret;
...@@ -1418,17 +1417,17 @@ int of_init_opp_table(struct device *dev) ...@@ -1418,17 +1417,17 @@ int of_init_opp_table(struct device *dev)
* Try old-deprecated bindings for backward compatibility with * Try old-deprecated bindings for backward compatibility with
* older dtbs. * older dtbs.
*/ */
return _of_init_opp_table_v1(dev); return _of_add_opp_table_v1(dev);
} }
ret = _of_init_opp_table_v2(dev, opp_np); ret = _of_add_opp_table_v2(dev, opp_np);
of_node_put(opp_np); of_node_put(opp_np);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(of_init_opp_table); EXPORT_SYMBOL_GPL(of_add_opp_table);
int of_cpumask_init_opp_table(cpumask_var_t cpumask) int of_cpumask_add_opp_table(cpumask_var_t cpumask)
{ {
struct device *cpu_dev; struct device *cpu_dev;
int cpu, ret = 0; int cpu, ret = 0;
...@@ -1443,20 +1442,20 @@ int of_cpumask_init_opp_table(cpumask_var_t cpumask) ...@@ -1443,20 +1442,20 @@ int of_cpumask_init_opp_table(cpumask_var_t cpumask)
continue; continue;
} }
ret = of_init_opp_table(cpu_dev); ret = of_add_opp_table(cpu_dev);
if (ret) { if (ret) {
pr_err("%s: couldn't find opp table for cpu:%d, %d\n", pr_err("%s: couldn't find opp table for cpu:%d, %d\n",
__func__, cpu, ret); __func__, cpu, ret);
/* Free all other OPPs */ /* Free all other OPPs */
of_cpumask_free_opp_table(cpumask); of_cpumask_remove_opp_table(cpumask);
break; break;
} }
} }
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(of_cpumask_init_opp_table); EXPORT_SYMBOL_GPL(of_cpumask_add_opp_table);
/* Required only for V1 bindings, as v2 can manage it from DT itself */ /* Required only for V1 bindings, as v2 can manage it from DT itself */
int set_cpus_sharing_opps(struct device *cpu_dev, cpumask_var_t cpumask) int set_cpus_sharing_opps(struct device *cpu_dev, cpumask_var_t cpumask)
......
...@@ -28,7 +28,7 @@ struct cpufreq_arm_bL_ops { ...@@ -28,7 +28,7 @@ struct cpufreq_arm_bL_ops {
/* /*
* This must set opp table for cpu_dev in a similar way as done by * This must set opp table for cpu_dev in a similar way as done by
* of_init_opp_table(). * of_add_opp_table().
*/ */
int (*init_opp_table)(struct device *cpu_dev); int (*init_opp_table)(struct device *cpu_dev);
......
...@@ -54,7 +54,7 @@ static int dt_init_opp_table(struct device *cpu_dev) ...@@ -54,7 +54,7 @@ static int dt_init_opp_table(struct device *cpu_dev)
return -ENOENT; return -ENOENT;
} }
ret = of_init_opp_table(cpu_dev); ret = of_add_opp_table(cpu_dev);
of_node_put(np); of_node_put(np);
return ret; return ret;
...@@ -82,7 +82,7 @@ static struct cpufreq_arm_bL_ops dt_bL_ops = { ...@@ -82,7 +82,7 @@ static struct cpufreq_arm_bL_ops dt_bL_ops = {
.name = "dt-bl", .name = "dt-bl",
.get_transition_latency = dt_get_transition_latency, .get_transition_latency = dt_get_transition_latency,
.init_opp_table = dt_init_opp_table, .init_opp_table = dt_init_opp_table,
.free_opp_table = of_free_opp_table, .free_opp_table = of_remove_opp_table,
}; };
static int generic_bL_probe(struct platform_device *pdev) static int generic_bL_probe(struct platform_device *pdev)
......
...@@ -238,7 +238,7 @@ static int cpufreq_init(struct cpufreq_policy *policy) ...@@ -238,7 +238,7 @@ static int cpufreq_init(struct cpufreq_policy *policy)
* *
* OPPs might be populated at runtime, don't check for error here * OPPs might be populated at runtime, don't check for error here
*/ */
of_cpumask_init_opp_table(policy->cpus); of_cpumask_add_opp_table(policy->cpus);
/* /*
* But we need OPP table to function so if it is not there let's * But we need OPP table to function so if it is not there let's
...@@ -368,7 +368,7 @@ static int cpufreq_init(struct cpufreq_policy *policy) ...@@ -368,7 +368,7 @@ static int cpufreq_init(struct cpufreq_policy *policy)
out_free_priv: out_free_priv:
kfree(priv); kfree(priv);
out_free_opp: out_free_opp:
of_cpumask_free_opp_table(policy->cpus); of_cpumask_remove_opp_table(policy->cpus);
out_node_put: out_node_put:
of_node_put(np); of_node_put(np);
out_put_reg_clk: out_put_reg_clk:
...@@ -385,7 +385,7 @@ static int cpufreq_exit(struct cpufreq_policy *policy) ...@@ -385,7 +385,7 @@ static int cpufreq_exit(struct cpufreq_policy *policy)
cpufreq_cooling_unregister(priv->cdev); cpufreq_cooling_unregister(priv->cdev);
dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table);
of_cpumask_free_opp_table(policy->related_cpus); of_cpumask_remove_opp_table(policy->related_cpus);
clk_put(policy->clk); clk_put(policy->clk);
if (!IS_ERR(priv->cpu_reg)) if (!IS_ERR(priv->cpu_reg))
regulator_put(priv->cpu_reg); regulator_put(priv->cpu_reg);
......
...@@ -360,7 +360,7 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) ...@@ -360,7 +360,7 @@ static int exynos_cpufreq_probe(struct platform_device *pdev)
goto err_put_node; goto err_put_node;
} }
ret = of_init_opp_table(dvfs_info->dev); ret = of_add_opp_table(dvfs_info->dev);
if (ret) { if (ret) {
dev_err(dvfs_info->dev, "failed to init OPP table: %d\n", ret); dev_err(dvfs_info->dev, "failed to init OPP table: %d\n", ret);
goto err_put_node; goto err_put_node;
...@@ -424,7 +424,7 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) ...@@ -424,7 +424,7 @@ static int exynos_cpufreq_probe(struct platform_device *pdev)
err_free_table: err_free_table:
dev_pm_opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table); dev_pm_opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table);
err_free_opp: err_free_opp:
of_free_opp_table(dvfs_info->dev); of_remove_opp_table(dvfs_info->dev);
err_put_node: err_put_node:
of_node_put(np); of_node_put(np);
dev_err(&pdev->dev, "%s: failed initialization\n", __func__); dev_err(&pdev->dev, "%s: failed initialization\n", __func__);
...@@ -435,7 +435,7 @@ static int exynos_cpufreq_remove(struct platform_device *pdev) ...@@ -435,7 +435,7 @@ static int exynos_cpufreq_remove(struct platform_device *pdev)
{ {
cpufreq_unregister_driver(&exynos_driver); cpufreq_unregister_driver(&exynos_driver);
dev_pm_opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table); dev_pm_opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table);
of_free_opp_table(dvfs_info->dev); of_remove_opp_table(dvfs_info->dev);
return 0; return 0;
} }
......
...@@ -202,7 +202,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) ...@@ -202,7 +202,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
*/ */
num = dev_pm_opp_get_opp_count(cpu_dev); num = dev_pm_opp_get_opp_count(cpu_dev);
if (num < 0) { if (num < 0) {
ret = of_init_opp_table(cpu_dev); ret = of_add_opp_table(cpu_dev);
if (ret < 0) { if (ret < 0) {
dev_err(cpu_dev, "failed to init OPP table: %d\n", ret); dev_err(cpu_dev, "failed to init OPP table: %d\n", ret);
goto put_reg; goto put_reg;
...@@ -312,7 +312,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) ...@@ -312,7 +312,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
out_free_opp: out_free_opp:
if (free_opp) if (free_opp)
of_free_opp_table(cpu_dev); of_remove_opp_table(cpu_dev);
put_reg: put_reg:
if (!IS_ERR(arm_reg)) if (!IS_ERR(arm_reg))
regulator_put(arm_reg); regulator_put(arm_reg);
...@@ -340,7 +340,7 @@ static int imx6q_cpufreq_remove(struct platform_device *pdev) ...@@ -340,7 +340,7 @@ static int imx6q_cpufreq_remove(struct platform_device *pdev)
cpufreq_unregister_driver(&imx6q_cpufreq_driver); cpufreq_unregister_driver(&imx6q_cpufreq_driver);
dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
if (free_opp) if (free_opp)
of_free_opp_table(cpu_dev); of_remove_opp_table(cpu_dev);
regulator_put(arm_reg); regulator_put(arm_reg);
if (!IS_ERR(pu_reg)) if (!IS_ERR(pu_reg))
regulator_put(pu_reg); regulator_put(pu_reg);
......
...@@ -344,7 +344,7 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) ...@@ -344,7 +344,7 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
/* Both presence and absence of sram regulator are valid cases. */ /* Both presence and absence of sram regulator are valid cases. */
sram_reg = regulator_get_exclusive(cpu_dev, "sram"); sram_reg = regulator_get_exclusive(cpu_dev, "sram");
ret = of_init_opp_table(cpu_dev); ret = of_add_opp_table(cpu_dev);
if (ret) { if (ret) {
pr_warn("no OPP table for cpu%d\n", cpu); pr_warn("no OPP table for cpu%d\n", cpu);
goto out_free_resources; goto out_free_resources;
...@@ -378,7 +378,7 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) ...@@ -378,7 +378,7 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
return 0; return 0;
out_free_opp_table: out_free_opp_table:
of_free_opp_table(cpu_dev); of_remove_opp_table(cpu_dev);
out_free_resources: out_free_resources:
if (!IS_ERR(proc_reg)) if (!IS_ERR(proc_reg))
...@@ -404,7 +404,7 @@ static void mtk_cpu_dvfs_info_release(struct mtk_cpu_dvfs_info *info) ...@@ -404,7 +404,7 @@ static void mtk_cpu_dvfs_info_release(struct mtk_cpu_dvfs_info *info)
if (!IS_ERR(info->inter_clk)) if (!IS_ERR(info->inter_clk))
clk_put(info->inter_clk); clk_put(info->inter_clk);
of_free_opp_table(info->cpu_dev); of_remove_opp_table(info->cpu_dev);
} }
static int mtk_cpufreq_init(struct cpufreq_policy *policy) static int mtk_cpufreq_init(struct cpufreq_policy *policy)
......
...@@ -132,28 +132,28 @@ static inline struct srcu_notifier_head *dev_pm_opp_get_notifier( ...@@ -132,28 +132,28 @@ static inline struct srcu_notifier_head *dev_pm_opp_get_notifier(
#endif /* CONFIG_PM_OPP */ #endif /* CONFIG_PM_OPP */
#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
int of_init_opp_table(struct device *dev); int of_add_opp_table(struct device *dev);
void of_free_opp_table(struct device *dev); void of_remove_opp_table(struct device *dev);
int of_cpumask_init_opp_table(cpumask_var_t cpumask); int of_cpumask_add_opp_table(cpumask_var_t cpumask);
void of_cpumask_free_opp_table(cpumask_var_t cpumask); void of_cpumask_remove_opp_table(cpumask_var_t cpumask);
int of_get_cpus_sharing_opps(struct device *cpu_dev, cpumask_var_t cpumask); int of_get_cpus_sharing_opps(struct device *cpu_dev, cpumask_var_t cpumask);
int set_cpus_sharing_opps(struct device *cpu_dev, cpumask_var_t cpumask); int set_cpus_sharing_opps(struct device *cpu_dev, cpumask_var_t cpumask);
#else #else
static inline int of_init_opp_table(struct device *dev) static inline int of_add_opp_table(struct device *dev)
{ {
return -EINVAL; return -EINVAL;
} }
static inline void of_free_opp_table(struct device *dev) static inline void of_remove_opp_table(struct device *dev)
{ {
} }
static inline int of_cpumask_init_opp_table(cpumask_var_t cpumask) static inline int of_cpumask_add_opp_table(cpumask_var_t cpumask)
{ {
return -ENOSYS; return -ENOSYS;
} }
static inline void of_cpumask_free_opp_table(cpumask_var_t cpumask) static inline void of_cpumask_remove_opp_table(cpumask_var_t cpumask)
{ {
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment