mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Nishanth Menon <nm@ti.com>,
	Chander Kashyap <chander.kashyap@linaro.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Pavel Machek <pavel@ucw.cz>, "Brown, Len" <len.brown@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Chander Kashyap <k.chander@samsung.com>,
	Inderpal Singh <inderpal.s@samsung.com>
Subject: Re: [PATCH v3] PM / OPP: discard duplicate OPPs
Date: Tue, 20 May 2014 14:45:24 +0200	[thread overview]
Message-ID: <2638341.ymNLNAMmAG@vostro.rjw.lan> (raw)
In-Reply-To: <CAKohpomKvPcioNmfzvx7vqJHqs_TrhnHH6yYb5w_0f+YvA5hvA@mail.gmail.com>

On Tuesday, May 20, 2014 05:35:04 PM Viresh Kumar wrote:
> On 20 May 2014 16:56, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > But we aren't talking about failure here. Its not failure. The operation
> > we are trying to do is already done and nothing should break if the
> > OPP was already there or its added now. Its all the same.
> 
> Though after more thought into this I feel this must also be done:
> 
> diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
> index bdf09f5..3f540d8 100644
> --- a/drivers/base/power/opp.c
> +++ b/drivers/base/power/opp.c
> @@ -453,9 +453,13 @@ int dev_pm_opp_add(struct device *dev, unsigned
> long freq, unsigned long u_volt)
>         }
> 
>         if (new_opp->rate == opp->rate) {
> +               int ret = 0;

		int ret = new_opp->u_volt == opp->u_volt ? -EEXIST : 0;

would be slightly simpler IMO.

> +
> +               if (new_opp->u_volt == opp->u_volt)
> +                       ret = -EEXIST;
>                 mutex_unlock(&dev_opp_list_lock);
>                 kfree(new_opp);
> -               return 0;
> +               return ret;

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


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  parent reply	other threads:[~2014-05-20 12:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16  9:00 Chander Kashyap
2014-05-16 10:03 ` Viresh Kumar
2014-05-19 13:08 ` Nishanth Menon
2014-05-20  4:00   ` Viresh Kumar
2014-05-20 11:24     ` Nishanth Menon
2014-05-20 11:26       ` Viresh Kumar
2014-05-20 12:05         ` Viresh Kumar
2014-05-20 12:32           ` Nishanth Menon
2014-05-20 13:36             ` Viresh Kumar
2014-05-20 12:45           ` Rafael J. Wysocki [this message]
2014-05-20 13:29             ` Viresh Kumar
2014-05-20 13:31           ` Viresh Kumar
2014-05-20 13:36             ` Nishanth Menon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2638341.ymNLNAMmAG@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=chander.kashyap@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=inderpal.s@samsung.com \
    --cc=k.chander@samsung.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=pavel@ucw.cz \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®