On 26 November 2014 at 11:59, Viresh Kumar viresh.kumar@linaro.org wrote:
Also it looks like I should use call_srcu() with kfree_rcu() for opp_set_availability() case as well to avoid any corner cases.
This is the diff I would be adding to this patch:
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index f9d80e6..3f728cd 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -506,7 +506,7 @@ static void kfree_opp_rcu(struct rcu_head *head) struct dev_pm_opp *opp = container_of(head, struct dev_pm_opp, rcu_head);
pr_info("%s: opp:%p, dynamic:%d\n", __func__, opp, opp->dynamic); - kfree(opp); + kfree_rcu(opp); }
static void kfree_device_rcu(struct rcu_head *head) @@ -644,7 +644,7 @@ static int opp_set_availability(struct device *dev, unsigned long freq,
list_replace_rcu(&opp->node, &new_opp->node); mutex_unlock(&dev_opp_list_lock); - kfree_rcu(opp, rcu_head); + call_srcu(&dev_opp->srcu_head.srcu, &opp->rcu_head, kfree_opp_rcu);
/* Notify the change of the OPP availability */ if (availability_req)