ACPI: processor: thermal: Use more suitable cooling device data

Instead of passing an ACPI device object pointer as devdata to
thermal_cooling_device_create(), make acpi_processor_thermal_init()
pass a pointer to the struct acpi_processor representing the given CPU
to it, which allows the callback functions in processor_cooling_ops to
be simplified and the second argument of acpi_processor_thermal_init()
and acpi_processor_thermal_exit() to be dropped.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
Link: https://patch.msgid.link/6192780.MhkbZ0Pkbq@rafael.j.wysocki
This commit is contained in:
Rafael J. Wysocki 2026-09-11 15:05:50 +02:00
parent cdb9bf0faa
commit d1b25eb2d8
3 changed files with 7 additions and 33 deletions

View File

@ -164,7 +164,7 @@ static int __acpi_processor_start(struct acpi_device *device)
acpi_pss_perf_init(pr);
result = acpi_processor_thermal_init(pr, device);
result = acpi_processor_thermal_init(pr);
if (result)
goto err_power_exit;

View File

@ -235,15 +235,7 @@ static int
processor_get_max_state(struct thermal_cooling_device *cdev,
unsigned long *state)
{
struct acpi_device *device = cdev->devdata;
struct acpi_processor *pr;
if (!device)
return -EINVAL;
pr = acpi_driver_data(device);
if (!pr)
return -EINVAL;
struct acpi_processor *pr = cdev->devdata;
*state = acpi_processor_max_state(pr);
return 0;
@ -253,15 +245,7 @@ static int
processor_get_cur_state(struct thermal_cooling_device *cdev,
unsigned long *cur_state)
{
struct acpi_device *device = cdev->devdata;
struct acpi_processor *pr;
if (!device)
return -EINVAL;
pr = acpi_driver_data(device);
if (!pr)
return -EINVAL;
struct acpi_processor *pr = cdev->devdata;
*cur_state = cpufreq_get_cur_state(pr->id);
if (pr->flags.throttling)
@ -273,18 +257,10 @@ static int
processor_set_cur_state(struct thermal_cooling_device *cdev,
unsigned long state)
{
struct acpi_device *device = cdev->devdata;
struct acpi_processor *pr;
struct acpi_processor *pr = cdev->devdata;
int result = 0;
int max_pstate;
if (!device)
return -EINVAL;
pr = acpi_driver_data(device);
if (!pr)
return -EINVAL;
max_pstate = cpufreq_get_max_state(pr->id);
if (state > acpi_processor_max_state(pr))
@ -308,10 +284,9 @@ const struct thermal_cooling_device_ops processor_cooling_ops = {
.set_cur_state = processor_set_cur_state,
};
int acpi_processor_thermal_init(struct acpi_processor *pr,
struct acpi_device *device)
int acpi_processor_thermal_init(struct acpi_processor *pr)
{
pr->cdev = thermal_cooling_device_create(pr->dev, "Processor", device,
pr->cdev = thermal_cooling_device_create(pr->dev, "Processor", pr,
&processor_cooling_ops);
if (IS_ERR(pr->cdev))
return PTR_ERR(pr->cdev);

View File

@ -427,8 +427,7 @@ int acpi_processor_ffh_lpi_enter(struct acpi_lpi_state *lpi);
#endif /* CONFIG_ACPI_PROCESSOR_IDLE */
/* in processor_thermal.c */
int acpi_processor_thermal_init(struct acpi_processor *pr,
struct acpi_device *device);
int acpi_processor_thermal_init(struct acpi_processor *pr);
void acpi_processor_thermal_exit(struct acpi_processor *pr);
extern const struct thermal_cooling_device_ops processor_cooling_ops;
#ifdef CONFIG_CPU_FREQ