Re: [PATCH v2] PM / OPP: discard duplicate OPP additions

2014-05-16 Thread Viresh Kumar
On 16 May 2014 14:12, Chander Kashyap  wrote:
> On 16 May 2014 13:54, Viresh Kumar  wrote:
>> On 16 May 2014 13:43, Chander Kashyap  wrote:
>>> From: Chander Kashyap 
>>>
>>> It may be possible to unregister and re-register the cpufreq driver.
>>> One such example is arm big-little IKS cpufreq driver. While
>>> re-registering the driver, same OPPs may get added again.
>>>
>>> This patch detects the duplicacy and discards them.
>>
>> Diff looks fine but not the log ofcourse. It doesn't have anything to do with
>> big LITTLE.. Its just a patch to avoid addition of duplicate OPPs..
>>
>
> Big little reference is provided as an example. Nothing much

What I am saying is: "This is not a problem of re-registering drivers
but adding duplicate OPPs and that's what we should emphasize
on in the log". Your log is all focused on how to get re-registering
of a driver working.

>> Also fix spelling mistakes in log..
>>
>> And subject should be:
>> PM / OPP: discard duplicate OPPs
>
> Duplicates are discarded during OPP addition, and subject line indicates that.

I am asking to improve it. Replace:

PM / OPP: discard duplicate OPP additions

with

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


Re: [PATCH v2] PM / OPP: discard duplicate OPP additions

2014-05-16 Thread Chander Kashyap
On 16 May 2014 13:54, Viresh Kumar  wrote:
> On 16 May 2014 13:43, Chander Kashyap  wrote:
>> From: Chander Kashyap 
>>
>> It may be possible to unregister and re-register the cpufreq driver.
>> One such example is arm big-little IKS cpufreq driver. While
>> re-registering the driver, same OPPs may get added again.
>>
>> This patch detects the duplicacy and discards them.
>
> Diff looks fine but not the log ofcourse. It doesn't have anything to do with
> big LITTLE.. Its just a patch to avoid addition of duplicate OPPs..
>

Big little reference is provided as an example. Nothing much

> Also fix spelling mistakes in log..
>
> And subject should be:
> PM / OPP: discard duplicate OPPs

Duplicates are discarded during OPP addition, and subject line indicates that.

-- 
with warm regards,
Chander Kashyap
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] PM / OPP: discard duplicate OPP additions

2014-05-16 Thread Viresh Kumar
On 16 May 2014 13:43, Chander Kashyap  wrote:
> From: Chander Kashyap 
>
> It may be possible to unregister and re-register the cpufreq driver.
> One such example is arm big-little IKS cpufreq driver. While
> re-registering the driver, same OPPs may get added again.
>
> This patch detects the duplicacy and discards them.

Diff looks fine but not the log ofcourse. It doesn't have anything to do with
big LITTLE.. Its just a patch to avoid addition of duplicate OPPs..

Also fix spelling mistakes in log..

And subject should be:
PM / OPP: discard duplicate OPPs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] PM / OPP: discard duplicate OPP additions

2014-05-16 Thread Chander Kashyap
From: Chander Kashyap 

It may be possible to unregister and re-register the cpufreq driver.
One such example is arm big-little IKS cpufreq driver. While
re-registering the driver, same OPPs may get added again.

This patch detects the duplicacy and discards them.

Signed-off-by: Chander Kashyap 
Signed-off-by: Inderpal Singh 
---
 Changes in v2:
- Reorder check for duplicate opp

 drivers/base/power/opp.c |   13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index ca521e1..973da78 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -443,15 +443,24 @@ int dev_pm_opp_add(struct device *dev, unsigned long 
freq, unsigned long u_volt)
new_opp->u_volt = u_volt;
new_opp->available = true;
 
-   /* Insert new OPP in order of increasing frequency */
+   /*
+* Insert new OPP in order of increasing frequency
+* and discard if already present
+*/
head = &dev_opp->opp_list;
list_for_each_entry_rcu(opp, &dev_opp->opp_list, node) {
-   if (new_opp->rate < opp->rate)
+   if (new_opp->rate <= opp->rate)
break;
else
head = &opp->node;
}
 
+   if (new_opp->rate == opp->rate) {
+   mutex_unlock(&dev_opp_list_lock);
+   kfree(new_opp);
+   return 0;
+   }
+
list_add_rcu(&new_opp->node, head);
mutex_unlock(&dev_opp_list_lock);
 
-- 
1.7.9.5

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