From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Thara Gopinath <thara.gopinath@linaro.org>
Cc: rui.zhang@intel.com, ulf.hansson@linaro.org,
daniel.lezcano@linaro.org, agross@kernel.org, robh@kernel.org,
amit.kucheria@verdurent.com, mark.rutland@arm.com,
rjw@rjwysocki.net, linux-pm@vger.kernel.org,
devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [Patch v5 4/6] soc: qcom: Extend RPMh power controller driver to register warming devices.
Date: Mon, 30 Mar 2020 15:29:33 -0700 [thread overview]
Message-ID: <20200330222933.GC215915@minitux> (raw)
In-Reply-To: <f20b4940-11ad-82b1-6ece-661a1b033df8@linaro.org>
On Mon 30 Mar 07:53 PDT 2020, Thara Gopinath wrote:
> On 3/27/20 6:53 PM, Bjorn Andersson wrote:
> > On Thu 19 Mar 18:41 PDT 2020, Thara Gopinath wrote:
[..]
> > > +static int __init rpmhpd_init_warming_device(void)
> > > +{
> > > + size_t num_pds;
> > > + struct rpmhpd **rpmhpds;
> > > + int i;
> > > +
> > > + if (!global_desc)
> > > + return -EINVAL;
> > > +
> > > + rpmhpds = global_desc->rpmhpds;
> > > + num_pds = global_desc->num_pds;
> > > +
> > > + if (!of_find_property(rpmhpds[0]->dev->of_node, "#cooling-cells", NULL))
> > > + return 0;
> > > +
> > > + for (i = 0; i < num_pds; i++)
> > > + if (rpmhpds[i]->is_warming_dev)
> > > + of_pd_warming_register(rpmhpds[i]->dev, i);
> > > +
> > > + return 0;
> > > +}
> > > +late_initcall(rpmhpd_init_warming_device);
> >
> > ...why can't this be done in rpmhpd_probe()?
> >
> > In particular with the recent patches from John Stultz to allow rpmhpd
> > to be built as a module I don't think there's any guarantees that
> > rpmh_probe() will have succeeded before rpmhpd_init_warming_device()
> > executes.
>
> It is to take care of boot order.
Understood.
> So this has to happen after the thermal framework is initialized. Thermal
> framework is initialized with core_initcall. Can I move the rpmhpd init as a
> postcore_initcall ? Then I can get rid of this separate function and keep it
> as part of probe.
>
So I presume the problem is that if this is called from probe, you might
of_pd_warming_register(), which ends up in
__thermal_cooling_device_register() before thermal_init() has been
invoked?
Which is bad because e.g. thermal_class is not yet initialized.
I don't want to rely on the order of initcalls for things to work, so
could we make this more robust by having
thermal_of_cooling_device_register() return -EPROBE_DEFER is
thermal_init() isn't done?
Regards,
Bjorn
next prev parent reply other threads:[~2020-03-30 22:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-20 1:41 [Patch v5 0/6] Introduce Power domain based warming device driver Thara Gopinath
2020-03-20 1:41 ` [Patch v5 1/6] PM/Domains: Add support for retrieving genpd performance states information Thara Gopinath
2020-03-27 22:33 ` Bjorn Andersson
2020-03-20 1:41 ` [Patch v5 2/6] soc: qcom: rpmhpd: Introduce function to retrieve power domain performance state count Thara Gopinath
2020-03-27 22:15 ` Bjorn Andersson
2020-03-30 14:41 ` Thara Gopinath
2020-03-20 1:41 ` [Patch v5 3/6] thermal: Add generic power domain warming device driver Thara Gopinath
2020-03-23 15:57 ` Ulf Hansson
2020-03-25 14:35 ` Thara Gopinath
2020-03-20 1:41 ` [Patch v5 4/6] soc: qcom: Extend RPMh power controller driver to register warming devices Thara Gopinath
2020-03-27 22:53 ` Bjorn Andersson
2020-03-30 14:53 ` Thara Gopinath
2020-03-30 22:29 ` Bjorn Andersson [this message]
2020-03-20 1:41 ` [Patch v5 5/6] dt-bindings: power: Extend RPMh power controller binding to describe thermal warming device Thara Gopinath
2020-03-20 22:56 ` Rob Herring
2020-03-20 1:41 ` [Patch v5 6/6] arm64: dts: qcom: Indicate rpmhpd hosts a power domain that can be used as a " Thara Gopinath
2020-03-27 22:54 ` Bjorn Andersson
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=20200330222933.GC215915@minitux \
--to=bjorn.andersson@linaro.org \
--cc=agross@kernel.org \
--cc=amit.kucheria@verdurent.com \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=rjw@rjwysocki.net \
--cc=robh@kernel.org \
--cc=rui.zhang@intel.com \
--cc=thara.gopinath@linaro.org \
--cc=ulf.hansson@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;
as well as URLs for NNTP newsgroup(s).