aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/power/opp.txt2
-rw-r--r--drivers/base/power/opp.c17
-rw-r--r--include/linux/opp.h8
3 files changed, 27 insertions, 0 deletions
diff --git a/Documentation/power/opp.txt b/Documentation/power/opp.txt
index 5ae70a12c1e2..3035d00757ad 100644
--- a/Documentation/power/opp.txt
+++ b/Documentation/power/opp.txt
@@ -321,6 +321,8 @@ opp_init_cpufreq_table - cpufreq framework typically is initialized with
321 addition to CONFIG_PM as power management feature is required to 321 addition to CONFIG_PM as power management feature is required to
322 dynamically scale voltage and frequency in a system. 322 dynamically scale voltage and frequency in a system.
323 323
324opp_free_cpufreq_table - Free up the table allocated by opp_init_cpufreq_table
325
3247. Data Structures 3267. Data Structures
325================== 327==================
326Typically an SoC contains multiple voltage domains which are variable. Each 328Typically an SoC contains multiple voltage domains which are variable. Each
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index 56a6899f5e9e..5cc12322ef32 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -625,4 +625,21 @@ int opp_init_cpufreq_table(struct device *dev,
625 625
626 return 0; 626 return 0;
627} 627}
628
629/**
630 * opp_free_cpufreq_table() - free the cpufreq table
631 * @dev: device for which we do this operation
632 * @table: table to free
633 *
634 * Free up the table allocated by opp_init_cpufreq_table
635 */
636void opp_free_cpufreq_table(struct device *dev,
637 struct cpufreq_frequency_table **table)
638{
639 if (!table)
640 return;
641
642 kfree(*table);
643 *table = NULL;
644}
628#endif /* CONFIG_CPU_FREQ */ 645#endif /* CONFIG_CPU_FREQ */
diff --git a/include/linux/opp.h b/include/linux/opp.h
index 5449945d589f..7020e9736fc5 100644
--- a/include/linux/opp.h
+++ b/include/linux/opp.h
@@ -94,12 +94,20 @@ static inline int opp_disable(struct device *dev, unsigned long freq)
94#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP) 94#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
95int opp_init_cpufreq_table(struct device *dev, 95int opp_init_cpufreq_table(struct device *dev,
96 struct cpufreq_frequency_table **table); 96 struct cpufreq_frequency_table **table);
97void opp_free_cpufreq_table(struct device *dev,
98 struct cpufreq_frequency_table **table);
97#else 99#else
98static inline int opp_init_cpufreq_table(struct device *dev, 100static inline int opp_init_cpufreq_table(struct device *dev,
99 struct cpufreq_frequency_table **table) 101 struct cpufreq_frequency_table **table)
100{ 102{
101 return -EINVAL; 103 return -EINVAL;
102} 104}
105
106static inline
107void opp_free_cpufreq_table(struct device *dev,
108 struct cpufreq_frequency_table **table)
109{
110}
103#endif /* CONFIG_CPU_FREQ */ 111#endif /* CONFIG_CPU_FREQ */
104 112
105#endif /* __LINUX_OPP_H__ */ 113#endif /* __LINUX_OPP_H__ */