Hi Javi,

Sorry for picking up an old thread, but i had a question for you.

On Mon, Mar 2, 2015 at 10:47 PM, Javi Merino <[email protected]> wrote:
> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c

> @@ -588,12 +590,20 @@ static int cpufreq_get_requested_power(struct 
> thermal_cooling_device *cdev,
>                                        u32 *power)
>  {
>         unsigned long freq;
> -       int cpu, ret;
> +       int i = 0, cpu, ret;
>         u32 static_power, dynamic_power, total_load = 0;
>         struct cpufreq_cooling_device *cpufreq_device = cdev->devdata;
> +       u32 *load_cpu = NULL;
>
>         freq = cpufreq_quick_get(cpumask_any(&cpufreq_device->allowed_cpus));
>
> +       if (trace_thermal_power_cpu_get_power_enabled()) {

You allocated load_cpu if cpu_get_power trace is enabled.

> +               u32 ncpus = cpumask_weight(&cpufreq_device->allowed_cpus);
> +
> +               load_cpu = devm_kcalloc(&cdev->device, ncpus, 
> sizeof(*load_cpu),
> +                                       GFP_KERNEL);
> +       }
> +
>         for_each_cpu(cpu, &cpufreq_device->allowed_cpus) {
>                 u32 load;
>
> @@ -603,14 +613,29 @@ static int cpufreq_get_requested_power(struct 
> thermal_cooling_device *cdev,
>                         load = 0;
>
>                 total_load += load;
> +               if (trace_thermal_power_cpu_limit_enabled() && load_cpu)

But you store values to it only if cpu_limit trace is also enabled,
otherwise it is all zeros.

Why?

Reply via email to