Commit 2a4eb735 authored by Viresh Kumar's avatar Viresh Kumar

OPP: Don't remove dynamic OPPs from _dev_pm_opp_remove_table()

Only one platform was depending on this feature and it is already
updated now. Stop removing dynamic OPPs from _dev_pm_opp_remove_table().
This simplifies lot of paths and removes unnecessary parameters.
Tested-by: default avatarNiklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
parent 883071c4
...@@ -1759,14 +1759,10 @@ int dev_pm_opp_unregister_notifier(struct device *dev, ...@@ -1759,14 +1759,10 @@ int dev_pm_opp_unregister_notifier(struct device *dev,
EXPORT_SYMBOL(dev_pm_opp_unregister_notifier); EXPORT_SYMBOL(dev_pm_opp_unregister_notifier);
/* /*
* Free OPPs either created using static entries present in DT or even the * Free OPPs either created using static entries present in DT.
* dynamically added entries based on remove_all param.
*/ */
void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev, void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev)
bool remove_all)
{ {
struct dev_pm_opp *opp, *tmp;
/* Protect dev_list */ /* Protect dev_list */
mutex_lock(&opp_table->lock); mutex_lock(&opp_table->lock);
...@@ -1775,12 +1771,6 @@ void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev, ...@@ -1775,12 +1771,6 @@ void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev,
/* Free static OPPs */ /* Free static OPPs */
_put_opp_list_kref(opp_table); _put_opp_list_kref(opp_table);
/* Free dynamic OPPs */
list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) {
if (remove_all)
dev_pm_opp_put(opp);
}
/* /*
* The OPP table is getting removed, drop the performance state * The OPP table is getting removed, drop the performance state
* constraints. * constraints.
...@@ -1795,7 +1785,7 @@ void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev, ...@@ -1795,7 +1785,7 @@ void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev,
mutex_unlock(&opp_table->lock); mutex_unlock(&opp_table->lock);
} }
void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all) void _dev_pm_opp_find_and_remove_table(struct device *dev)
{ {
struct opp_table *opp_table; struct opp_table *opp_table;
...@@ -1812,7 +1802,7 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all) ...@@ -1812,7 +1802,7 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all)
return; return;
} }
_dev_pm_opp_remove_table(opp_table, dev, remove_all); _dev_pm_opp_remove_table(opp_table, dev);
dev_pm_opp_put_opp_table(opp_table); dev_pm_opp_put_opp_table(opp_table);
} }
...@@ -1826,6 +1816,6 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all) ...@@ -1826,6 +1816,6 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all)
*/ */
void dev_pm_opp_remove_table(struct device *dev) void dev_pm_opp_remove_table(struct device *dev)
{ {
_dev_pm_opp_find_and_remove_table(dev, true); _dev_pm_opp_find_and_remove_table(dev);
} }
EXPORT_SYMBOL_GPL(dev_pm_opp_remove_table); EXPORT_SYMBOL_GPL(dev_pm_opp_remove_table);
...@@ -108,7 +108,7 @@ void dev_pm_opp_free_cpufreq_table(struct device *dev, ...@@ -108,7 +108,7 @@ void dev_pm_opp_free_cpufreq_table(struct device *dev,
EXPORT_SYMBOL_GPL(dev_pm_opp_free_cpufreq_table); EXPORT_SYMBOL_GPL(dev_pm_opp_free_cpufreq_table);
#endif /* CONFIG_CPU_FREQ */ #endif /* CONFIG_CPU_FREQ */
void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of, void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask,
int last_cpu) int last_cpu)
{ {
struct device *cpu_dev; struct device *cpu_dev;
...@@ -127,10 +127,7 @@ void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of, ...@@ -127,10 +127,7 @@ void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of,
continue; continue;
} }
if (of) _dev_pm_opp_find_and_remove_table(cpu_dev);
dev_pm_opp_of_remove_table(cpu_dev);
else
dev_pm_opp_remove_table(cpu_dev);
} }
} }
...@@ -144,7 +141,7 @@ void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of, ...@@ -144,7 +141,7 @@ void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of,
*/ */
void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask) void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask)
{ {
_dev_pm_opp_cpumask_remove_table(cpumask, false, -1); _dev_pm_opp_cpumask_remove_table(cpumask, -1);
} }
EXPORT_SYMBOL_GPL(dev_pm_opp_cpumask_remove_table); EXPORT_SYMBOL_GPL(dev_pm_opp_cpumask_remove_table);
......
...@@ -279,7 +279,7 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev, ...@@ -279,7 +279,7 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev,
*/ */
void dev_pm_opp_of_remove_table(struct device *dev) void dev_pm_opp_of_remove_table(struct device *dev)
{ {
_dev_pm_opp_find_and_remove_table(dev, false); _dev_pm_opp_find_and_remove_table(dev);
} }
EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table); EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table);
...@@ -432,7 +432,7 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np, ...@@ -432,7 +432,7 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np,
if (ret) { if (ret) {
dev_err(dev, "%s: Failed to add OPP, %d\n", __func__, dev_err(dev, "%s: Failed to add OPP, %d\n", __func__,
ret); ret);
_dev_pm_opp_remove_table(opp_table, dev, false); _dev_pm_opp_remove_table(opp_table, dev);
of_node_put(np); of_node_put(np);
goto put_opp_table; goto put_opp_table;
} }
...@@ -453,7 +453,7 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np, ...@@ -453,7 +453,7 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np,
dev_err(dev, "Not all nodes have performance state set (%d: %d)\n", dev_err(dev, "Not all nodes have performance state set (%d: %d)\n",
count, pstate_count); count, pstate_count);
ret = -ENOENT; ret = -ENOENT;
_dev_pm_opp_remove_table(opp_table, dev, false); _dev_pm_opp_remove_table(opp_table, dev);
goto put_opp_table; goto put_opp_table;
} }
...@@ -507,7 +507,7 @@ static int _of_add_opp_table_v1(struct device *dev) ...@@ -507,7 +507,7 @@ static int _of_add_opp_table_v1(struct device *dev)
if (ret) { if (ret) {
dev_err(dev, "%s: Failed to add OPP %ld (%d)\n", dev_err(dev, "%s: Failed to add OPP %ld (%d)\n",
__func__, freq, ret); __func__, freq, ret);
_dev_pm_opp_remove_table(opp_table, dev, false); _dev_pm_opp_remove_table(opp_table, dev);
break; break;
} }
nr -= 2; nr -= 2;
...@@ -618,7 +618,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table_indexed); ...@@ -618,7 +618,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table_indexed);
*/ */
void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask) void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask)
{ {
_dev_pm_opp_cpumask_remove_table(cpumask, true, -1); _dev_pm_opp_cpumask_remove_table(cpumask, -1);
} }
EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_remove_table); EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_remove_table);
...@@ -653,7 +653,7 @@ int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask) ...@@ -653,7 +653,7 @@ int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask)
__func__, cpu, ret); __func__, cpu, ret);
/* Free all other OPPs */ /* Free all other OPPs */
_dev_pm_opp_cpumask_remove_table(cpumask, true, cpu); _dev_pm_opp_cpumask_remove_table(cpumask, cpu);
break; break;
} }
} }
......
...@@ -194,13 +194,13 @@ void _get_opp_table_kref(struct opp_table *opp_table); ...@@ -194,13 +194,13 @@ void _get_opp_table_kref(struct opp_table *opp_table);
int _get_opp_count(struct opp_table *opp_table); int _get_opp_count(struct opp_table *opp_table);
struct opp_table *_find_opp_table(struct device *dev); struct opp_table *_find_opp_table(struct device *dev);
struct opp_device *_add_opp_dev(const struct device *dev, struct opp_table *opp_table); struct opp_device *_add_opp_dev(const struct device *dev, struct opp_table *opp_table);
void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev, bool remove_all); void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev);
void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all); void _dev_pm_opp_find_and_remove_table(struct device *dev);
struct dev_pm_opp *_opp_allocate(struct opp_table *opp_table); struct dev_pm_opp *_opp_allocate(struct opp_table *opp_table);
void _opp_free(struct dev_pm_opp *opp); void _opp_free(struct dev_pm_opp *opp);
int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, struct opp_table *opp_table, bool rate_not_available); int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, struct opp_table *opp_table, bool rate_not_available);
int _opp_add_v1(struct opp_table *opp_table, struct device *dev, unsigned long freq, long u_volt, bool dynamic); int _opp_add_v1(struct opp_table *opp_table, struct device *dev, unsigned long freq, long u_volt, bool dynamic);
void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of, int last_cpu); void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, int last_cpu);
struct opp_table *_add_opp_table(struct device *dev); struct opp_table *_add_opp_table(struct device *dev);
void _put_opp_list_kref(struct opp_table *opp_table); void _put_opp_list_kref(struct opp_table *opp_table);
......
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