diff mbox series

[v1,01/10] cpufreq: Add thermal_cooling_device pointer to struct cpufreq_policy

Message ID 168294311714f269b1050bcbf5d3324eae0808f2.1547481320.git.amit.kucheria@linaro.org
State New
Headers show
Series [v1,01/10] cpufreq: Add thermal_cooling_device pointer to struct cpufreq_policy | expand

Commit Message

Amit Kucheria Jan. 14, 2019, 4:34 p.m. UTC
Several cpufreq drivers register themselves as thermal cooling devices.
Adding a pointer to struct cpufreq_policy removes the need for them to
store this pointer in a private data structure.

We can then auto-register the cpufreq driver as a thermal cooling device
from cpufreq core code.

Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>

---
 include/linux/cpufreq.h | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.17.1

Comments

Rafael J. Wysocki Jan. 16, 2019, 10:56 p.m. UTC | #1
On Monday, January 14, 2019 5:34:53 PM CET Amit Kucheria wrote:
> Several cpufreq drivers register themselves as thermal cooling devices.

> Adding a pointer to struct cpufreq_policy removes the need for them to

> store this pointer in a private data structure.

> 

> We can then auto-register the cpufreq driver as a thermal cooling device

> from cpufreq core code.

> 

> Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>

> ---

>  include/linux/cpufreq.h | 5 +++++

>  1 file changed, 5 insertions(+)

> 

> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h

> index c86d6d8bdfed..7d0cf54125fa 100644

> --- a/include/linux/cpufreq.h

> +++ b/include/linux/cpufreq.h

> @@ -95,6 +95,11 @@ struct cpufreq_policy {

>  	struct cpufreq_frequency_table	*freq_table;

>  	enum cpufreq_table_sorting freq_table_sorted;

>  

> +#ifdef CONFIG_CPU_THERMAL

> +	/* Pointer to the cooling device if used for thermal mitigation */

> +	struct thermal_cooling_device *cooldev;

> +#endif

> +


Why here and not at the end of the struct?

>  	struct list_head        policy_list;

>  	struct kobject		kobj;

>  	struct completion	kobj_unregister;

> 


Also, I would suggest combining this one with patch [02/10].
Amit Kucheria Jan. 21, 2019, 3:35 p.m. UTC | #2
On Thu, Jan 17, 2019 at 4:27 AM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>

> On Monday, January 14, 2019 5:34:53 PM CET Amit Kucheria wrote:

> > Several cpufreq drivers register themselves as thermal cooling devices.

> > Adding a pointer to struct cpufreq_policy removes the need for them to

> > store this pointer in a private data structure.

> >

> > We can then auto-register the cpufreq driver as a thermal cooling device

> > from cpufreq core code.

> >

> > Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>

> > ---

> >  include/linux/cpufreq.h | 5 +++++

> >  1 file changed, 5 insertions(+)

> >

> > diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h

> > index c86d6d8bdfed..7d0cf54125fa 100644

> > --- a/include/linux/cpufreq.h

> > +++ b/include/linux/cpufreq.h

> > @@ -95,6 +95,11 @@ struct cpufreq_policy {

> >       struct cpufreq_frequency_table  *freq_table;

> >       enum cpufreq_table_sorting freq_table_sorted;

> >

> > +#ifdef CONFIG_CPU_THERMAL

> > +     /* Pointer to the cooling device if used for thermal mitigation */

> > +     struct thermal_cooling_device *cooldev;

> > +#endif

> > +

>

> Why here and not at the end of the struct?


Fixed

> >       struct list_head        policy_list;

> >       struct kobject          kobj;

> >       struct completion       kobj_unregister;

> >

>

> Also, I would suggest combining this one with patch [02/10].


Will do.

Thanks for the review.
diff mbox series

Patch

diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index c86d6d8bdfed..7d0cf54125fa 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -95,6 +95,11 @@  struct cpufreq_policy {
 	struct cpufreq_frequency_table	*freq_table;
 	enum cpufreq_table_sorting freq_table_sorted;
 
+#ifdef CONFIG_CPU_THERMAL
+	/* Pointer to the cooling device if used for thermal mitigation */
+	struct thermal_cooling_device *cooldev;
+#endif
+
 	struct list_head        policy_list;
 	struct kobject		kobj;
 	struct completion	kobj_unregister;