thermal/drivers/int340x/processor_thermal: Split enumeration and processing part
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Tue, 25 May 2021 20:48:10 +0000 (13:48 -0700)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Sun, 4 Jul 2021 16:28:04 +0000 (18:28 +0200)
commit8fe145f7ceda7b8909cd471e1e75dd20dfbf41a5
treef3fc2d4b52203cb7136cebee56fe4d4d2dc4c5cc
parent8b2ea897328c3e042ef7c3e80503c802db24a678
thermal/drivers/int340x/processor_thermal: Split enumeration and processing part

Remove enumeration part from the processor_thermal_device to two
different modules. One for ACPI and one for PCI:
ACPI enumeration: int3401_thermal
PCI part: processor_thermal_device_pci_legacy

The current processor_thermal_device now just implements interface
functions to be used by the ACPI and PCI enumeration module. This is
done by:
1. Make functions proc_thermal_add() and proc_thermal_remove() non static
and export them for usage in other processor_thermal_device_pci_legacy.c
and in int3401_thermal.c.

2. Move the sysfs file creation for TCC offset and power limit attribute
group to the proc_thermal_add() from the individual enumeration callbacks
for PCI and ACPI.

3. Create new interface functions proc_thermal_mmio_add() and
proc_thermal_mmio_remove() which will be called from the
processor_thermal_device_pci_legacy module.

4. Export proc_thermal_resume(), so that it can be used by power
management callbacks.

5. Remove special check for double enumeration as it never happens.

While here, fix some cleanup on error conditions in proc_thermal_add().

No functional changes are expected with this change.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210525204811.3793651-2-srinivas.pandruvada@linux.intel.com
drivers/thermal/intel/int340x_thermal/Makefile
drivers/thermal/intel/int340x_thermal/int3401_thermal.c [new file with mode: 0644]
drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
drivers/thermal/intel/int340x_thermal/processor_thermal_device.h
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci_legacy.c [new file with mode: 0644]