drivers/acpi/processor_thermal.c
Source file repositories/reference/linux-study-clean/drivers/acpi/processor_thermal.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/processor_thermal.c- Extension
.c- Size
- 8548 bytes
- Lines
- 364
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/init.hlinux/cpufreq.hlinux/acpi.hacpi/processor.hlinux/uaccess.hinternal.h
Detected Declarations
function phys_package_first_cpufunction cpu_has_cpufreqfunction cpufreq_get_max_statefunction cpufreq_get_cur_statefunction cpufreq_update_thermal_limitfunction cpufreq_set_cur_statefunction acpi_thermal_cpufreq_configfunction acpi_thermal_cpufreq_initfunction for_each_cpufunction acpi_thermal_cpufreq_exitfunction for_each_cpufunction cpufreq_get_max_statefunction cpufreq_get_cur_statefunction cpufreq_set_cur_statefunction acpi_processor_max_statefunction processor_get_max_statefunction processor_get_cur_statefunction processor_set_cur_statefunction acpi_processor_thermal_initfunction acpi_processor_thermal_exit
Annotated Snippet
if (ret < 0) {
pr_err("Failed to add freq constraint for CPU%d (%d)\n",
cpu, ret);
continue;
}
thermal_cooling_device_update(pr->cdev);
}
}
void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy)
{
unsigned int cpu;
for_each_cpu(cpu, policy->related_cpus) {
struct acpi_processor *pr = per_cpu(processors, cpu);
if (!pr)
continue;
freq_qos_remove_request(&pr->thermal_req);
thermal_cooling_device_update(pr->cdev);
}
}
#else /* ! CONFIG_CPU_FREQ */
static int cpufreq_get_max_state(unsigned int cpu)
{
return 0;
}
static int cpufreq_get_cur_state(unsigned int cpu)
{
return 0;
}
static int cpufreq_set_cur_state(unsigned int cpu, int state)
{
return 0;
}
#endif
/* thermal cooling device callbacks */
static int acpi_processor_max_state(struct acpi_processor *pr)
{
int max_state = 0;
/*
* There exists four states according to
* cpufreq_thermal_reduction_step. 0, 1, 2, 3
*/
max_state += cpufreq_get_max_state(pr->id);
if (pr->flags.throttling)
max_state += (pr->throttling.state_count -1);
return max_state;
}
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;
*state = acpi_processor_max_state(pr);
return 0;
}
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;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `linux/cpufreq.h`, `linux/acpi.h`, `acpi/processor.h`, `linux/uaccess.h`, `internal.h`.
- Detected declarations: `function phys_package_first_cpu`, `function cpu_has_cpufreq`, `function cpufreq_get_max_state`, `function cpufreq_get_cur_state`, `function cpufreq_update_thermal_limit`, `function cpufreq_set_cur_state`, `function acpi_thermal_cpufreq_config`, `function acpi_thermal_cpufreq_init`, `function for_each_cpu`, `function acpi_thermal_cpufreq_exit`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.