aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2014-11-25 05:34:17 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-11-29 17:53:20 -0500
commita7470db6fec481b14afea117846fce383671ba59 (patch)
treeac6435ce63ef40718267cf14e0a4d3a77f564844
parentcd1a068a52ee6a3331a62fe53e87d6ca6cfd68a5 (diff)
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>
-rw-r--r--drivers/base/power/opp.c15
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)
417 /* Hold our list modification lock here */ 417 /* Hold our list modification lock here */
418 mutex_lock(&dev_opp_list_lock); 418 mutex_lock(&dev_opp_list_lock);
419 419
420 /* populate the opp table */
421 new_opp->dev_opp = dev_opp;
422 new_opp->rate = freq;
423 new_opp->u_volt = u_volt;
424 new_opp->available = true;
425
420 /* Check for existing list for 'dev' */ 426 /* Check for existing list for 'dev' */
421 dev_opp = find_device_opp(dev); 427 dev_opp = find_device_opp(dev);
422 if (IS_ERR(dev_opp)) { 428 if (IS_ERR(dev_opp)) {
@@ -441,14 +447,10 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt)
441 447
442 /* Secure the device list modification */ 448 /* Secure the device list modification */
443 list_add_rcu(&dev_opp->node, &dev_opp_list); 449 list_add_rcu(&dev_opp->node, &dev_opp_list);
450 head = &dev_opp->opp_list;
451 goto list_add;
444 } 452 }
445 453
446 /* populate the opp table */
447 new_opp->dev_opp = dev_opp;
448 new_opp->rate = freq;
449 new_opp->u_volt = u_volt;
450 new_opp->available = true;
451
452 /* 454 /*
453 * Insert new OPP in order of increasing frequency 455 * Insert new OPP in order of increasing frequency
454 * and discard if already present 456 * and discard if already present
@@ -474,6 +476,7 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt)
474 return ret; 476 return ret;
475 } 477 }
476 478
479list_add:
477 list_add_rcu(&new_opp->node, head); 480 list_add_rcu(&new_opp->node, head);
478 mutex_unlock(&dev_opp_list_lock); 481 mutex_unlock(&dev_opp_list_lock);
479 482