Re: [PATCH v3 6/7] thermal/drivers/cpu_cooling: Introduce the cpu idle cooling driver

From: Daniel Lezcano
Date: Wed Apr 11 2018 - 05:30:01 EST



Hi Viresh,

thanks for the review.


On 11/04/2018 10:51, Viresh Kumar wrote:

[ ... ]

>> +void __init cpuidle_cooling_register(void)
>> +{
>> + struct cpuidle_cooling_device *idle_cdev = NULL;
>> + struct thermal_cooling_device *cdev;
>> + struct device_node *np;
>> + cpumask_var_t cpumask;
>
> maybe call it clustermask ?

Yeah, sounds better.

>> + cdev = thermal_of_cooling_device_register(np, dev_name,
>> + idle_cdev,
>> + &cpuidle_cooling_ops);
>> + if (IS_ERR(cdev)) {
>> + ret = PTR_ERR(cdev);
>> + goto out;
>> + }
>> +
>> + idle_cdev->cdev = cdev;
>> + cpumask_set_cpu(cluster_id, cpumask);
>> + }
>> +
>> + ret = smpboot_register_percpu_thread(&cpuidle_cooling_threads);
>> + if (ret)
>> + goto out;
>> +
>> + pr_info("Created cpuidle cooling device\n");
>> +out:
>> + free_cpumask_var(cpumask);
>> +
>> + if (ret) {
>> + cpuidle_cooling_unregister();
>> + pr_err("Failed to create idle cooling device (%d)\n", ret);
>> + }
>
> Maybe rearrange it a bit:
>
> + ret = smpboot_register_percpu_thread(&cpuidle_cooling_threads);
> +
> +out:
> + if (ret) {
> + cpuidle_cooling_unregister();
> + pr_err("Failed to create idle cooling device (%d)\n", ret);
> + } else {
> + pr_info("Created cpuidle cooling devices\n");
> + }
> +
> + free_cpumask_var(cpumask);
>
> ??

I usually tend to avoid using 'else' statements when possible (a coding
style practice) but if you prefer this version I'm fine with that.



--
<http://www.linaro.org/> Linaro.org â Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog