Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

+17 -30
+5 -15
drivers/opp/core.c
··· 1759 1759 EXPORT_SYMBOL(dev_pm_opp_unregister_notifier); 1760 1760 1761 1761 /* 1762 - * Free OPPs either created using static entries present in DT or even the 1763 - * dynamically added entries based on remove_all param. 1762 + * Free OPPs either created using static entries present in DT. 1764 1763 */ 1765 - void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev, 1766 - bool remove_all) 1764 + void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev) 1767 1765 { 1768 - struct dev_pm_opp *opp, *tmp; 1769 - 1770 1766 /* Protect dev_list */ 1771 1767 mutex_lock(&opp_table->lock); 1772 1768 ··· 1770 1774 if (list_is_singular(&opp_table->dev_list)) { 1771 1775 /* Free static OPPs */ 1772 1776 _put_opp_list_kref(opp_table); 1773 - 1774 - /* Free dynamic OPPs */ 1775 - list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) { 1776 - if (remove_all) 1777 - dev_pm_opp_put(opp); 1778 - } 1779 1777 1780 1778 /* 1781 1779 * The OPP table is getting removed, drop the performance state ··· 1785 1795 mutex_unlock(&opp_table->lock); 1786 1796 } 1787 1797 1788 - void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all) 1798 + void _dev_pm_opp_find_and_remove_table(struct device *dev) 1789 1799 { 1790 1800 struct opp_table *opp_table; 1791 1801 ··· 1802 1812 return; 1803 1813 } 1804 1814 1805 - _dev_pm_opp_remove_table(opp_table, dev, remove_all); 1815 + _dev_pm_opp_remove_table(opp_table, dev); 1806 1816 1807 1817 dev_pm_opp_put_opp_table(opp_table); 1808 1818 } ··· 1816 1826 */ 1817 1827 void dev_pm_opp_remove_table(struct device *dev) 1818 1828 { 1819 - _dev_pm_opp_find_and_remove_table(dev, true); 1829 + _dev_pm_opp_find_and_remove_table(dev); 1820 1830 } 1821 1831 EXPORT_SYMBOL_GPL(dev_pm_opp_remove_table);
+3 -6
drivers/opp/cpu.c
··· 108 108 EXPORT_SYMBOL_GPL(dev_pm_opp_free_cpufreq_table); 109 109 #endif /* CONFIG_CPU_FREQ */ 110 110 111 - void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of, 111 + void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, 112 112 int last_cpu) 113 113 { 114 114 struct device *cpu_dev; ··· 127 127 continue; 128 128 } 129 129 130 - if (of) 131 - dev_pm_opp_of_remove_table(cpu_dev); 132 - else 133 - dev_pm_opp_remove_table(cpu_dev); 130 + _dev_pm_opp_find_and_remove_table(cpu_dev); 134 131 } 135 132 } 136 133 ··· 141 144 */ 142 145 void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask) 143 146 { 144 - _dev_pm_opp_cpumask_remove_table(cpumask, false, -1); 147 + _dev_pm_opp_cpumask_remove_table(cpumask, -1); 145 148 } 146 149 EXPORT_SYMBOL_GPL(dev_pm_opp_cpumask_remove_table); 147 150
+6 -6
drivers/opp/of.c
··· 279 279 */ 280 280 void dev_pm_opp_of_remove_table(struct device *dev) 281 281 { 282 - _dev_pm_opp_find_and_remove_table(dev, false); 282 + _dev_pm_opp_find_and_remove_table(dev); 283 283 } 284 284 EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table); 285 285 ··· 432 432 if (ret) { 433 433 dev_err(dev, "%s: Failed to add OPP, %d\n", __func__, 434 434 ret); 435 - _dev_pm_opp_remove_table(opp_table, dev, false); 435 + _dev_pm_opp_remove_table(opp_table, dev); 436 436 of_node_put(np); 437 437 goto put_opp_table; 438 438 } ··· 453 453 dev_err(dev, "Not all nodes have performance state set (%d: %d)\n", 454 454 count, pstate_count); 455 455 ret = -ENOENT; 456 - _dev_pm_opp_remove_table(opp_table, dev, false); 456 + _dev_pm_opp_remove_table(opp_table, dev); 457 457 goto put_opp_table; 458 458 } 459 459 ··· 507 507 if (ret) { 508 508 dev_err(dev, "%s: Failed to add OPP %ld (%d)\n", 509 509 __func__, freq, ret); 510 - _dev_pm_opp_remove_table(opp_table, dev, false); 510 + _dev_pm_opp_remove_table(opp_table, dev); 511 511 break; 512 512 } 513 513 nr -= 2; ··· 618 618 */ 619 619 void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask) 620 620 { 621 - _dev_pm_opp_cpumask_remove_table(cpumask, true, -1); 621 + _dev_pm_opp_cpumask_remove_table(cpumask, -1); 622 622 } 623 623 EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_remove_table); 624 624 ··· 653 653 __func__, cpu, ret); 654 654 655 655 /* Free all other OPPs */ 656 - _dev_pm_opp_cpumask_remove_table(cpumask, true, cpu); 656 + _dev_pm_opp_cpumask_remove_table(cpumask, cpu); 657 657 break; 658 658 } 659 659 }
+3 -3
drivers/opp/opp.h
··· 194 194 int _get_opp_count(struct opp_table *opp_table); 195 195 struct opp_table *_find_opp_table(struct device *dev); 196 196 struct opp_device *_add_opp_dev(const struct device *dev, struct opp_table *opp_table); 197 - void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev, bool remove_all); 198 - void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all); 197 + void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev); 198 + void _dev_pm_opp_find_and_remove_table(struct device *dev); 199 199 struct dev_pm_opp *_opp_allocate(struct opp_table *opp_table); 200 200 void _opp_free(struct dev_pm_opp *opp); 201 201 int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, struct opp_table *opp_table, bool rate_not_available); 202 202 int _opp_add_v1(struct opp_table *opp_table, struct device *dev, unsigned long freq, long u_volt, bool dynamic); 203 - void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of, int last_cpu); 203 + void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, int last_cpu); 204 204 struct opp_table *_add_opp_table(struct device *dev); 205 205 void _put_opp_list_kref(struct opp_table *opp_table); 206 206