aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2014-11-26 22:24:06 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-11-29 17:53:20 -0500
commit129eec55df6ab1b5ecdd89fd7db7a2cd103200b5 (patch)
tree2e9bae88e582e9a8f883dd6029802641c1fab93d /include
parent38393409da345cd48d94a0e74c7bbc3402742882 (diff)
PM / OPP Introduce APIs to remove OPPs
OPPs are created statically (from DT) or dynamically. Currently we don't free OPPs that are created statically, when the module unloads. And so if the module is inserted back again, we get warning for duplicate OPPs as the same were already present. Also, there might be a need to remove dynamic OPPs in future and so API for that is also added. This patch adds helper APIs to remove/free existing static and dynamic OPPs. Because the OPPs are used both under RCU and SRCU, we have to wait for grace period of both. And so are using kfree_rcu() from within call_srcu(). Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/pm_opp.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index 0330217abfad..cec2d4540914 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -21,7 +21,7 @@ struct dev_pm_opp;
21struct device; 21struct device;
22 22
23enum dev_pm_opp_event { 23enum dev_pm_opp_event {
24 OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, 24 OPP_EVENT_ADD, OPP_EVENT_REMOVE, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
25}; 25};
26 26
27#if defined(CONFIG_PM_OPP) 27#if defined(CONFIG_PM_OPP)
@@ -44,6 +44,7 @@ struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
44 44
45int dev_pm_opp_add(struct device *dev, unsigned long freq, 45int dev_pm_opp_add(struct device *dev, unsigned long freq,
46 unsigned long u_volt); 46 unsigned long u_volt);
47void dev_pm_opp_remove(struct device *dev, unsigned long freq);
47 48
48int dev_pm_opp_enable(struct device *dev, unsigned long freq); 49int dev_pm_opp_enable(struct device *dev, unsigned long freq);
49 50
@@ -90,6 +91,10 @@ static inline int dev_pm_opp_add(struct device *dev, unsigned long freq,
90 return -EINVAL; 91 return -EINVAL;
91} 92}
92 93
94static inline void dev_pm_opp_remove(struct device *dev, unsigned long freq)
95{
96}
97
93static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq) 98static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq)
94{ 99{
95 return 0; 100 return 0;
@@ -109,11 +114,16 @@ static inline struct srcu_notifier_head *dev_pm_opp_get_notifier(
109 114
110#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) 115#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
111int of_init_opp_table(struct device *dev); 116int of_init_opp_table(struct device *dev);
117void of_free_opp_table(struct device *dev);
112#else 118#else
113static inline int of_init_opp_table(struct device *dev) 119static inline int of_init_opp_table(struct device *dev)
114{ 120{
115 return -EINVAL; 121 return -EINVAL;
116} 122}
123
124static inline void of_free_opp_table(struct device *dev)
125{
126}
117#endif 127#endif
118 128
119#endif /* __LINUX_OPP_H__ */ 129#endif /* __LINUX_OPP_H__ */