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>
This commit is contained in:
parent
0779726cc2
commit
ea83f81b48
1 changed files with 1 additions and 12 deletions
|
@ -460,17 +460,6 @@ int opp_add(struct device *dev, unsigned long freq, unsigned long u_volt)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* opp_free_rcu() - helper to clear the struct opp when grace period has
|
|
||||||
* elapsed without blocking the the caller of opp_set_availability
|
|
||||||
*/
|
|
||||||
static void opp_free_rcu(struct rcu_head *head)
|
|
||||||
{
|
|
||||||
struct opp *opp = container_of(head, struct opp, head);
|
|
||||||
|
|
||||||
kfree(opp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* opp_set_availability() - helper to set the availability of an opp
|
* opp_set_availability() - helper to set the availability of an opp
|
||||||
* @dev: device for which we do this operation
|
* @dev: device for which we do this operation
|
||||||
|
@ -542,7 +531,7 @@ static int opp_set_availability(struct device *dev, unsigned long freq,
|
||||||
|
|
||||||
list_replace_rcu(&opp->node, &new_opp->node);
|
list_replace_rcu(&opp->node, &new_opp->node);
|
||||||
mutex_unlock(&dev_opp_list_lock);
|
mutex_unlock(&dev_opp_list_lock);
|
||||||
call_rcu(&opp->head, opp_free_rcu);
|
kfree_rcu(opp, head);
|
||||||
|
|
||||||
/* Notify the change of the OPP availability */
|
/* Notify the change of the OPP availability */
|
||||||
if (availability_req)
|
if (availability_req)
|
||||||
|
|
Loading…
Add table
Reference in a new issue