lkml.org 
[lkml]   [2014]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v3] PM / OPP: discard duplicate OPPs
    On 05/16/2014 04:00 AM, Chander Kashyap wrote:
    > From: Chander Kashyap <k.chander@samsung.com>
    >
    > This patch detects the duplicate OPP entries and discards them
    >
    > Signed-off-by: Chander Kashyap <k.chander@samsung.com>
    > Signed-off-by: Inderpal Singh <inderpal.s@samsung.com>
    > ---
    > Changes in v3:
    > - Modify the commit log
    > 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;

    IF we decide on ensuring that the OPP additions are done one time[1] -
    then returning -EEXIST is appropriate here. we want to be able to
    catch warnings of sequencing errors, and returning 0 is not the way to
    do it.

    > + }
    > +
    > list_add_rcu(&new_opp->node, head);
    > mutex_unlock(&dev_opp_list_lock);
    >
    >

    [1] http://marc.info/?l=linux-pm&m=140034777229205&w=2

    --
    Regards,
    Nishanth Menon


    \
     
     \ /
      Last update: 2014-05-23 15:41    [W:2.303 / U:0.108 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site