aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/opp/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/power/opp/cpu.c')
-rw-r--r--drivers/base/power/opp/cpu.c60
1 files changed, 45 insertions, 15 deletions
diff --git a/drivers/base/power/opp/cpu.c b/drivers/base/power/opp/cpu.c
index 8e0b6349d7d4..357781e0b791 100644
--- a/drivers/base/power/opp/cpu.c
+++ b/drivers/base/power/opp/cpu.c
@@ -119,20 +119,8 @@ void dev_pm_opp_free_cpufreq_table(struct device *dev,
119EXPORT_SYMBOL_GPL(dev_pm_opp_free_cpufreq_table); 119EXPORT_SYMBOL_GPL(dev_pm_opp_free_cpufreq_table);
120#endif /* CONFIG_CPU_FREQ */ 120#endif /* CONFIG_CPU_FREQ */
121 121
122#ifdef CONFIG_OF 122static void
123/** 123_dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of)
124 * dev_pm_opp_of_cpumask_remove_table() - Removes OPP table for @cpumask
125 * @cpumask: cpumask for which OPP table needs to be removed
126 *
127 * This removes the OPP tables for CPUs present in the @cpumask.
128 *
129 * Locking: The internal opp_table and opp structures are RCU protected.
130 * Hence this function internally uses RCU updater strategy with mutex locks
131 * to keep the integrity of the internal data structures. Callers should ensure
132 * that this function is *NOT* called under RCU protection or in contexts where
133 * mutex cannot be locked.
134 */
135void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask)
136{ 124{
137 struct device *cpu_dev; 125 struct device *cpu_dev;
138 int cpu; 126 int cpu;
@@ -147,9 +135,51 @@ void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask)
147 continue; 135 continue;
148 } 136 }
149 137
150 dev_pm_opp_of_remove_table(cpu_dev); 138 if (of)
139 dev_pm_opp_of_remove_table(cpu_dev);
140 else
141 dev_pm_opp_remove_table(cpu_dev);
151 } 142 }
152} 143}
144
145/**
146 * dev_pm_opp_cpumask_remove_table() - Removes OPP table for @cpumask
147 * @cpumask: cpumask for which OPP table needs to be removed
148 *
149 * This removes the OPP tables for CPUs present in the @cpumask.
150 * This should be used to remove all the OPPs entries associated with
151 * the cpus in @cpumask.
152 *
153 * Locking: The internal opp_table and opp structures are RCU protected.
154 * Hence this function internally uses RCU updater strategy with mutex locks
155 * to keep the integrity of the internal data structures. Callers should ensure
156 * that this function is *NOT* called under RCU protection or in contexts where
157 * mutex cannot be locked.
158 */
159void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask)
160{
161 _dev_pm_opp_cpumask_remove_table(cpumask, false);
162}
163EXPORT_SYMBOL_GPL(dev_pm_opp_cpumask_remove_table);
164
165#ifdef CONFIG_OF
166/**
167 * dev_pm_opp_of_cpumask_remove_table() - Removes OPP table for @cpumask
168 * @cpumask: cpumask for which OPP table needs to be removed
169 *
170 * This removes the OPP tables for CPUs present in the @cpumask.
171 * This should be used only to remove static entries created from DT.
172 *
173 * Locking: The internal opp_table and opp structures are RCU protected.
174 * Hence this function internally uses RCU updater strategy with mutex locks
175 * to keep the integrity of the internal data structures. Callers should ensure
176 * that this function is *NOT* called under RCU protection or in contexts where
177 * mutex cannot be locked.
178 */
179void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask)
180{
181 _dev_pm_opp_cpumask_remove_table(cpumask, true);
182}
153EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_remove_table); 183EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_remove_table);
154 184
155/** 185/**