[PATCH 4/8] opp: Introduce APIs to remove OPPs

Viresh Kumar viresh.kumar at linaro.org
Wed Nov 26 01:17:47 PST 2014


On 26 November 2014 at 11:59, Viresh Kumar <viresh.kumar at 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)



More information about the linux-arm-kernel mailing list