PM: OPP: introduce function to free cpufreq table
Subsystems (4)
PATCH v2 1/1 PM: OPP: introduce function to free cpufreq table
cpufreq table allocated by opp_init_cpufreq_table is better freed by OPP layer itself. This allows future modifications to the table handling to be transparent to the users.
---
V2: removed lock of free.
V1: http://marc.info/?t=130619241700001&r=1&w=2
Example discussion: http://marc.info/?t=130570440600005&r=1&w=2
Documentation/power/opp.txt | 2 ++ drivers/base/power/opp.c | 17 +++++++++++++++++ include/linux/opp.h | 8 ++++++++ 3 files changed, 27 insertions(+), 0 deletions(-)
Documentation/power/opp.txt +2 -0
@@ -321,6 +321,8 @@ opp_init_cpufreq_table - cpufreq framework typically is initialized with addition to CONFIG_PM as power management feature is required to dynamically scale voltage and frequency in a system. +opp_free_cpufreq_table - Free up the table allocated by opp_init_cpufreq_table + 7. Data Structures ================== Typically an SoC contains multiple voltage domains which are variable. Each
drivers/base/power/opp.c +17 -0
@@ -625,4 +625,21 @@ int opp_init_cpufreq_table(struct device *dev, return 0; } + +/** +* opp_free_cpufreq_table() - free the cpufreq table +* @dev: device for which we do this operation +* @table: table to free +* +* Free up the table allocated by opp_init_cpufreq_table +*/ +void opp_free_cpufreq_table (struct device *dev, +struct cpufreq_frequency_table **table) +{ +if (!table) +return ; + +kfree (*table); + *table =NULL ; +}#endif /* CONFIG_CPU_FREQ */
include/linux/opp.h +8 -0
@@ -94,12 +94,20 @@ static inline int opp_disable(struct device *dev, unsigned long freq)#if defined(CONFIG_CPU_FREQ ) && defined(CONFIG_PM_OPP )int opp_init_cpufreq_table (struct device *dev,struct cpufreq_frequency_table **table); +void opp_free_cpufreq_table (struct device *dev, +struct cpufreq_frequency_table **table);#else static inline int opp_init_cpufreq_table (struct device *dev,struct cpufreq_frequency_table **table) {return -EINVAL ; } + +static inline +void opp_free_cpufreq_table (struct device *dev, +struct cpufreq_frequency_table **table) +{ +}#endif /* CONFIG_CPU_FREQ */ #endif /* __LINUX_OPP_H__ */
Signature · 1 line
1.7.1
Quoted 5 lines · Nishanth Menon
cpufreq table allocated by
opp_init_cpufreq_tableis better freed by OPP layer itself. This allows future modifications to the table handling to be transparent to the users.Signed-off-by Nishanth Menon <[email protected]>
Quoted 5 lines · Nishanth Menon
cpufreq table allocated by
opp_init_cpufreq_tableis better freed by OPP layer itself. This allows future modifications to the table handling to be transparent to the users.Signed-off-by Nishanth Menon <[email protected]>
Rafael J. Wysocki
AppliedQuoted 9 lines · Kevin Hilman
Quoted 5 lines · Nishanth Menon
cpufreq table allocated by
opp_init_cpufreq_tableis better freed by OPP layer itself. This allows future modifications to the table handling to be transparent to the users.Signed-off-by Nishanth Menon <[email protected]>Acked-by Kevin Hilman <[email protected]>
Applied to suspend-2.6/linux-next.
Thanks!
Rafael J. Wysocki
AppliedQuoted 9 lines · Kevin Hilman
Quoted 5 lines · Nishanth Menon
cpufreq table allocated by
opp_init_cpufreq_tableis better freed by OPP layer itself. This allows future modifications to the table handling to be transparent to the users.Signed-off-by Nishanth Menon <[email protected]>Acked-by Kevin Hilman <[email protected]>
Applied to suspend-2.6/linux-next.
Thanks!