parent device of thermal cooling device

From: Armin Wolf
Date: Tue Apr 26 2022 - 19:08:22 EST


Hello,

i am currently working on integrating an hwmon driver (dell_smm_hwmon) into the thermal subsystem.
While doing that, i noticed that when registering cooling devices, the thermal subsystem
does not allow passing a parent device, so there is no "device/" symlink being created.

This creates problems for example when a thermal driver is instantiated multiple times while
creating cooling devices with the same type. Without the "device/" symlink, userspace is
unable to tell which cooling device belongs to which device.

The acpi fan driver is already inserting a symlink between the cooling device and the ACPI device
to avoid such issues, but such a symlink could be created automatically by allowing the driver
to pass a parent device when registering with the thermal subsystem.

Two approaches are possible:

1. Pass a separate device struct as parent device to __thermal_cooling_device_register().

2. Replace the device tree node argument with a parent device and use the device tree node
from this device.

Which approach would be the more feasible one?

Armin Wolf