Re: [PATCH v2] PM / OPP: Implement opp_remove and free_opp_table functions

From: Inderpal Singh
Date: Wed May 21 2014 - 04:06:39 EST


On Wed, May 21, 2014 at 1:25 PM, Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> On 21 May 2014 11:21, Inderpal Singh <inderpal.s@xxxxxxxxxxx> wrote:
>> At the driver unloading time the associated opps and its table may need
>> to be deleted. Otherwise it amounts to memory leak. The existing
>> OPP library does not have provision to do so.
>>
>> Hence this patch implements the required functions to free the same.
>>
>> Signed-off-by: Inderpal Singh <inderpal.s@xxxxxxxxxxx>
>> ---
>> Changes in v2:
>> - As suggested by Nishanth, added support to remove a single OPP
>> for non-DT users
>> - Added an internal helper function to avoid the code duplication
>> between opp_remove and free_opp_table functions
>>
>> drivers/base/power/opp.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++-
>> include/linux/pm_opp.h | 14 +++++-
>> 2 files changed, 134 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
>> index faae9cf..22adef3 100644
>> --- a/drivers/base/power/opp.c
>> +++ b/drivers/base/power/opp.c
>> @@ -89,6 +89,7 @@ struct device_opp {
>> struct device *dev;
>> struct srcu_notifier_head head;
>> struct list_head opp_list;
>> + struct rcu_head head_rcu;
>
> This isn't used ...

Its being used in opp_remove_and_free function to free dev_opp with kfree_rcu.

>
>> };
>>
>> /*
>> @@ -427,7 +428,6 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt)
>> __func__);
>> return -ENOMEM;
>> }
>> -
>
> Unrelated change.

Ahhh, missed it. Thanks for pointing.

> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/