drivers/thermal/gov_fair_share.c
Source file repositories/reference/linux-study-clean/drivers/thermal/gov_fair_share.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/thermal/gov_fair_share.c- Extension
.c- Size
- 3278 bytes
- Lines
- 120
- Domain
- Driver Families
- Bucket
- drivers/thermal
- 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/thermal.hthermal_trace.hthermal_core.h
Detected Declarations
function Copyrightfunction for_each_trip_descfunction fair_share_throttlefunction list_for_each_entryfunction list_for_each_entryfunction fair_share_managefunction for_each_trip_desc
Annotated Snippet
if (total_weight) {
dividend *= instance->weight;
divisor *= total_weight;
} else {
divisor *= nr_instances;
}
instance->target = div_u64(dividend, divisor);
thermal_cdev_update_nocheck(cdev);
}
}
static void fair_share_manage(struct thermal_zone_device *tz)
{
int trip_level = get_trip_level(tz);
const struct thermal_trip_desc *td;
lockdep_assert_held(&tz->lock);
for_each_trip_desc(tz, td) {
const struct thermal_trip *trip = &td->trip;
if (trip->temperature == THERMAL_TEMP_INVALID ||
trip->type == THERMAL_TRIP_CRITICAL ||
trip->type == THERMAL_TRIP_HOT)
continue;
fair_share_throttle(tz, td, trip_level);
}
}
static struct thermal_governor thermal_gov_fair_share = {
.name = "fair_share",
.manage = fair_share_manage,
};
THERMAL_GOVERNOR_DECLARE(thermal_gov_fair_share);
Annotation
- Immediate include surface: `linux/thermal.h`, `thermal_trace.h`, `thermal_core.h`.
- Detected declarations: `function Copyright`, `function for_each_trip_desc`, `function fair_share_throttle`, `function list_for_each_entry`, `function list_for_each_entry`, `function fair_share_manage`, `function for_each_trip_desc`.
- Atlas domain: Driver Families / drivers/thermal.
- 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.