mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
PM / OPP: Create _remove_device_opp() for freeing dev_opp
This will be used from multiple places later. Lets create a separate routine for that. Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
737002b5de
commit
3bac42caec
1 changed files with 17 additions and 5 deletions
|
@ -448,6 +448,22 @@ static void _kfree_device_rcu(struct rcu_head *head)
|
|||
kfree_rcu(device_opp, rcu_head);
|
||||
}
|
||||
|
||||
/**
|
||||
* _remove_device_opp() - Removes a device OPP table
|
||||
* @dev_opp: device OPP table to be removed.
|
||||
*
|
||||
* Removes/frees device OPP table it it doesn't contain any OPPs.
|
||||
*/
|
||||
static void _remove_device_opp(struct device_opp *dev_opp)
|
||||
{
|
||||
if (!list_empty(&dev_opp->opp_list))
|
||||
return;
|
||||
|
||||
list_del_rcu(&dev_opp->node);
|
||||
call_srcu(&dev_opp->srcu_head.srcu, &dev_opp->rcu_head,
|
||||
_kfree_device_rcu);
|
||||
}
|
||||
|
||||
/**
|
||||
* _kfree_opp_rcu() - Free OPP RCU handler
|
||||
* @head: RCU head
|
||||
|
@ -481,11 +497,7 @@ static void _opp_remove(struct device_opp *dev_opp,
|
|||
list_del_rcu(&opp->node);
|
||||
call_srcu(&dev_opp->srcu_head.srcu, &opp->rcu_head, _kfree_opp_rcu);
|
||||
|
||||
if (list_empty(&dev_opp->opp_list)) {
|
||||
list_del_rcu(&dev_opp->node);
|
||||
call_srcu(&dev_opp->srcu_head.srcu, &dev_opp->rcu_head,
|
||||
_kfree_device_rcu);
|
||||
}
|
||||
_remove_device_opp(dev_opp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue