From: Viresh Kumar <viresh.kumar@linaro.org>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: Rafael Wysocki <rjw@rjwysocki.net>,
Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
linux-pm@vger.kernel.org,
Vincent Guittot <vincent.guittot@linaro.org>,
Rajendra Nayak <rnayak@codeaurora.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PM / OPP: Add dev_pm_opp_{set|put}_clkname()
Date: Wed, 21 Jun 2017 10:30:38 +0530 [thread overview]
Message-ID: <20170621050038.GQ3942@vireshk-i7> (raw)
In-Reply-To: <20170620210820.GU4493@codeaurora.org>
On 20-06-17, 14:08, Stephen Boyd wrote:
> On 06/20, Viresh Kumar wrote:
> > + */
> > +struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *name)
> > +{
> > + struct opp_table *opp_table;
> > + int ret;
> > +
> > + opp_table = dev_pm_opp_get_opp_table(dev);
> > + if (!opp_table)
> > + return ERR_PTR(-ENOMEM);
> > +
> > + /* This should be called before OPPs are initialized */
> > + if (WARN_ON(!list_empty(&opp_table->opp_list))) {
> > + ret = -EBUSY;
> > + goto err;
> > + }
> > +
> > + /* Already have clkname set */
> > + if (opp_table->clk_name) {
> > + ret = -EBUSY;
> > + goto err;
> > + }
> > +
> > + opp_table->clk_name = kstrdup(name, GFP_KERNEL);
> > + if (!opp_table->clk_name) {
>
> Is there a reason to duplicate clk_name instead of using the clk
> structure returned from clk_get()? Is it because we may already
> have opp_table->clk set from default init? Why can't we always
> clk_put() the clk structure if it's !IS_ERR() and then allow
> dev_pm_opp_set_clkname() to be called many times in succession?
> Long story short, I don't see the benefit to allocating the name
> again here just to use it as a mechanism to know if the APIs have
> been called symmetrically.
Yeah, it was kind of required in what I was trying to do earlier, but
not anymore.
--
viresh
next prev parent reply other threads:[~2017-06-21 5:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-20 10:05 [PATCH] PM / OPP: Add dev_pm_opp_{set|put}_clkname() Viresh Kumar
2017-06-20 21:08 ` Stephen Boyd
2017-06-21 5:00 ` Viresh Kumar [this message]
2017-06-21 4:59 ` [PATCH V2] " Viresh Kumar
2017-06-21 17:38 ` Stephen Boyd
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=20170621050038.GQ3942@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nm@ti.com \
--cc=rjw@rjwysocki.net \
--cc=rnayak@codeaurora.org \
--cc=sboyd@codeaurora.org \
--cc=vincent.guittot@linaro.org \
--cc=vireshk@kernel.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