PM / OPP: rename data structures to dev_pm equivalents
Since Operating Performance Points (OPP) data structures are specific to device specific power management, be specific and rename opp_* data structures in OPP library with dev_pm_opp_* equivalent. Affected structures are: struct opp enum opp_event Minor checkpatch warning resulting of this change was fixed as well. Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
5d4879cda6
commit
47d43ba73e
12 changed files with 60 additions and 53 deletions
|
@ -358,14 +358,14 @@ accessed by various functions as described above. However, the structures
|
|||
representing the actual OPPs and domains are internal to the OPP library itself
|
||||
to allow for suitable abstraction reusable across systems.
|
||||
|
||||
struct opp - The internal data structure of OPP library which is used to
|
||||
struct dev_pm_opp - The internal data structure of OPP library which is used to
|
||||
represent an OPP. In addition to the freq, voltage, availability
|
||||
information, it also contains internal book keeping information required
|
||||
for the OPP library to operate on. Pointer to this structure is
|
||||
provided back to the users such as SoC framework to be used as a
|
||||
identifier for OPP in the interactions with OPP layer.
|
||||
|
||||
WARNING: The struct opp pointer should not be parsed or modified by the
|
||||
WARNING: The struct dev_pm_opp pointer should not be parsed or modified by the
|
||||
users. The defaults of for an instance is populated by dev_pm_opp_add, but the
|
||||
availability of the OPP can be modified by dev_pm_opp_enable/disable functions.
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
|
|||
{
|
||||
struct voltagedomain *voltdm;
|
||||
struct clk *clk;
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
unsigned long freq, bootup_volt;
|
||||
struct device *dev;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* struct opp - Generic OPP description structure
|
||||
* struct dev_pm_opp - Generic OPP description structure
|
||||
* @node: opp list node. The nodes are maintained throughout the lifetime
|
||||
* of boot. It is expected only an optimal set of OPPs are
|
||||
* added to the library by the SoC framework.
|
||||
|
@ -59,7 +59,7 @@
|
|||
*
|
||||
* This structure stores the OPP information for a given device.
|
||||
*/
|
||||
struct opp {
|
||||
struct dev_pm_opp {
|
||||
struct list_head node;
|
||||
|
||||
bool available;
|
||||
|
@ -150,9 +150,9 @@ static struct device_opp *find_device_opp(struct device *dev)
|
|||
* prior to unlocking with rcu_read_unlock() to maintain the integrity of the
|
||||
* pointer.
|
||||
*/
|
||||
unsigned long dev_pm_opp_get_voltage(struct opp *opp)
|
||||
unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
|
||||
{
|
||||
struct opp *tmp_opp;
|
||||
struct dev_pm_opp *tmp_opp;
|
||||
unsigned long v = 0;
|
||||
|
||||
tmp_opp = rcu_dereference(opp);
|
||||
|
@ -180,9 +180,9 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_voltage);
|
|||
* prior to unlocking with rcu_read_unlock() to maintain the integrity of the
|
||||
* pointer.
|
||||
*/
|
||||
unsigned long dev_pm_opp_get_freq(struct opp *opp)
|
||||
unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
|
||||
{
|
||||
struct opp *tmp_opp;
|
||||
struct dev_pm_opp *tmp_opp;
|
||||
unsigned long f = 0;
|
||||
|
||||
tmp_opp = rcu_dereference(opp);
|
||||
|
@ -209,7 +209,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq);
|
|||
int dev_pm_opp_get_opp_count(struct device *dev)
|
||||
{
|
||||
struct device_opp *dev_opp;
|
||||
struct opp *temp_opp;
|
||||
struct dev_pm_opp *temp_opp;
|
||||
int count = 0;
|
||||
|
||||
dev_opp = find_device_opp(dev);
|
||||
|
@ -254,11 +254,12 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_opp_count);
|
|||
* under the locked area. The pointer returned must be used prior to unlocking
|
||||
* with rcu_read_unlock() to maintain the integrity of the pointer.
|
||||
*/
|
||||
struct opp *dev_pm_opp_find_freq_exact(struct device *dev, unsigned long freq,
|
||||
bool available)
|
||||
struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
|
||||
unsigned long freq,
|
||||
bool available)
|
||||
{
|
||||
struct device_opp *dev_opp;
|
||||
struct opp *temp_opp, *opp = ERR_PTR(-ERANGE);
|
||||
struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE);
|
||||
|
||||
dev_opp = find_device_opp(dev);
|
||||
if (IS_ERR(dev_opp)) {
|
||||
|
@ -300,10 +301,11 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_exact);
|
|||
* under the locked area. The pointer returned must be used prior to unlocking
|
||||
* with rcu_read_unlock() to maintain the integrity of the pointer.
|
||||
*/
|
||||
struct opp *dev_pm_opp_find_freq_ceil(struct device *dev, unsigned long *freq)
|
||||
struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
|
||||
unsigned long *freq)
|
||||
{
|
||||
struct device_opp *dev_opp;
|
||||
struct opp *temp_opp, *opp = ERR_PTR(-ERANGE);
|
||||
struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE);
|
||||
|
||||
if (!dev || !freq) {
|
||||
dev_err(dev, "%s: Invalid argument freq=%p\n", __func__, freq);
|
||||
|
@ -347,10 +349,11 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_ceil);
|
|||
* under the locked area. The pointer returned must be used prior to unlocking
|
||||
* with rcu_read_unlock() to maintain the integrity of the pointer.
|
||||
*/
|
||||
struct opp *dev_pm_opp_find_freq_floor(struct device *dev, unsigned long *freq)
|
||||
struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
|
||||
unsigned long *freq)
|
||||
{
|
||||
struct device_opp *dev_opp;
|
||||
struct opp *temp_opp, *opp = ERR_PTR(-ERANGE);
|
||||
struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE);
|
||||
|
||||
if (!dev || !freq) {
|
||||
dev_err(dev, "%s: Invalid argument freq=%p\n", __func__, freq);
|
||||
|
@ -396,11 +399,11 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_floor);
|
|||
int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt)
|
||||
{
|
||||
struct device_opp *dev_opp = NULL;
|
||||
struct opp *opp, *new_opp;
|
||||
struct dev_pm_opp *opp, *new_opp;
|
||||
struct list_head *head;
|
||||
|
||||
/* allocate new OPP node */
|
||||
new_opp = kzalloc(sizeof(struct opp), GFP_KERNEL);
|
||||
new_opp = kzalloc(sizeof(*new_opp), GFP_KERNEL);
|
||||
if (!new_opp) {
|
||||
dev_warn(dev, "%s: Unable to create new OPP node\n", __func__);
|
||||
return -ENOMEM;
|
||||
|
@ -485,11 +488,11 @@ static int opp_set_availability(struct device *dev, unsigned long freq,
|
|||
bool availability_req)
|
||||
{
|
||||
struct device_opp *tmp_dev_opp, *dev_opp = ERR_PTR(-ENODEV);
|
||||
struct opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV);
|
||||
struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV);
|
||||
int r = 0;
|
||||
|
||||
/* keep the node allocated */
|
||||
new_opp = kmalloc(sizeof(struct opp), GFP_KERNEL);
|
||||
new_opp = kmalloc(sizeof(*new_opp), GFP_KERNEL);
|
||||
if (!new_opp) {
|
||||
dev_warn(dev, "%s: Unable to create OPP\n", __func__);
|
||||
return -ENOMEM;
|
||||
|
@ -623,7 +626,7 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev,
|
|||
struct cpufreq_frequency_table **table)
|
||||
{
|
||||
struct device_opp *dev_opp;
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
struct cpufreq_frequency_table *freq_table;
|
||||
int i = 0;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
|
|||
unsigned int target_freq, unsigned int relation)
|
||||
{
|
||||
struct cpufreq_freqs freqs;
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
unsigned long volt = 0, volt_old = 0, tol = 0;
|
||||
long freq_Hz, freq_exact;
|
||||
unsigned int index;
|
||||
|
@ -230,7 +230,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
|
|||
transition_latency = CPUFREQ_ETERNAL;
|
||||
|
||||
if (!IS_ERR(cpu_reg)) {
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
unsigned long min_uV, max_uV;
|
||||
int i;
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ static int init_div_table(void)
|
|||
struct cpufreq_frequency_table *freq_tbl = dvfs_info->freq_table;
|
||||
unsigned int tmp, clk_div, ema_div, freq, volt_id;
|
||||
int i = 0;
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
|
||||
rcu_read_lock();
|
||||
for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) {
|
||||
|
|
|
@ -49,7 +49,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy,
|
|||
unsigned int target_freq, unsigned int relation)
|
||||
{
|
||||
struct cpufreq_freqs freqs;
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
unsigned long freq_hz, volt, volt_old;
|
||||
unsigned int index;
|
||||
int ret;
|
||||
|
@ -199,7 +199,7 @@ static struct cpufreq_driver imx6q_cpufreq_driver = {
|
|||
static int imx6q_cpufreq_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *np;
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
unsigned long min_volt, max_volt;
|
||||
int num, ret;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ static int omap_target(struct cpufreq_policy *policy,
|
|||
unsigned int i;
|
||||
int r, ret = 0;
|
||||
struct cpufreq_freqs freqs;
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
unsigned long freq, volt = 0, volt_old = 0, tol = 0;
|
||||
|
||||
if (!freq_table) {
|
||||
|
|
|
@ -902,7 +902,7 @@ static ssize_t available_frequencies_show(struct device *d,
|
|||
{
|
||||
struct devfreq *df = to_devfreq(d);
|
||||
struct device *dev = df->dev.parent;
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
ssize_t count = 0;
|
||||
unsigned long freq = 0;
|
||||
|
||||
|
@ -1029,10 +1029,11 @@ module_exit(devfreq_exit);
|
|||
* under the locked area. The pointer returned must be used prior to unlocking
|
||||
* with rcu_read_unlock() to maintain the integrity of the pointer.
|
||||
*/
|
||||
struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq,
|
||||
u32 flags)
|
||||
struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
|
||||
unsigned long *freq,
|
||||
u32 flags)
|
||||
{
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
|
||||
if (flags & DEVFREQ_FLAG_LEAST_UPPER_BOUND) {
|
||||
/* The freq is an upper bound. opp should be lower */
|
||||
|
|
|
@ -639,7 +639,7 @@ static int exynos4_bus_target(struct device *dev, unsigned long *_freq,
|
|||
struct platform_device *pdev = container_of(dev, struct platform_device,
|
||||
dev);
|
||||
struct busfreq_data *data = platform_get_drvdata(pdev);
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
unsigned long freq;
|
||||
unsigned long old_freq = data->curr_oppinfo.rate;
|
||||
struct busfreq_opp_info new_oppinfo;
|
||||
|
@ -956,7 +956,7 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this,
|
|||
{
|
||||
struct busfreq_data *data = container_of(this, struct busfreq_data,
|
||||
pm_notifier);
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
struct busfreq_opp_info new_oppinfo;
|
||||
unsigned long maxfreq = ULONG_MAX;
|
||||
int err = 0;
|
||||
|
@ -1020,7 +1020,7 @@ unlock:
|
|||
static int exynos4_busfreq_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct busfreq_data *data;
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
struct device *dev = &pdev->dev;
|
||||
int err = 0;
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ static int exynos5_busfreq_int_target(struct device *dev, unsigned long *_freq,
|
|||
struct platform_device *pdev = container_of(dev, struct platform_device,
|
||||
dev);
|
||||
struct busfreq_data_int *data = platform_get_drvdata(pdev);
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
unsigned long old_freq, freq;
|
||||
unsigned long volt;
|
||||
|
||||
|
@ -262,7 +262,7 @@ static int exynos5_busfreq_int_pm_notifier_event(struct notifier_block *this,
|
|||
{
|
||||
struct busfreq_data_int *data = container_of(this,
|
||||
struct busfreq_data_int, pm_notifier);
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
unsigned long maxfreq = ULONG_MAX;
|
||||
unsigned long freq;
|
||||
unsigned long volt;
|
||||
|
@ -316,7 +316,7 @@ unlock:
|
|||
static int exynos5_busfreq_int_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct busfreq_data_int *data;
|
||||
struct opp *opp;
|
||||
struct dev_pm_opp *opp;
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *np;
|
||||
unsigned long initial_freq;
|
||||
|
|
|
@ -187,7 +187,7 @@ extern int devfreq_suspend_device(struct devfreq *devfreq);
|
|||
extern int devfreq_resume_device(struct devfreq *devfreq);
|
||||
|
||||
/* Helper functions for devfreq user device driver with OPP. */
|
||||
extern struct opp *devfreq_recommended_opp(struct device *dev,
|
||||
extern struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
|
||||
unsigned long *freq, u32 flags);
|
||||
extern int devfreq_register_opp_notifier(struct device *dev,
|
||||
struct devfreq *devfreq);
|
||||
|
@ -238,7 +238,7 @@ static inline int devfreq_resume_device(struct devfreq *devfreq)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline struct opp *devfreq_recommended_opp(struct device *dev,
|
||||
static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
|
||||
unsigned long *freq, u32 flags)
|
||||
{
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
|
|
@ -18,27 +18,30 @@
|
|||
#include <linux/cpufreq.h>
|
||||
#include <linux/notifier.h>
|
||||
|
||||
struct opp;
|
||||
struct dev_pm_opp;
|
||||
struct device;
|
||||
|
||||
enum opp_event {
|
||||
enum dev_pm_opp_event {
|
||||
OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
|
||||
};
|
||||
|
||||
#if defined(CONFIG_PM_OPP)
|
||||
|
||||
unsigned long dev_pm_opp_get_voltage(struct opp *opp);
|
||||
unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);
|
||||
|
||||
unsigned long dev_pm_opp_get_freq(struct opp *opp);
|
||||
unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp);
|
||||
|
||||
int dev_pm_opp_get_opp_count(struct device *dev);
|
||||
|
||||
struct opp *dev_pm_opp_find_freq_exact(struct device *dev, unsigned long freq,
|
||||
bool available);
|
||||
struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
|
||||
unsigned long freq,
|
||||
bool available);
|
||||
|
||||
struct opp *dev_pm_opp_find_freq_floor(struct device *dev, unsigned long *freq);
|
||||
struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
|
||||
unsigned long *freq);
|
||||
|
||||
struct opp *dev_pm_opp_find_freq_ceil(struct device *dev, unsigned long *freq);
|
||||
struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
|
||||
unsigned long *freq);
|
||||
|
||||
int dev_pm_opp_add(struct device *dev, unsigned long freq,
|
||||
unsigned long u_volt);
|
||||
|
@ -49,12 +52,12 @@ int dev_pm_opp_disable(struct device *dev, unsigned long freq);
|
|||
|
||||
struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev);
|
||||
#else
|
||||
static inline unsigned long dev_pm_opp_get_voltage(struct opp *opp)
|
||||
static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long dev_pm_opp_get_freq(struct opp *opp)
|
||||
static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -64,19 +67,19 @@ static inline int dev_pm_opp_get_opp_count(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline struct opp *dev_pm_opp_find_freq_exact(struct device *dev,
|
||||
static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
|
||||
unsigned long freq, bool available)
|
||||
{
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
static inline struct opp *dev_pm_opp_find_freq_floor(struct device *dev,
|
||||
static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
|
||||
unsigned long *freq)
|
||||
{
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
static inline struct opp *dev_pm_opp_find_freq_ceil(struct device *dev,
|
||||
static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
|
||||
unsigned long *freq)
|
||||
{
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
|
Loading…
Reference in a new issue