diff mbox

[V2,2/6] Thermal: make sure cpufreq cooling register after cpufreq driver

Message ID 1351079900-32236-3-git-send-email-hongbo.zhang@linaro.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Hongbo Zhang Oct. 24, 2012, 11:58 a.m. UTC
From: "hongbo.zhang" <hongbo.zhang@linaro.com>

The cpufreq works as a cooling device, so the cooling layer should check if the
cpufreq driver is initialized or not.

Signed-off-by: hongbo.zhang <hongbo.zhang@linaro.com>
---
 drivers/thermal/cpu_cooling.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Amit Kachhap Oct. 29, 2012, 11:42 a.m. UTC | #1
On 24 October 2012 17:28, hongbo.zhang <hongbo.zhang@linaro.org> wrote:
> From: "hongbo.zhang" <hongbo.zhang@linaro.com>
>
> The cpufreq works as a cooling device, so the cooling layer should check if the
> cpufreq driver is initialized or not.
>
> Signed-off-by: hongbo.zhang <hongbo.zhang@linaro.com>
> ---
>  drivers/thermal/cpu_cooling.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
> index b6b4c2a..7519a0b 100644
> --- a/drivers/thermal/cpu_cooling.c
> +++ b/drivers/thermal/cpu_cooling.c
> @@ -354,6 +354,10 @@ struct thermal_cooling_device *cpufreq_cooling_register(
>         int ret = 0, i;
>         struct cpufreq_policy policy;
>
> +       /* make sure cpufreq driver has been initialized */
> +       if (!cpufreq_frequency_get_table(cpumask_any(clip_cpus)))
> +               return ERR_PTR(-EPROBE_DEFER);
> +
Hi Hongbo,

I am not against this change but this might cause unnecessary delay in
probe thread. I also thought about it but have not put this
restriction. Actually you can put a check in platform_bind for this
condition and defer the binding till the time actual throttling
starts. So basically only after throttling cpufreq_table is needed.
(See my implementation exynos_thermal.c).

Thanks,
Amit Daniel
>         list_for_each_entry(cpufreq_dev, &cooling_cpufreq_list, node)
>                 cpufreq_dev_count++;
>
> --
> 1.7.11.3
>
>
> _______________________________________________
> linaro-dev mailing list
> linaro-dev@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-dev
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hongbo Zhang Oct. 30, 2012, 8:59 a.m. UTC | #2
On 29 October 2012 12:42, Amit Kachhap <amit.kachhap@linaro.org> wrote:
> On 24 October 2012 17:28, hongbo.zhang <hongbo.zhang@linaro.org> wrote:
>> From: "hongbo.zhang" <hongbo.zhang@linaro.com>
>>
>> The cpufreq works as a cooling device, so the cooling layer should check if the
>> cpufreq driver is initialized or not.
>>
>> Signed-off-by: hongbo.zhang <hongbo.zhang@linaro.com>
>> ---
>>  drivers/thermal/cpu_cooling.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
>> index b6b4c2a..7519a0b 100644
>> --- a/drivers/thermal/cpu_cooling.c
>> +++ b/drivers/thermal/cpu_cooling.c
>> @@ -354,6 +354,10 @@ struct thermal_cooling_device *cpufreq_cooling_register(
>>         int ret = 0, i;
>>         struct cpufreq_policy policy;
>>
>> +       /* make sure cpufreq driver has been initialized */
>> +       if (!cpufreq_frequency_get_table(cpumask_any(clip_cpus)))
>> +               return ERR_PTR(-EPROBE_DEFER);
>> +
> Hi Hongbo,
>
> I am not against this change but this might cause unnecessary delay in
> probe thread. I also thought about it but have not put this
> restriction. Actually you can put a check in platform_bind for this
> condition and defer the binding till the time actual throttling
> starts. So basically only after throttling cpufreq_table is needed.
> (See my implementation exynos_thermal.c).
In fact, this piece of checking code was in my
db8500_cpufreq_cooling_probe() before, I will move it back there
again, and the ST-E's policy is separating cooling devs and thermal
zone, so cannot be in binding function on my platform, only in probe
function instead.
>
> Thanks,
> Amit Daniel
>>         list_for_each_entry(cpufreq_dev, &cooling_cpufreq_list, node)
>>                 cpufreq_dev_count++;
>>
>> --
>> 1.7.11.3
>>
>>
>> _______________________________________________
>> linaro-dev mailing list
>> linaro-dev@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/linaro-dev
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index b6b4c2a..7519a0b 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -354,6 +354,10 @@  struct thermal_cooling_device *cpufreq_cooling_register(
 	int ret = 0, i;
 	struct cpufreq_policy policy;
 
+	/* make sure cpufreq driver has been initialized */
+	if (!cpufreq_frequency_get_table(cpumask_any(clip_cpus)))
+		return ERR_PTR(-EPROBE_DEFER);
+
 	list_for_each_entry(cpufreq_dev, &cooling_cpufreq_list, node)
 		cpufreq_dev_count++;