diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2014-11-25 11:34:17 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-11-29 23:53:20 +0100 |
commit | a7470db6fec481b14afea117846fce383671ba59 (patch) | |
tree | ac6435ce63ef40718267cf14e0a4d3a77f564844 /drivers/base | |
parent | PM / OPP rename 'head' as 'rcu_head' or 'srcu_head' based on its type (diff) | |
download | linux-a7470db6fec481b14afea117846fce383671ba59.tar.xz linux-a7470db6fec481b14afea117846fce383671ba59.zip |
PM / OPP don't match for existing OPPs when list is empty
OPP list is guaranteed to be empty when 'dev_opp' is created. And so we don't
need to run the comparison loop with existing OPPs.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/opp.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index 76ae6fd28345..a333e2ef5cb2 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -417,6 +417,12 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) /* Hold our list modification lock here */ mutex_lock(&dev_opp_list_lock); + /* populate the opp table */ + new_opp->dev_opp = dev_opp; + new_opp->rate = freq; + new_opp->u_volt = u_volt; + new_opp->available = true; + /* Check for existing list for 'dev' */ dev_opp = find_device_opp(dev); if (IS_ERR(dev_opp)) { @@ -441,14 +447,10 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) /* Secure the device list modification */ list_add_rcu(&dev_opp->node, &dev_opp_list); + head = &dev_opp->opp_list; + goto list_add; } - /* populate the opp table */ - new_opp->dev_opp = dev_opp; - new_opp->rate = freq; - new_opp->u_volt = u_volt; - new_opp->available = true; - /* * Insert new OPP in order of increasing frequency * and discard if already present @@ -474,6 +476,7 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) return ret; } +list_add: list_add_rcu(&new_opp->node, head); mutex_unlock(&dev_opp_list_lock); |