summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-07-29 13:52:59 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-08-07 04:04:22 +0300
commit3bac42caec612a1b82db7944570353cddca6a013 (patch)
tree3bddc9337e935dfb85af04b2914cdd4c7005a218 /drivers/base
parent737002b5de3d15b3012feea17f782a628b24699b (diff)
downloadlinux-3bac42caec612a1b82db7944570353cddca6a013.tar.xz
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>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/opp.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index 8c3fd57975fb..7895fdd64192 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -449,6 +449,22 @@ static void _kfree_device_rcu(struct rcu_head *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);
}
/**