aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2012-10-30 20:29:17 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-11-14 18:36:10 -0500
commitea83f81b489be3be268ed7fabfe8dd94bdc45a29 (patch)
tree02a79b38fec0c8fad31acbfa03b820ae00c242af /drivers/base/power
parent0779726cc265805d0f7c7dd1d791fa4076b31a9a (diff)
PM / OPP: using kfree_rcu() to simplify the code
The callback function of call_rcu() just calls a kfree(), so we can use kfree_rcu() instead of call_rcu() + callback function. dpatch engine is used to auto generate this patch. (https://github.com/weiyj/dpatch) Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/power')
-rw-r--r--drivers/base/power/opp.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index c8a908b099c0..50b2831e027d 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -461,17 +461,6 @@ int opp_add(struct device *dev, unsigned long freq, unsigned long u_volt)
461} 461}
462 462
463/** 463/**
464 * opp_free_rcu() - helper to clear the struct opp when grace period has
465 * elapsed without blocking the the caller of opp_set_availability
466 */
467static void opp_free_rcu(struct rcu_head *head)
468{
469 struct opp *opp = container_of(head, struct opp, head);
470
471 kfree(opp);
472}
473
474/**
475 * opp_set_availability() - helper to set the availability of an opp 464 * opp_set_availability() - helper to set the availability of an opp
476 * @dev: device for which we do this operation 465 * @dev: device for which we do this operation
477 * @freq: OPP frequency to modify availability 466 * @freq: OPP frequency to modify availability
@@ -542,7 +531,7 @@ static int opp_set_availability(struct device *dev, unsigned long freq,
542 531
543 list_replace_rcu(&opp->node, &new_opp->node); 532 list_replace_rcu(&opp->node, &new_opp->node);
544 mutex_unlock(&dev_opp_list_lock); 533 mutex_unlock(&dev_opp_list_lock);
545 call_rcu(&opp->head, opp_free_rcu); 534 kfree_rcu(opp, head);
546 535
547 /* Notify the change of the OPP availability */ 536 /* Notify the change of the OPP availability */
548 if (availability_req) 537 if (availability_req)