diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-06-03 23:13:20 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-06-03 23:13:20 +0200 |
commit | 057beb1de54d33ecfd3397ed219b1f4518e3b470 (patch) | |
tree | 7c67e9d8c88093a3d551111e56401826a964ffba /drivers/base/power/opp.c | |
parent | 42a09284fab8abc15c8554f2e2aa2368161c77c6 (diff) | |
parent | 5ece2399181a5abaf42a4cb607463770686778e6 (diff) |
Merge branch 'pm-cpufreq'
* pm-cpufreq: (28 commits)
cpufreq: handle calls to ->target_index() in separate routine
cpufreq: s5pv210: drop check for CONFIG_PM_VERBOSE
cpufreq: intel_pstate: Remove unused member name of cpudata
cpufreq: Break out early when frequency equals target_freq
cpufreq: Tegra: drop wrapper around tegra_update_cpu_speed()
cpufreq: imx6q: Remove unused include
cpufreq: imx6q: Drop devm_clk/regulator_get usage
cpufreq: powernow-k8: Suppress checkpatch warnings
cpufreq: powernv: make local function static
cpufreq: Enable big.LITTLE cpufreq driver on arm64
cpufreq: nforce2: remove DEFINE_PCI_DEVICE_TABLE macro
intel_pstate: Add CPU IDs for Broadwell processors
cpufreq: Fix build error on some platforms that use cpufreq_for_each_*
PM / OPP: Move cpufreq specific OPP functions out of generic OPP library
PM / OPP: Remove cpufreq wrapper dependency on internal data organization
cpufreq: Catch double invocations of cpufreq_freq_transition_begin/end
intel_pstate: Remove sample parameter in intel_pstate_calc_busy
cpufreq: Kconfig: Fix spelling errors
cpufreq: Make linux-pm@vger.kernel.org official mailing list
cpufreq: exynos: Use dev_err/info function instead of pr_err/info
...
Diffstat (limited to 'drivers/base/power/opp.c')
-rw-r--r-- | drivers/base/power/opp.c | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index 39412c15db70..89ced955fafa 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -15,7 +15,6 @@ #include <linux/errno.h> #include <linux/err.h> #include <linux/slab.h> -#include <linux/cpufreq.h> #include <linux/device.h> #include <linux/list.h> #include <linux/rculist.h> @@ -619,96 +618,6 @@ int dev_pm_opp_disable(struct device *dev, unsigned long freq) } EXPORT_SYMBOL_GPL(dev_pm_opp_disable); -#ifdef CONFIG_CPU_FREQ -/** - * dev_pm_opp_init_cpufreq_table() - create a cpufreq table for a device - * @dev: device for which we do this operation - * @table: Cpufreq table returned back to caller - * - * Generate a cpufreq table for a provided device- this assumes that the - * opp list is already initialized and ready for usage. - * - * This function allocates required memory for the cpufreq table. It is - * expected that the caller does the required maintenance such as freeing - * the table as required. - * - * Returns -EINVAL for bad pointers, -ENODEV if the device is not found, -ENOMEM - * if no memory available for the operation (table is not populated), returns 0 - * if successful and table is populated. - * - * WARNING: It is important for the callers to ensure refreshing their copy of - * the table if any of the mentioned functions have been invoked in the interim. - * - * Locking: The internal device_opp and opp structures are RCU protected. - * To simplify the logic, we pretend we are updater and hold relevant mutex here - * Callers should ensure that this function is *NOT* called under RCU protection - * or in contexts where mutex locking cannot be used. - */ -int dev_pm_opp_init_cpufreq_table(struct device *dev, - struct cpufreq_frequency_table **table) -{ - struct device_opp *dev_opp; - struct dev_pm_opp *opp; - struct cpufreq_frequency_table *freq_table; - int i = 0; - - /* Pretend as if I am an updater */ - mutex_lock(&dev_opp_list_lock); - - dev_opp = find_device_opp(dev); - if (IS_ERR(dev_opp)) { - int r = PTR_ERR(dev_opp); - mutex_unlock(&dev_opp_list_lock); - dev_err(dev, "%s: Device OPP not found (%d)\n", __func__, r); - return r; - } - - freq_table = kzalloc(sizeof(struct cpufreq_frequency_table) * - (dev_pm_opp_get_opp_count(dev) + 1), GFP_KERNEL); - if (!freq_table) { - mutex_unlock(&dev_opp_list_lock); - dev_warn(dev, "%s: Unable to allocate frequency table\n", - __func__); - return -ENOMEM; - } - - list_for_each_entry(opp, &dev_opp->opp_list, node) { - if (opp->available) { - freq_table[i].driver_data = i; - freq_table[i].frequency = opp->rate / 1000; - i++; - } - } - mutex_unlock(&dev_opp_list_lock); - - freq_table[i].driver_data = i; - freq_table[i].frequency = CPUFREQ_TABLE_END; - - *table = &freq_table[0]; - - return 0; -} -EXPORT_SYMBOL_GPL(dev_pm_opp_init_cpufreq_table); - -/** - * dev_pm_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 dev_pm_opp_init_cpufreq_table - */ -void dev_pm_opp_free_cpufreq_table(struct device *dev, - struct cpufreq_frequency_table **table) -{ - if (!table) - return; - - kfree(*table); - *table = NULL; -} -EXPORT_SYMBOL_GPL(dev_pm_opp_free_cpufreq_table); -#endif /* CONFIG_CPU_FREQ */ - /** * dev_pm_opp_get_notifier() - find notifier_head of the device with opp * @dev: device pointer used to lookup device OPPs. |