Re: [PATCH 2/3] thermal/drivers/devfreq_cooling: Use device name instead of auto-numbering

From: Daniel Lezcano
Date: Fri Mar 12 2021 - 10:54:44 EST


On 12/03/2021 12:15, Lukasz Luba wrote:
>
>
> On 3/10/21 11:45 AM, Daniel Lezcano wrote:
>> Currently the naming of a cooling device is just a cooling technique
>> followed by a number. When there are multiple cooling devices using
>> the same technique, it is impossible to clearly identify the related
>> device as this one is just a number.
>>
>> For instance:
>>
>>   thermal-devfreq-0
>>   thermal-devfreq-1
>>   etc ...
>>
>> The 'thermal' prefix is redundant with the subsystem namespace. This
>> patch removes the 'thermal prefix and changes the number by the device
>
> missing ' after 'thermal
>
>> name. So the naming above becomes:
>>
>>   devfreq-5000000.gpu
>>   devfreq-1d84000.ufshc
>>   etc ...
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
>> ---

[ ... ]

> ---------------------------------------------------------
>
> We should allocate tmp buffer for it, to not loose the meaningful part
> of that string name or end up with only the same prefix, like for the
> first 3 from top:
>
> devfreq-18321000.qco
>
> or for the GPU:
> devfreq-3d00000.qcom
>
> This is tricky area and vendors might put any non-meaningful prefix.
>
> The rest of the code looks OK, only this name construction part.

That requires a change in the thermal_core code to replace the strlcpy
into the cdev->type by a kstrdup.

Otherwise the name will be truncated in any case by the underlying
thermal_cooling_device_register() function.


--
<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