Re: [PATCH v3 0/3] thermal: introduce by-name softlink

From: Daniel Lezcano
Date: Tue Dec 10 2019 - 15:54:19 EST


On 10/12/2019 21:01, Wei Wang wrote:
> On Tue, Dec 10, 2019 at 6:36 AM Daniel Lezcano
> <daniel.lezcano@xxxxxxxxxx> wrote:
>>
>> On 05/12/2019 08:19, Wei Wang wrote:
>>> The paths thermal_zone%d and cooling_device%d are not intuitive and the
>>> numbers are subject to change due to device tree change. This usually
>>> leads to tree traversal in userspace code.
>>> The patch creates `tz-by-name' and `cdev-by-name' for thermal zone and
>>> cooling_device respectively.
>>
>> Instead of adding another ABI, I suggest we put the current one
>> deprecated with a warning in the dmesg, update the documentation and
>> change the name the next version.
>>
>>
>
> IMHO, we should keep the existing path which is a common pattern for
> sysfs interface. There are reasons we need couple thermal zone and
> cooling device in one class, but might be worth considering split as
> the latter might be used for other purposes e.g. battery current limit
> for preventive vdrop prevention. By nature, thermal zone are sensors,
> and cooling devices are usually components with potential high power
> use.

[Added Greghk and Rafael in Cc]

I understand but I would like to have Greg's and Rafael's opinion on that.

The result is:

ls -al /sys/devices/virtual/thermal/
total 0
drwxr-xr-x 22 root root 0 Dec 10 12:34 .
drwxr-xr-x 15 root root 0 Dec 10 12:34 ..
drwxr-xr-x 2 root root 0 Dec 10 13:18 cdev-by-name
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device0
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device1
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device10
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device11
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device12
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device13
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device14
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device15
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device2
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device3
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device4
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device5
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device6
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device7
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device8
drwxr-xr-x 3 root root 0 Dec 10 12:34 cooling_device9
drwxr-xr-x 3 root root 0 Dec 10 12:34 thermal_zone0
drwxr-xr-x 3 root root 0 Dec 10 12:34 thermal_zone1
drwxr-xr-x 2 root root 0 Dec 10 13:18 tz-by-name

ls -al /sys/devices/virtual/thermal/cdev-by-name/
total 0
drwxr-xr-x 2 root root 0 Dec 10 13:18 .
drwxr-xr-x 22 root root 0 Dec 10 12:34 ..
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-cpufreq-0 ->
../cooling_device0
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-cpufreq-1 ->
../cooling_device1
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-idle-0 -> ../cooling_device2
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-idle-1 -> ../cooling_device3
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-idle-10 ->
../cooling_device12
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-idle-11 ->
../cooling_device13
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-idle-12 ->
../cooling_device14
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-idle-13 ->
../cooling_device15
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-idle-2 -> ../cooling_device4
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-idle-3 -> ../cooling_device5
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-idle-4 -> ../cooling_device6
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-idle-5 -> ../cooling_device7
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-idle-6 -> ../cooling_device8
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-idle-7 -> ../cooling_device9
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-idle-8 -> ../cooling_device10
lrwxrwxrwx 1 root root 0 Dec 10 13:18 thermal-idle-9 -> ../cooling_device11

ls -al /sys/devices/virtual/thermal/tz-by-name/
total 0
drwxr-xr-x 2 root root 0 Dec 10 13:18 .
drwxr-xr-x 22 root root 0 Dec 10 12:34 ..
lrwxrwxrwx 1 root root 0 Dec 10 20:53 cpu -> ../thermal_zone0
lrwxrwxrwx 1 root root 0 Dec 10 20:53 gpu -> ../thermal_zone1



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