Commit 2064fe4b authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge tag 'linux-cpupower-6.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux

Pull a cpupower utility update for Linux 6.20-rc1 from Shuah Khan:

"Fixes to miscellaneous problems in cpupower tool:

 - idle_monitor: fix incorrect value logged after stop
 - Fix inverted APERF capability check
 - Use strcspn() to strip trailing newline
 - Reset errno before strtoull()
 - Show C0 in idle-info dump"

* tag 'linux-cpupower-6.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux:
  tools/power cpupower: Show C0 in idle-info dump
  tools/power cpupower: Reset errno before strtoull()
  tools/cpupower: Use strcspn() to strip trailing newline
  tools/cpupower: Fix inverted APERF capability check
  cpupower: idle_monitor: fix incorrect value logged after stop
parents 9ace4753 ff72619e
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ unsigned long long cpuidle_state_get_one_value(unsigned int cpu,
	if (len == 0)
		return 0;

	errno = 0;
	value = strtoull(linebuf, &endp, 0);

	if (endp == linebuf || errno == ERANGE)
@@ -193,8 +194,7 @@ static char *cpuidle_state_get_one_string(unsigned int cpu,
	if (result == NULL)
		return NULL;

	if (result[strlen(result) - 1] == '\n')
		result[strlen(result) - 1] = '\0';
	result[strcspn(result, "\n")] = '\0';

	return result;
}
@@ -366,8 +366,7 @@ static char *sysfs_cpuidle_get_one_string(enum cpuidle_string which)
	if (result == NULL)
		return NULL;

	if (result[strlen(result) - 1] == '\n')
		result[strlen(result) - 1] = '\0';
	result[strcspn(result, "\n")] = '\0';

	return result;
}
+1 −1
Original line number Diff line number Diff line
@@ -270,7 +270,7 @@ static int get_freq_hardware(unsigned int cpu, unsigned int human)
{
	unsigned long freq;

	if (cpupower_cpu_info.caps & CPUPOWER_CAP_APERF)
	if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_APERF))
		return -EINVAL;

	freq = cpufreq_get_freq_hardware(cpu);
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ static void proc_cpuidle_cpu_output(unsigned int cpu)
	printf(_("max_cstate:              C%u\n"), cstates-1);
	printf(_("maximum allowed latency: %lu usec\n"), max_allowed_cstate);
	printf(_("states:\t\n"));
	for (cstate = 1; cstate < cstates; cstate++) {
	for (cstate = 0; cstate < cstates; cstate++) {
		printf(_("    C%d:                  "
			 "type[C%d] "), cstate, cstate);
		printf(_("promotion[--] demotion[--] "));
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ static int cpuidle_stop(void)
			current_count[cpu][state] =
				cpuidle_state_time(cpu, state);
			dprint("CPU %d - State: %d - Val: %llu\n",
			       cpu, state, previous_count[cpu][state]);
			       cpu, state, current_count[cpu][state]);
		}
	}
	return 0;