From: Viresh Kumar <viresh.kumar@linaro.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Amit Kucheria <amit.kucheria@linaro.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-arm-msm <linux-arm-msm@vger.kernel.org>,
Eduardo Valentin <edubezval@gmail.com>,
Stephen Boyd <swboyd@chromium.org>,
Doug Anderson <dianders@chromium.org>,
Matthias Kaehlcke <mka@chromium.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Ingo Molnar <mingo@kernel.org>,
Sudeep Holla <sudeep.holla@arm.com>,
Tao Wang <kevin.wangtao@hisilicon.com>,
Linux PM <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v2 2/9] cpufreq: Auto-register the driver as a thermal cooling device if asked
Date: Wed, 23 Jan 2019 16:14:03 +0530 [thread overview]
Message-ID: <20190123104403.bl7mdidmvd7c227q@vireshk-i7> (raw)
In-Reply-To: <20190123104322.o3whk6rfiaootspn@vireshk-i7>
On 23-01-19, 16:13, Viresh Kumar wrote:
> On 23-01-19, 11:39, Rafael J. Wysocki wrote:
> > On Wed, Jan 23, 2019 at 11:36 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > >
> > > On 21-01-19, 21:10, Amit Kucheria wrote:
> > > > @@ -151,6 +152,11 @@ struct cpufreq_policy {
> > > >
> > > > /* For cpufreq driver's internal use */
> > > > void *driver_data;
> > > > +
> > > > +#ifdef CONFIG_CPU_THERMAL
> > > > + /* Pointer to the cooling device if used for thermal mitigation */
> > > > + struct thermal_cooling_device *cdev;
> > > > +#endif
> > > > };
> > > >
> > > > /* Only for ACPI */
> > > > @@ -386,6 +392,12 @@ struct cpufreq_driver {
> > > > */
> > > > #define CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING BIT(6)
> > > >
> > > > +/*
> > > > + * Set by drivers that want the core to automatically register the cpufreq
> > > > + * driver as a thermal cooling device.
> > > > + */
> > > > +#define CPUFREQ_AUTO_REGISTER_COOLING_DEV BIT(7)
> > > > +
> > > > int cpufreq_register_driver(struct cpufreq_driver *driver_data);
> > > > int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
> > > >
> > > > @@ -415,6 +427,19 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy)
> > > > policy->cpuinfo.max_freq);
> > > > }
> > > >
> > > > +#ifdef CONFIG_CPU_THERMAL
> > > > +static inline void register_cooling_device(struct cpufreq_policy *policy) {
> > > > + policy->cdev = of_cpufreq_cooling_register(policy);
> > > > +}
> > > > +
> > > > +static inline void unregister_cooling_device(struct cpufreq_policy *policy) {
> > > > + cpufreq_cooling_unregister(policy->cdev);
> > > > + policy->cdev = NULL;
> > > > +}
> > > > +#else
> > > > +static inline void register_cooling_device(struct cpufreq_policy *policy) {}
> > > > +static inline void unregister_cooling_device(struct cpufreq_policy *policy) {}
> > > > +#endif
> > >
> > > The whole ifdef hackery here saves space for a pointer per policy.
> > > Just get rid of it, it isn't worth it.
> >
> > Is struct thermal_cooling_device defined if CONFIG_THERMAL is unset?
>
> No and it is defined in thermal.h without any ifdef stuff.
I meant it is always available and doesn't depend on CONFIG_THERMAL.
--
viresh
next prev parent reply other threads:[~2019-01-23 10:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-21 15:40 [PATCH v2 0/9] cpufreq: Add flag to auto-register as cooling Amit Kucheria
2019-01-21 15:40 ` [PATCH v2 1/9] thermal: cpu_cooling: Require thermal core to be compiled in Amit Kucheria
2019-01-23 10:34 ` Viresh Kumar
2019-01-23 10:52 ` Amit Kucheria
2019-01-23 10:54 ` Rafael J. Wysocki
2019-01-21 15:40 ` [PATCH v2 2/9] cpufreq: Auto-register the driver as a thermal cooling device if asked Amit Kucheria
2019-01-23 10:36 ` Viresh Kumar
2019-01-23 10:39 ` Rafael J. Wysocki
2019-01-23 10:43 ` Viresh Kumar
2019-01-23 10:44 ` Viresh Kumar [this message]
2019-01-23 10:53 ` Rafael J. Wysocki
2019-01-21 15:40 ` [PATCH v2 3/9] cpufreq: qcom-hw: Register as a cpufreq cooling device Amit Kucheria
2019-01-21 15:40 ` [PATCH v2 4/9] cpufreq: imx6q: Use auto-registration of thermal " Amit Kucheria
2019-01-21 15:40 ` [PATCH v2 5/9] cpufreq: cpufreq-dt: " Amit Kucheria
2019-01-21 15:40 ` [PATCH v2 6/9] cpufreq: mediatek: " Amit Kucheria
2019-01-21 15:40 ` [PATCH v2 7/9] cpufreq: qoriq: " Amit Kucheria
2019-01-21 15:40 ` [PATCH v2 8/9] cpufreq: scmi: " Amit Kucheria
2019-01-21 15:40 ` [PATCH v2 9/9] cpufreq: scpi: " Amit Kucheria
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=20190123104403.bl7mdidmvd7c227q@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=amit.kucheria@linaro.org \
--cc=dianders@chromium.org \
--cc=edubezval@gmail.com \
--cc=kevin.wangtao@hisilicon.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mka@chromium.org \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
--cc=sudeep.holla@arm.com \
--cc=swboyd@chromium.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).