diff options
Diffstat (limited to 'drivers/base/power/opp/core.c')
-rw-r--r-- | drivers/base/power/opp/core.c | 58 |
1 files changed, 43 insertions, 15 deletions
diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c index 433b60092972..9f8bf04b4dbe 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c | |||
@@ -1845,21 +1845,11 @@ struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev) | |||
1845 | } | 1845 | } |
1846 | EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier); | 1846 | EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier); |
1847 | 1847 | ||
1848 | #ifdef CONFIG_OF | 1848 | /* |
1849 | /** | 1849 | * Free OPPs either created using static entries present in DT or even the |
1850 | * dev_pm_opp_of_remove_table() - Free OPP table entries created from static DT | 1850 | * dynamically added entries based on remove_all param. |
1851 | * entries | ||
1852 | * @dev: device pointer used to lookup OPP table. | ||
1853 | * | ||
1854 | * Free OPPs created using static entries present in DT. | ||
1855 | * | ||
1856 | * Locking: The internal opp_table and opp structures are RCU protected. | ||
1857 | * Hence this function indirectly uses RCU updater strategy with mutex locks | ||
1858 | * to keep the integrity of the internal data structures. Callers should ensure | ||
1859 | * that this function is *NOT* called under RCU protection or in contexts where | ||
1860 | * mutex cannot be locked. | ||
1861 | */ | 1851 | */ |
1862 | void dev_pm_opp_of_remove_table(struct device *dev) | 1852 | static void _dev_pm_opp_remove_table(struct device *dev, bool remove_all) |
1863 | { | 1853 | { |
1864 | struct opp_table *opp_table; | 1854 | struct opp_table *opp_table; |
1865 | struct dev_pm_opp *opp, *tmp; | 1855 | struct dev_pm_opp *opp, *tmp; |
@@ -1884,7 +1874,7 @@ void dev_pm_opp_of_remove_table(struct device *dev) | |||
1884 | if (list_is_singular(&opp_table->dev_list)) { | 1874 | if (list_is_singular(&opp_table->dev_list)) { |
1885 | /* Free static OPPs */ | 1875 | /* Free static OPPs */ |
1886 | list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) { | 1876 | list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) { |
1887 | if (!opp->dynamic) | 1877 | if (remove_all || !opp->dynamic) |
1888 | _opp_remove(opp_table, opp, true); | 1878 | _opp_remove(opp_table, opp, true); |
1889 | } | 1879 | } |
1890 | } else { | 1880 | } else { |
@@ -1894,6 +1884,44 @@ void dev_pm_opp_of_remove_table(struct device *dev) | |||
1894 | unlock: | 1884 | unlock: |
1895 | mutex_unlock(&opp_table_lock); | 1885 | mutex_unlock(&opp_table_lock); |
1896 | } | 1886 | } |
1887 | |||
1888 | /** | ||
1889 | * dev_pm_opp_remove_table() - Free all OPPs associated with the device | ||
1890 | * @dev: device pointer used to lookup OPP table. | ||
1891 | * | ||
1892 | * Free both OPPs created using static entries present in DT and the | ||
1893 | * dynamically added entries. | ||
1894 | * | ||
1895 | * Locking: The internal opp_table and opp structures are RCU protected. | ||
1896 | * Hence this function indirectly uses RCU updater strategy with mutex locks | ||
1897 | * to keep the integrity of the internal data structures. Callers should ensure | ||
1898 | * that this function is *NOT* called under RCU protection or in contexts where | ||
1899 | * mutex cannot be locked. | ||
1900 | */ | ||
1901 | void dev_pm_opp_remove_table(struct device *dev) | ||
1902 | { | ||
1903 | _dev_pm_opp_remove_table(dev, true); | ||
1904 | } | ||
1905 | EXPORT_SYMBOL_GPL(dev_pm_opp_remove_table); | ||
1906 | |||
1907 | #ifdef CONFIG_OF | ||
1908 | /** | ||
1909 | * dev_pm_opp_of_remove_table() - Free OPP table entries created from static DT | ||
1910 | * entries | ||
1911 | * @dev: device pointer used to lookup OPP table. | ||
1912 | * | ||
1913 | * Free OPPs created using static entries present in DT. | ||
1914 | * | ||
1915 | * Locking: The internal opp_table and opp structures are RCU protected. | ||
1916 | * Hence this function indirectly uses RCU updater strategy with mutex locks | ||
1917 | * to keep the integrity of the internal data structures. Callers should ensure | ||
1918 | * that this function is *NOT* called under RCU protection or in contexts where | ||
1919 | * mutex cannot be locked. | ||
1920 | */ | ||
1921 | void dev_pm_opp_of_remove_table(struct device *dev) | ||
1922 | { | ||
1923 | _dev_pm_opp_remove_table(dev, false); | ||
1924 | } | ||
1897 | EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table); | 1925 | EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table); |
1898 | 1926 | ||
1899 | /* Returns opp descriptor node for a device, caller must do of_node_put() */ | 1927 | /* Returns opp descriptor node for a device, caller must do of_node_put() */ |