Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e98f033f authored by Jacob Tanenbaum's avatar Jacob Tanenbaum Committed by Rafael J. Wysocki
Browse files

cpupower: fix how "cpupower frequency-info" interprets latency



the intel-pstate driver does not support the ondemand governor and does not
have a valid value in
/sys/devices/system/cpu/cpu[x]/cpufreq/cpuinfo_transition_latency. The
intel-pstate driver sets cpuinfo_transition_latency to CPUFREQ_ETERNAL (-1),
the value written into cpuinfo_transition_latency is defind as an unsigned
int so checking the read value against max unsigned int will determine if the
value is valid.

Signed-off-by: default avatarJacob Tanenbaum <jtanenba@redhat.com>
Signed-off-by: default avatarThomas Renninger <trenn@suse.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 562e5f1a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -434,8 +434,8 @@ static int get_latency(unsigned int cpu, unsigned int human)
	unsigned long latency = cpufreq_get_transition_latency(cpu);

	printf(_("  maximum transition latency: "));
	if (!latency) {
		printf(_(" Cannot determine latency.\n"));
	if (!latency || latency == UINT_MAX) {
		printf(_(" Cannot determine or is not supported.\n"));
		return -EINVAL;
	}