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.

Dependency Surface

Detected Declarations

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

Implementation Notes